Bug 1200194 - Remove unneeded AccessibleCaretManager::OnScrolling(). r=roc draft
authorTing-Yu Lin <tlin@mozilla.com>
Tue, 08 Sep 2015 17:04:26 +0800
changeset 290883 97b98bf244e17e1d781951e69e016b02bb548def
parent 290882 1af64c81b8ecd5b34daa48d923bf1a9a3da0b129
child 509081 6d257f5ff14129db55a0a19565eb87f90eb27724
push id5185
push usertlin@mozilla.com
push dateTue, 08 Sep 2015 09:19:58 +0000
reviewersroc
bugs1200194
milestone43.0a1
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
@@ -220,20 +220,16 @@ class CommonCaretTestCase(object):
     def test_input_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._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):
@@ -254,20 +250,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):
@@ -288,20 +280,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):
@@ -311,15 +299,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'