From d8ee309227f676f9c633e1db981604e2d15b8b8d Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Wed, 9 Sep 2015 16:47:20 +0800 Subject: [PATCH] Bug 1200194 - Tweak formatting and debug logging. r=roc No logic change is involved. --HG-- extra : commitid : KCG4QMsPhdY extra : rebase_source : 2dc984fe27992b95e51f9bc1c5af52fcafc57844 --- layout/base/AccessibleCaret.cpp | 2 +- layout/base/AccessibleCaretEventHub.cpp | 9 +++++++++ layout/base/AccessibleCaretManager.cpp | 27 ++++++++++++++----------- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/layout/base/AccessibleCaret.cpp b/layout/base/AccessibleCaret.cpp index 64144e67a9b2..35bc98c70c6d 100644 --- a/layout/base/AccessibleCaret.cpp +++ b/layout/base/AccessibleCaret.cpp @@ -112,7 +112,7 @@ AccessibleCaret::SetSelectionBarEnabled(bool aEnabled) return; } - AC_LOG("%s, enabled %d", __FUNCTION__, aEnabled); + AC_LOG("Set selection bar %s", __FUNCTION__, aEnabled ? "Enabled" : "Disabled"); ErrorResult rv; CaretElement()->ClassList()->Toggle(NS_LITERAL_STRING("no-bar"), diff --git a/layout/base/AccessibleCaretEventHub.cpp b/layout/base/AccessibleCaretEventHub.cpp index fc1478ae0f5d..183227a35f57 100644 --- a/layout/base/AccessibleCaretEventHub.cpp +++ b/layout/base/AccessibleCaretEventHub.cpp @@ -611,8 +611,17 @@ AccessibleCaretEventHub::HandleKeyboardEvent(WidgetKeyboardEvent* aEvent) { switch (aEvent->mMessage) { case eKeyUp: + AC_LOGV("eKeyUp, state: %s", mState->Name()); + mManager->OnKeyboardEvent(); + break; + case eKeyDown: + AC_LOGV("eKeyDown, state: %s", mState->Name()); + mManager->OnKeyboardEvent(); + break; + case eKeyPress: + AC_LOGV("eKeyPress, state: %s", mState->Name()); mManager->OnKeyboardEvent(); break; diff --git a/layout/base/AccessibleCaretManager.cpp b/layout/base/AccessibleCaretManager.cpp index 95ae4aba4cad..fe6df170208e 100644 --- a/layout/base/AccessibleCaretManager.cpp +++ b/layout/base/AccessibleCaretManager.cpp @@ -175,7 +175,7 @@ AccessibleCaretManager::UpdateCaretsForCursorMode() void AccessibleCaretManager::UpdateCaretsForSelectionMode() { - AC_LOG("%s, selection: %p", __FUNCTION__, GetSelection()); + AC_LOG("%s: selection: %p", __FUNCTION__, GetSelection()); int32_t startOffset = 0; nsIFrame* startFrame = FindFirstNodeWithFrame(false, &startOffset); @@ -189,21 +189,24 @@ AccessibleCaretManager::UpdateCaretsForSelectionMode() return; } - auto updateSingleCaret = [](AccessibleCaret * aCaret, nsIFrame * aFrame, - int32_t aOffset)->PositionChangedResult + auto updateSingleCaret = [](AccessibleCaret* aCaret, nsIFrame* aFrame, + int32_t aOffset) -> PositionChangedResult { PositionChangedResult result = aCaret->SetPosition(aFrame, aOffset); aCaret->SetSelectionBarEnabled(true); + switch (result) { - case PositionChangedResult::NotChanged: - // Do nothing - break; - case PositionChangedResult::Changed: - aCaret->SetAppearance(Appearance::Normal); - break; - case PositionChangedResult::Invisible: - aCaret->SetAppearance(Appearance::NormalNotShown); - break; + case PositionChangedResult::NotChanged: + // Do nothing + break; + + case PositionChangedResult::Changed: + aCaret->SetAppearance(Appearance::Normal); + break; + + case PositionChangedResult::Invisible: + aCaret->SetAppearance(Appearance::NormalNotShown); + break; } return result; };