Title: [128199] trunk/Source/WebKit/chromium
Revision
128199
Author
[email protected]
Date
2012-09-11 09:59:08 -0700 (Tue, 11 Sep 2012)

Log Message

[chromium] Fix double call to scrollBegin() when handling scroll gesture
https://bugs.webkit.org/show_bug.cgi?id=95322

Patch by Iain Merrick <[email protected]> on 2012-09-11
Reviewed by James Robinson.

WebCompositorInputHandlerImpl::handleGestureFling() calls scrollBegin() on its
client, then if the result is ScrollStarted, it creates a PlatformGestureCurve
object to handle the fling animation. This patch adds a matching scrollEnd()
before the animation starts.

Now using strict mocks in WebCompositorInputHandlerImplTest, which turns all
unexpected calls into test failures. This ensures that scrollBegin / scrollEnd
happen exactly when we want and at no other times.

* src/WebCompositorInputHandlerImpl.cpp:
(WebKit::WebCompositorInputHandlerImpl::handleGestureFling):
* tests/WebCompositorInputHandlerImplTest.cpp:
(WebCompositorInputHandlerImplTest):
(WebKit::TEST_F):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (128198 => 128199)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-09-11 16:52:01 UTC (rev 128198)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-09-11 16:59:08 UTC (rev 128199)
@@ -1,3 +1,25 @@
+2012-09-11  Iain Merrick  <[email protected]>
+
+        [chromium] Fix double call to scrollBegin() when handling scroll gesture
+        https://bugs.webkit.org/show_bug.cgi?id=95322
+
+        Reviewed by James Robinson.
+
+        WebCompositorInputHandlerImpl::handleGestureFling() calls scrollBegin() on its
+        client, then if the result is ScrollStarted, it creates a PlatformGestureCurve
+        object to handle the fling animation. This patch adds a matching scrollEnd()
+        before the animation starts.
+
+        Now using strict mocks in WebCompositorInputHandlerImplTest, which turns all
+        unexpected calls into test failures. This ensures that scrollBegin / scrollEnd
+        happen exactly when we want and at no other times.
+
+        * src/WebCompositorInputHandlerImpl.cpp:
+        (WebKit::WebCompositorInputHandlerImpl::handleGestureFling):
+        * tests/WebCompositorInputHandlerImplTest.cpp:
+        (WebCompositorInputHandlerImplTest):
+        (WebKit::TEST_F):
+
 2012-09-11  Peter Beverloo  <[email protected]>
 
         Unreviewed.  Rolled DEPS.

Modified: trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp (128198 => 128199)


--- trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp	2012-09-11 16:52:01 UTC (rev 128198)
+++ trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp	2012-09-11 16:59:08 UTC (rev 128199)
@@ -205,6 +205,7 @@
     WebInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(WebPoint(gestureEvent.x, gestureEvent.y), WebInputHandlerClient::ScrollInputTypeGesture);
     switch (scrollStatus) {
     case WebInputHandlerClient::ScrollStatusStarted: {
+        m_inputHandlerClient->scrollEnd();
         m_wheelFlingCurve = PlatformGestureCurveFactory::get()->createCurve(gestureEvent.data.flingStart.sourceDevice, FloatPoint(gestureEvent.data.flingStart.velocityX, gestureEvent.data.flingStart.velocityY));
         TRACE_EVENT_ASYNC_BEGIN1("cc", "WebCompositorInputHandlerImpl::handleGestureFling::started", this, "curve", m_wheelFlingCurve->debugName());
         m_wheelFlingParameters.delta = WebFloatPoint(gestureEvent.data.flingStart.velocityX, gestureEvent.data.flingStart.velocityY);

Modified: trunk/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp (128198 => 128199)


--- trunk/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp	2012-09-11 16:52:01 UTC (rev 128198)
+++ trunk/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp	2012-09-11 16:59:08 UTC (rev 128199)
@@ -133,9 +133,9 @@
     } while (0)
 
 protected:
-    MockWebInputHandlerClient m_mockInputHandlerClient;
+    testing::StrictMock<MockWebInputHandlerClient> m_mockInputHandlerClient;
     OwnPtr<WebCompositorInputHandlerImpl> m_inputHandler;
-    MockWebCompositorInputHandlerClient m_mockClient;
+    testing::StrictMock<MockWebCompositorInputHandlerClient> m_mockClient;
     WebGestureEvent gesture;
     WebKitTests::WebCompositorInitializer m_initializer;
 
@@ -255,10 +255,11 @@
 
     EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_))
         .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusStarted));
+    EXPECT_CALL(m_mockInputHandlerClient, scrollEnd());
+    EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation());
 
     gesture.type = WebInputEvent::GestureFlingStart;
     gesture.data.flingStart.velocityX = 10;
-    EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation());
     m_inputHandler->handleInputEvent(gesture);
 
     VERIFY_AND_RESET_MOCKS();
@@ -328,6 +329,7 @@
     EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation());
     EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_))
         .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusStarted));
+    EXPECT_CALL(m_mockInputHandlerClient, scrollEnd());
     m_inputHandler->handleInputEvent(gesture);
 
     testing::Mock::VerifyAndClearExpectations(&m_mockInputHandlerClient);
@@ -412,6 +414,7 @@
     EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation());
     EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_))
         .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusStarted));
+    EXPECT_CALL(m_mockInputHandlerClient, scrollEnd());
     m_inputHandler->handleInputEvent(gesture);
 
     testing::Mock::VerifyAndClearExpectations(&m_mockInputHandlerClient);
@@ -491,6 +494,7 @@
     EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation());
     EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_))
         .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusStarted));
+    EXPECT_CALL(m_mockInputHandlerClient, scrollEnd());
     m_inputHandler->handleInputEvent(gesture);
 
     testing::Mock::VerifyAndClearExpectations(&m_mockInputHandlerClient);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to