Changeset 128199 in webkit


Ignore:
Timestamp:
Sep 11, 2012 9:59:08 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Iain Merrick <husky@chromium.org> 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):

Location:
trunk/Source/WebKit/chromium
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/chromium/ChangeLog

    r128168 r128199  
     12012-09-11  Iain Merrick  <husky@chromium.org>
     2
     3        [chromium] Fix double call to scrollBegin() when handling scroll gesture
     4        https://bugs.webkit.org/show_bug.cgi?id=95322
     5
     6        Reviewed by James Robinson.
     7
     8        WebCompositorInputHandlerImpl::handleGestureFling() calls scrollBegin() on its
     9        client, then if the result is ScrollStarted, it creates a PlatformGestureCurve
     10        object to handle the fling animation. This patch adds a matching scrollEnd()
     11        before the animation starts.
     12
     13        Now using strict mocks in WebCompositorInputHandlerImplTest, which turns all
     14        unexpected calls into test failures. This ensures that scrollBegin / scrollEnd
     15        happen exactly when we want and at no other times.
     16
     17        * src/WebCompositorInputHandlerImpl.cpp:
     18        (WebKit::WebCompositorInputHandlerImpl::handleGestureFling):
     19        * tests/WebCompositorInputHandlerImplTest.cpp:
     20        (WebCompositorInputHandlerImplTest):
     21        (WebKit::TEST_F):
     22
    1232012-09-11  Peter Beverloo  <peter@chromium.org>
    224
  • trunk/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp

    r127948 r128199  
    206206    switch (scrollStatus) {
    207207    case WebInputHandlerClient::ScrollStatusStarted: {
     208        m_inputHandlerClient->scrollEnd();
    208209        m_wheelFlingCurve = PlatformGestureCurveFactory::get()->createCurve(gestureEvent.data.flingStart.sourceDevice, FloatPoint(gestureEvent.data.flingStart.velocityX, gestureEvent.data.flingStart.velocityY));
    209210        TRACE_EVENT_ASYNC_BEGIN1("cc", "WebCompositorInputHandlerImpl::handleGestureFling::started", this, "curve", m_wheelFlingCurve->debugName());
  • trunk/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp

    r127960 r128199  
    134134
    135135protected:
    136     MockWebInputHandlerClient m_mockInputHandlerClient;
     136    testing::StrictMock<MockWebInputHandlerClient> m_mockInputHandlerClient;
    137137    OwnPtr<WebCompositorInputHandlerImpl> m_inputHandler;
    138     MockWebCompositorInputHandlerClient m_mockClient;
     138    testing::StrictMock<MockWebCompositorInputHandlerClient> m_mockClient;
    139139    WebGestureEvent gesture;
    140140    WebKitTests::WebCompositorInitializer m_initializer;
     
    256256    EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_))
    257257        .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusStarted));
     258    EXPECT_CALL(m_mockInputHandlerClient, scrollEnd());
     259    EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation());
    258260
    259261    gesture.type = WebInputEvent::GestureFlingStart;
    260262    gesture.data.flingStart.velocityX = 10;
    261     EXPECT_CALL(m_mockInputHandlerClient, scheduleAnimation());
    262263    m_inputHandler->handleInputEvent(gesture);
    263264
     
    329330    EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_))
    330331        .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusStarted));
     332    EXPECT_CALL(m_mockInputHandlerClient, scrollEnd());
    331333    m_inputHandler->handleInputEvent(gesture);
    332334
     
    413415    EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_))
    414416        .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusStarted));
     417    EXPECT_CALL(m_mockInputHandlerClient, scrollEnd());
    415418    m_inputHandler->handleInputEvent(gesture);
    416419
     
    492495    EXPECT_CALL(m_mockInputHandlerClient, scrollBegin(testing::_, testing::_))
    493496        .WillOnce(testing::Return(WebInputHandlerClient::ScrollStatusStarted));
     497    EXPECT_CALL(m_mockInputHandlerClient, scrollEnd());
    494498    m_inputHandler->handleInputEvent(gesture);
    495499
Note: See TracChangeset for help on using the changeset viewer.