Title: [144980] trunk/Source/WebKit/chromium
Revision
144980
Author
[email protected]
Date
2013-03-06 14:24:24 -0800 (Wed, 06 Mar 2013)

Log Message

[chromium] |m_gestureScrollOnImplThread| is not reset to false following the end of a fling on the fast path
https://bugs.webkit.org/show_bug.cgi?id=111390

Reviewed by James Robinson.

If there is a fast path gesture scroll which turns into a fling, the member
|m_gestureScrollOnImplThread| is not reset to false once the fling ends. As a
result, GestureScrollUpdate events belonging to a subsequent scroll are always
handled on the fast path, even if they should have been handled on the slow
path instead.

* src/WebCompositorInputHandlerImpl.cpp:
(WebKit::WebCompositorInputHandlerImpl::cancelCurrentFling):
* src/WebCompositorInputHandlerImpl.h:
(WebCompositorInputHandlerImpl):
(WebKit::WebCompositorInputHandlerImpl::isGestureScrollOnImplThread):
* tests/WebCompositorInputHandlerImplTest.cpp:
(WebKit::TEST_F):
(WebKit):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (144979 => 144980)


--- trunk/Source/WebKit/chromium/ChangeLog	2013-03-06 22:22:16 UTC (rev 144979)
+++ trunk/Source/WebKit/chromium/ChangeLog	2013-03-06 22:24:24 UTC (rev 144980)
@@ -1,3 +1,25 @@
+2013-03-06  Terry Anderson  <[email protected]>
+
+        [chromium] |m_gestureScrollOnImplThread| is not reset to false following the end of a fling on the fast path
+        https://bugs.webkit.org/show_bug.cgi?id=111390
+
+        Reviewed by James Robinson.
+
+        If there is a fast path gesture scroll which turns into a fling, the member
+        |m_gestureScrollOnImplThread| is not reset to false once the fling ends. As a
+        result, GestureScrollUpdate events belonging to a subsequent scroll are always
+        handled on the fast path, even if they should have been handled on the slow
+        path instead.
+
+        * src/WebCompositorInputHandlerImpl.cpp:
+        (WebKit::WebCompositorInputHandlerImpl::cancelCurrentFling):
+        * src/WebCompositorInputHandlerImpl.h:
+        (WebCompositorInputHandlerImpl):
+        (WebKit::WebCompositorInputHandlerImpl::isGestureScrollOnImplThread):
+        * tests/WebCompositorInputHandlerImplTest.cpp:
+        (WebKit::TEST_F):
+        (WebKit):
+
 2013-03-06  James Robinson  <[email protected]>
 
         [chromium] Express webkit_unit_tests' dependency on DumpRenderTree.pak in gyp

Modified: trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp (144979 => 144980)


--- trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp	2013-03-06 22:22:16 UTC (rev 144979)
+++ trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp	2013-03-06 22:24:24 UTC (rev 144980)
@@ -290,6 +290,7 @@
 
     TRACE_EVENT_INSTANT1("webkit", "WebCompositorInputHandlerImpl::cancelCurrentFling", "hadFlingAnimation", hadFlingAnimation);
     m_flingCurve.clear();
+    m_gestureScrollOnImplThread = false;
     m_flingParameters = WebActiveWheelFlingParameters();
     return hadFlingAnimation;
 }

Modified: trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h (144979 => 144980)


--- trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h	2013-03-06 22:22:16 UTC (rev 144979)
+++ trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h	2013-03-06 22:24:24 UTC (rev 144980)
@@ -70,6 +70,9 @@
 
     int identifier() const { return m_identifier; }
 
+    // Included for testing purposes. 
+    bool isGestureScrollOnImplThread() const { return m_gestureScrollOnImplThread; }
+
 private:
 
     enum EventDisposition { DidHandle, DidNotHandle, DropEvent };

Modified: trunk/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp (144979 => 144980)


--- trunk/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp	2013-03-06 22:22:16 UTC (rev 144979)
+++ trunk/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp	2013-03-06 22:24:24 UTC (rev 144980)
@@ -750,6 +750,77 @@
     m_inputHandler->handleInputEvent(gesture);
 }
 
+TEST_F(WebCompositorInputHandlerImplTest, gestureScrollOnImplThreadFlagClearedAfterFling)
+{
+    // We shouldn't send any events to the widget for this gesture.
+    m_expectedDisposition = DidHandle;
+    VERIFY_AND_RESET_MOCKS();
+
+    EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_))
+        .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusStarted));
+
+    gesture.type = WebInputEvent::GestureScrollBegin;
+    m_inputHandler->handleInputEvent(gesture);
+
+    // After sending a GestureScrollBegin, the member variable
+    // |m_gestureScrollOnImplThread| should be true.
+    ASSERT(m_inputHandler->isGestureScrollOnImplThread());
+
+    m_expectedDisposition = DidHandle;
+    VERIFY_AND_RESET_MOCKS();
+
+    // On the fling start, we should schedule an animation but not actually start
+    // scrolling.
+    gesture.type = WebInputEvent::GestureFlingStart;
+    WebFloatPoint flingDelta = WebFloatPoint(1000, 0);
+    WebPoint flingPoint = WebPoint(7, 13);
+    WebPoint flingGlobalPoint = WebPoint(17, 23);
+    int modifiers = 7;
+    gesture.data.flingStart.velocityX = flingDelta.x;
+    gesture.data.flingStart.velocityY = flingDelta.y;
+    gesture.sourceDevice = WebGestureEvent::Touchscreen;
+    gesture.x = flingPoint.x;
+    gesture.y = flingPoint.y;
+    gesture.globalX = flingGlobalPoint.x;
+    gesture.globalY = flingGlobalPoint.y;
+    gesture.modifiers = modifiers;
+    EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation());
+    EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_))
+        .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusStarted));
+    m_inputHandler->handleInputEvent(gesture);
+
+    // |m_gestureScrollOnImplThread| should still be true after
+    // a GestureFlingStart is sent.
+    ASSERT(m_inputHandler->isGestureScrollOnImplThread());
+
+    testing::Mock::VerifyAndClearExpectations(&m_mockInputHandlerClient);
+    // The first animate call should let us pick up an animation start time, but we
+    // shouldn't actually move anywhere just yet. The first frame after the fling start
+    // will typically include the last scroll from the gesture that lead to the scroll
+    // (either wheel or gesture scroll), so there should be no visible hitch.
+    EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation());
+    m_inputHandler->animate(10);
+
+    testing::Mock::VerifyAndClearExpectations(&m_mockInputHandlerClient);
+
+    // The second call should start scrolling in the -X direction.
+    EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation());
+    EXPECT_CALL(m_mockInputHandlerClient, scrollByIfPossible(testing::_, testing::Field(&WebFloatSize::width, testing::Lt(0))))
+        .WillOnce(testing::Return(true));
+    m_inputHandler->animate(10.1);
+
+    testing::Mock::VerifyAndClearExpectations(&m_mockInputHandlerClient);
+
+    EXPECT_CALL(m_mockClient, didHandleInputEvent());
+    EXPECT_CALL(m_mockInputHandlerClient, scrollEnd());
+    gesture.type = WebInputEvent::GestureFlingCancel;
+    m_inputHandler->handleInputEvent(gesture);
+
+    // |m_gestureScrollOnImplThread| should be false once
+    // the fling has finished (note no GestureScrollEnd has been sent).
+    ASSERT(!m_inputHandler->isGestureScrollOnImplThread());
+}
+
 TEST_F(WebCompositorInputHandlerImplTest, lastInputEventForVSync)
 {
     m_expectedDisposition = DropEvent;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to