Bug 1200194 - Tweak formatting and debug logging. r=roc
authorTing-Yu Lin <tlin@mozilla.com>
Wed, 09 Sep 2015 16:47:20 +0800
changeset 294343 9ddf3be46d2ab81dfa86c326c98efb4b7e6317c8
parent 294342 bc60f34e6b6e3e84de94b09ee5b79927c53e9966
child 294344 8d4c356a8c160510b55660b01b38535cc4171169
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1200194
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1200194 - Tweak formatting and debug logging. r=roc No logic change is involved.
layout/base/AccessibleCaret.cpp
layout/base/AccessibleCaretEventHub.cpp
layout/base/AccessibleCaretManager.cpp
--- a/layout/base/AccessibleCaret.cpp
+++ b/layout/base/AccessibleCaret.cpp
@@ -107,17 +107,17 @@ AccessibleCaret::SetAppearance(Appearanc
 
 void
 AccessibleCaret::SetSelectionBarEnabled(bool aEnabled)
 {
   if (mSelectionBarEnabled == 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"),
                                       Optional<bool>(!aEnabled), rv);
   MOZ_ASSERT(!rv.Failed());
 
   mSelectionBarEnabled = aEnabled;
 }
--- a/layout/base/AccessibleCaretEventHub.cpp
+++ b/layout/base/AccessibleCaretEventHub.cpp
@@ -606,18 +606,27 @@ AccessibleCaretEventHub::HandleTouchEven
   return rv;
 }
 
 nsEventStatus
 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;
 
   default:
     break;
   }
 
   return nsEventStatus_eIgnore;
--- a/layout/base/AccessibleCaretManager.cpp
+++ b/layout/base/AccessibleCaretManager.cpp
@@ -170,45 +170,48 @@ AccessibleCaretManager::UpdateCaretsForC
       !mActiveCaret) {
     DispatchCaretStateChangedEvent(CaretChangedReason::Updateposition);
   }
 }
 
 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);
 
   int32_t endOffset = 0;
   nsIFrame* endFrame = FindFirstNodeWithFrame(true, &endOffset);
 
   if (!startFrame || !endFrame ||
       nsLayoutUtils::CompareTreePosition(startFrame, endFrame) > 0) {
     HideCarets();
     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;
   };
 
   PositionChangedResult firstCaretResult =
     updateSingleCaret(mFirstCaret.get(), startFrame, startOffset);
   PositionChangedResult secondCaretResult =
     updateSingleCaret(mSecondCaret.get(), endFrame, endOffset);