Bug 1204872 - Add documentation and rename mCaretMode. r=roc

Rename mCaretMode to mLastUpdateCaretsMode to make it clear that this
variable track the caret mode since last update. This also avoid the
confusion that GetCaretMode() returns mCaretMode.

--HG--
extra : commitid : BoFaTHocik
extra : rebase_source : 944882f796904671d516f4e15edb39a5ae88bada
This commit is contained in:
Ting-Yu Lin 2015-09-19 01:05:18 +08:00
parent a54527efd5
commit 1e2a01e453
2 changed files with 13 additions and 6 deletions

View File

@ -99,9 +99,9 @@ AccessibleCaretManager::HideCarets()
void
AccessibleCaretManager::UpdateCarets(UpdateCaretsHint aHint)
{
mCaretMode = GetCaretMode();
mLastUpdateCaretMode = GetCaretMode();
switch (mCaretMode) {
switch (mLastUpdateCaretMode) {
case CaretMode::None:
HideCarets();
break;
@ -402,7 +402,7 @@ AccessibleCaretManager::OnScrollStart()
void
AccessibleCaretManager::OnScrollEnd()
{
if (mCaretMode != GetCaretMode()) {
if (mLastUpdateCaretMode != GetCaretMode()) {
return;
}
@ -418,7 +418,7 @@ AccessibleCaretManager::OnScrollEnd()
void
AccessibleCaretManager::OnScrollPositionChanged()
{
if (mCaretMode != GetCaretMode()) {
if (mLastUpdateCaretMode != GetCaretMode()) {
return;
}
@ -429,7 +429,7 @@ AccessibleCaretManager::OnScrollPositionChanged()
void
AccessibleCaretManager::OnReflow()
{
if (mCaretMode != GetCaretMode()) {
if (mLastUpdateCaretMode != GetCaretMode()) {
return;
}

View File

@ -115,7 +115,10 @@ protected:
// appearance to Normal.
RespectOldAppearance
};
// Update carets based on current selection status.
void UpdateCarets(UpdateCaretsHint aHint = UpdateCaretsHint::Default);
// Force hiding all carets regardless of the current selection status.
void HideCarets();
void UpdateCaretsForCursorMode(UpdateCaretsHint aHint);
@ -182,8 +185,12 @@ protected:
// The caret being pressed or dragged.
AccessibleCaret* mActiveCaret = nullptr;
// The timer for hiding the caret in cursor mode after timeout behind the
// preference "layout.accessiblecaret.timeout_ms".
nsCOMPtr<nsITimer> mCaretTimeoutTimer;
CaretMode mCaretMode = CaretMode::None;
// The caret mode since last update carets.
CaretMode mLastUpdateCaretMode = CaretMode::None;
static const int32_t kAutoScrollTimerDelay = 30;
};