Commit 37e90479 authored by tdanderson@chromium.org's avatar tdanderson@chromium.org
Browse files

[chromium] |m_gestureScrollOnImplThread| is not reset to false following the...

[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):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@144980 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 03b56a81
2013-03-06 Terry Anderson <tdanderson@chromium.org>
[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 <jamesr@chromium.org>
 
[chromium] Express webkit_unit_tests' dependency on DumpRenderTree.pak in gyp
......
......@@ -290,6 +290,7 @@ bool WebCompositorInputHandlerImpl::cancelCurrentFling()
TRACE_EVENT_INSTANT1("webkit", "WebCompositorInputHandlerImpl::cancelCurrentFling", "hadFlingAnimation", hadFlingAnimation);
m_flingCurve.clear();
m_gestureScrollOnImplThread = false;
m_flingParameters = WebActiveWheelFlingParameters();
return hadFlingAnimation;
}
......
......@@ -70,6 +70,9 @@ public:
int identifier() const { return m_identifier; }
// Included for testing purposes.
bool isGestureScrollOnImplThread() const { return m_gestureScrollOnImplThread; }
private:
enum EventDisposition { DidHandle, DidNotHandle, DropEvent };
......
......@@ -750,6 +750,77 @@ TEST_F(WebCompositorInputHandlerImplTest, gestureFlingAnimatesTouchscreen)
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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment