Bug 1200194 - Remove unneeded AccessibleCaretManager::OnScrolling(). r=roc
authorTing-Yu Lin <tlin@mozilla.com>
Wed, 09 Sep 2015 16:47:21 +0800
changeset 294345 8b63529bd739e7d629426fbb337408d76f9c4988
parent 294344 8d4c356a8c160510b55660b01b38535cc4171169
child 294346 b046fd76907f9cb10a12b962665038d80739481a
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 - Remove unneeded AccessibleCaretManager::OnScrolling(). r=roc This functions is for hiding caret in cursor mode on desktop browser when receiving NS_WHEEL_WHEEL, which is never used on B2G in production. On desktop browser, a proper wheel scroll cycle begins by NS_WHEEL_START and ends by NS_WHEEL_STOP, which was covered by gtest. Move the three marionette test for TouchCaret only.
layout/base/AccessibleCaretEventHub.cpp
layout/base/AccessibleCaretManager.cpp
layout/base/AccessibleCaretManager.h
layout/base/gtest/TestAccessibleCaretEventHub.cpp
layout/base/tests/marionette/test_touchcaret.py
--- a/layout/base/AccessibleCaretEventHub.cpp
+++ b/layout/base/AccessibleCaretEventHub.cpp
@@ -61,21 +61,16 @@ public:
   }
 
   virtual void OnScrollStart(AccessibleCaretEventHub* aContext) override
   {
     aContext->mManager->OnScrollStart();
     aContext->SetState(aContext->ScrollState());
   }
 
-  virtual void OnScrolling(AccessibleCaretEventHub* aContext) override
-  {
-    aContext->mManager->OnScrolling();
-  }
-
   virtual void OnScrollPositionChanged(AccessibleCaretEventHub* aContext) override
   {
     aContext->mManager->OnScrollPositionChanged();
   }
 
   virtual void OnSelectionChanged(AccessibleCaretEventHub* aContext,
                                   nsIDOMDocument* aDoc, nsISelection* aSel,
                                   int16_t aReason) override
--- a/layout/base/AccessibleCaretManager.cpp
+++ b/layout/base/AccessibleCaretManager.cpp
@@ -411,32 +411,16 @@ AccessibleCaretManager::OnScrollEnd()
     HideCarets();
   } else {
     AC_LOG("%s: UpdateCarets()", __FUNCTION__);
     UpdateCarets();
   }
 }
 
 void
-AccessibleCaretManager::OnScrolling()
-{
-  if (mCaretMode != GetCaretMode()) {
-    return;
-  }
-
-  if (GetCaretMode() == CaretMode::Cursor) {
-    AC_LOG("%s: HideCarets()", __FUNCTION__);
-    HideCarets();
-  } else {
-    AC_LOG("%s: UpdateCarets()", __FUNCTION__);
-    UpdateCarets();
-  }
-}
-
-void
 AccessibleCaretManager::OnScrollPositionChanged()
 {
   if (mCaretMode != GetCaretMode()) {
     return;
   }
 
   AC_LOG("%s: UpdateCarets(RespectOldAppearance)", __FUNCTION__);
   UpdateCarets(UpdateCaretsHint::RespectOldAppearance);
--- a/layout/base/AccessibleCaretManager.h
+++ b/layout/base/AccessibleCaretManager.h
@@ -70,19 +70,16 @@ public:
   virtual nsresult SelectWordOrShortcut(const nsPoint& aPoint);
 
   // Handle scroll-start event.
   virtual void OnScrollStart();
 
   // Handle scroll-end event.
   virtual void OnScrollEnd();
 
-  // Handle NS_WHEEL_WHEEL event.
-  virtual void OnScrolling();
-
   // Handle ScrollPositionChanged from nsIScrollObserver. This might be called
   // at anytime, not necessary between OnScrollStart and OnScrollEnd.
   virtual void OnScrollPositionChanged();
 
   // Handle reflow event from nsIReflowObserver.
   virtual void OnReflow();
 
   // Handle blur event from nsFocusManager.
--- a/layout/base/gtest/TestAccessibleCaretEventHub.cpp
+++ b/layout/base/gtest/TestAccessibleCaretEventHub.cpp
@@ -42,17 +42,16 @@ public:
 
   MOCK_METHOD1(PressCaret, nsresult(const nsPoint& aPoint));
   MOCK_METHOD1(DragCaret, nsresult(const nsPoint& aPoint));
   MOCK_METHOD0(ReleaseCaret, nsresult());
   MOCK_METHOD1(TapCaret, nsresult(const nsPoint& aPoint));
   MOCK_METHOD1(SelectWordOrShortcut, nsresult(const nsPoint& aPoint));
   MOCK_METHOD0(OnScrollStart, void());
   MOCK_METHOD0(OnScrollEnd, void());
-  MOCK_METHOD0(OnScrolling, void());
   MOCK_METHOD0(OnScrollPositionChanged, void());
   MOCK_METHOD0(OnBlur, void());
 };
 
 class MockAccessibleCaretEventHub : public AccessibleCaretEventHub
 {
 public:
   using AccessibleCaretEventHub::NoActionState;
@@ -630,17 +629,16 @@ TEST_F(AccessibleCaretEventHubTester, Te
 {
   MockFunction<void(::std::string aCheckPointName)> check;
   {
     InSequence dummy;
 
     EXPECT_CALL(check, Call("1"));
     EXPECT_CALL(*mHub->GetMockAccessibleCaretManager(), OnScrollStart());
 
-    EXPECT_CALL(*mHub->GetMockAccessibleCaretManager(), OnScrolling()).Times(0);
     EXPECT_CALL(*mHub->GetMockAccessibleCaretManager(),
                 OnScrollPositionChanged()).Times(0);
 
     EXPECT_CALL(check, Call("2"));
     EXPECT_CALL(*mHub->GetMockAccessibleCaretManager(), OnScrollEnd());
   }
 
   mHub->SetUseAsyncPanZoom(true);
--- a/layout/base/tests/marionette/test_touchcaret.py
+++ b/layout/base/tests/marionette/test_touchcaret.py
@@ -250,20 +250,16 @@ class CommonCaretTestCase(object):
     def test_input_caret_not_appear_when_typing_in_scrollable_content(self):
         self.open_test_html()
         self._test_caret_not_appear_when_typing_in_scrollable_content(self._input, self.assertEqual)
 
     def test_input_touch_caret_timeout(self):
         self.open_test_html(timeout_ms=1000)
         self._test_touch_caret_timeout_by_dragging_it_to_top_left_corner_after_timout(self._input, self.assertNotEqual)
 
-    def test_input_touch_caret_hides_after_receiving_wheel_event(self):
-        self.open_test_html()
-        self._test_touch_caret_hides_after_receiving_wheel_event(self._input, self.assertNotEqual)
-
     ########################################################################
     # <input> test cases with touch caret disabled
     ########################################################################
     def test_input_move_caret_to_the_right_by_one_character_disabled(self):
         self.open_test_html(enabled=False)
         self._test_move_caret_to_the_right_by_one_character(self._input, self.assertNotEqual)
 
     def test_input_move_caret_to_front_by_dragging_touch_caret_to_top_left_corner_disabled(self):
@@ -284,20 +280,16 @@ class CommonCaretTestCase(object):
     def test_textarea_move_caret_to_front_by_dragging_touch_caret_to_top_left_corner(self):
         self.open_test_html()
         self._test_move_caret_to_front_by_dragging_touch_caret_to_front_of_content(self._textarea, self.assertEqual)
 
     def test_textarea_touch_caret_timeout(self):
         self.open_test_html(timeout_ms=1000)
         self._test_touch_caret_timeout_by_dragging_it_to_top_left_corner_after_timout(self._textarea, self.assertNotEqual)
 
-    def test_textarea_touch_caret_hides_after_receiving_wheel_event(self):
-        self.open_test_html()
-        self._test_touch_caret_hides_after_receiving_wheel_event(self._textarea, self.assertNotEqual)
-
     ########################################################################
     # <textarea> test cases with touch caret disabled
     ########################################################################
     def test_textarea_move_caret_to_the_right_by_one_character_disabled(self):
         self.open_test_html(enabled=False)
         self._test_move_caret_to_the_right_by_one_character(self._textarea, self.assertNotEqual)
 
     def test_textarea_move_caret_to_front_by_dragging_touch_caret_to_top_left_corner_disabled(self):
@@ -318,20 +310,16 @@ class CommonCaretTestCase(object):
     def test_contenteditable_move_caret_to_front_by_dragging_touch_caret_to_top_left_corner(self):
         self.open_test_html()
         self._test_move_caret_to_front_by_dragging_touch_caret_to_front_of_content(self._contenteditable, self.assertEqual)
 
     def test_contenteditable_touch_caret_timeout(self):
         self.open_test_html(timeout_ms=1000)
         self._test_touch_caret_timeout_by_dragging_it_to_top_left_corner_after_timout(self._contenteditable, self.assertNotEqual)
 
-    def test_contenteditable_touch_caret_hides_after_receiving_wheel_event(self):
-        self.open_test_html()
-        self._test_touch_caret_hides_after_receiving_wheel_event(self._contenteditable, self.assertNotEqual)
-
     ########################################################################
     # <div> contenteditable test cases with touch caret disabled
     ########################################################################
     def test_contenteditable_move_caret_to_the_right_by_one_character_disabled(self):
         self.open_test_html(enabled=False)
         self._test_move_caret_to_the_right_by_one_character(self._contenteditable, self.assertNotEqual)
 
     def test_contenteditable_move_caret_to_front_by_dragging_touch_caret_to_top_left_corner_disabled(self):
@@ -341,15 +329,27 @@ class CommonCaretTestCase(object):
 
 class TouchCaretTestCase(CommonCaretTestCase, MarionetteTestCase):
     def setUp(self):
         super(TouchCaretTestCase, self).setUp()
         self.caret_tested_pref = 'touchcaret.enabled'
         self.caret_disabled_pref = 'layout.accessiblecaret.enabled'
         self.caret_timeout_ms_pref = 'touchcaret.expiration.time'
 
+    def test_input_touch_caret_hides_after_receiving_wheel_event(self):
+        self.open_test_html()
+        self._test_touch_caret_hides_after_receiving_wheel_event(self._input, self.assertNotEqual)
+
+    def test_textarea_touch_caret_hides_after_receiving_wheel_event(self):
+        self.open_test_html()
+        self._test_touch_caret_hides_after_receiving_wheel_event(self._textarea, self.assertNotEqual)
+
+    def test_contenteditable_touch_caret_hides_after_receiving_wheel_event(self):
+        self.open_test_html()
+        self._test_touch_caret_hides_after_receiving_wheel_event(self._contenteditable, self.assertNotEqual)
+
 
 class AccessibleCaretCursorModeTestCase(CommonCaretTestCase, MarionetteTestCase):
     def setUp(self):
         super(AccessibleCaretCursorModeTestCase, self).setUp()
         self.caret_tested_pref = 'layout.accessiblecaret.enabled'
         self.caret_disabled_pref = 'touchcaret.enabled'
         self.caret_timeout_ms_pref = 'layout.accessiblecaret.timeout_ms'