diff options
author | mkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-17 23:15:11 +0000 |
---|---|---|
committer | mkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-17 23:15:11 +0000 |
commit | bfb6e2415fc87961baff2557d59ae81f5f5fd035 (patch) | |
tree | 2d91b55696a6a8e229ec111fa71bd5c0e905d8fa /content/renderer | |
parent | 5df96abc073fbdcf391dca744947620a9a819922 (diff) | |
download | chromium_src-bfb6e2415fc87961baff2557d59ae81f5f5fd035.zip chromium_src-bfb6e2415fc87961baff2557d59ae81f5f5fd035.tar.gz chromium_src-bfb6e2415fc87961baff2557d59ae81f5f5fd035.tar.bz2 |
Add the current delta to InputHandlerClient::DidOverscroll.
This change adds the value of the latest overscroll delta to the
callback. This is to enable the android_webview overscroll implementation.
BUG=b/6946454
TEST=AndroidWebViewTests
Review URL: https://chromiumcodereview.appspot.com/19246002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@212161 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r-- | content/renderer/gpu/input_event_filter.cc | 8 | ||||
-rw-r--r-- | content/renderer/gpu/input_event_filter.h | 3 | ||||
-rw-r--r-- | content/renderer/gpu/input_handler_manager.cc | 7 | ||||
-rw-r--r-- | content/renderer/gpu/input_handler_manager.h | 5 | ||||
-rw-r--r-- | content/renderer/gpu/input_handler_manager_client.h | 4 | ||||
-rw-r--r-- | content/renderer/gpu/input_handler_proxy.cc | 11 | ||||
-rw-r--r-- | content/renderer/gpu/input_handler_proxy.h | 3 | ||||
-rw-r--r-- | content/renderer/gpu/input_handler_proxy_client.h | 3 | ||||
-rw-r--r-- | content/renderer/gpu/input_handler_proxy_unittest.cc | 10 | ||||
-rw-r--r-- | content/renderer/gpu/input_handler_wrapper.cc | 7 | ||||
-rw-r--r-- | content/renderer/gpu/input_handler_wrapper.h | 3 |
11 files changed, 27 insertions, 37 deletions
diff --git a/content/renderer/gpu/input_event_filter.cc b/content/renderer/gpu/input_event_filter.cc index 0db5814..f9b9015 100644 --- a/content/renderer/gpu/input_event_filter.cc +++ b/content/renderer/gpu/input_event_filter.cc @@ -7,6 +7,7 @@ #include "base/debug/trace_event.h" #include "base/location.h" #include "base/message_loop/message_loop_proxy.h" +#include "cc/input/input_handler.h" #include "content/common/input_messages.h" #include "content/common/view_messages.h" #include "content/public/common/content_switches.h" @@ -48,8 +49,7 @@ void InputEventFilter::DidRemoveInputHandler(int routing_id) { } void InputEventFilter::DidOverscroll(int routing_id, - gfx::Vector2dF accumulated_overscroll, - gfx::Vector2dF current_fling_velocity) { + const cc::DidOverscrollParams& params) { DCHECK(target_loop_->BelongsToCurrentThread()); if (!overscroll_notifications_enabled_) @@ -59,8 +59,8 @@ void InputEventFilter::DidOverscroll(int routing_id, FROM_HERE, base::Bind(&InputEventFilter::SendMessageOnIOThread, this, ViewHostMsg_DidOverscroll(routing_id, - accumulated_overscroll, - current_fling_velocity))); + params.accumulated_overscroll, + params.current_fling_velocity))); } void InputEventFilter::OnFilterAdded(IPC::Channel* channel) { diff --git a/content/renderer/gpu/input_event_filter.h b/content/renderer/gpu/input_event_filter.h index 1f44e09..4a5d410 100644 --- a/content/renderer/gpu/input_event_filter.h +++ b/content/renderer/gpu/input_event_filter.h @@ -48,8 +48,7 @@ class CONTENT_EXPORT InputEventFilter cc::InputHandler* input_handler) OVERRIDE; virtual void DidRemoveInputHandler(int routing_id) OVERRIDE; virtual void DidOverscroll(int routing_id, - gfx::Vector2dF accumulated_overscroll, - gfx::Vector2dF current_fling_velocity) OVERRIDE; + const cc::DidOverscrollParams& params) OVERRIDE; // IPC::ChannelProxy::MessageFilter methods: virtual void OnFilterAdded(IPC::Channel* channel) OVERRIDE; diff --git a/content/renderer/gpu/input_handler_manager.cc b/content/renderer/gpu/input_handler_manager.cc index 2fb6360..1db011b 100644 --- a/content/renderer/gpu/input_handler_manager.cc +++ b/content/renderer/gpu/input_handler_manager.cc @@ -122,11 +122,8 @@ InputEventAckState InputHandlerManager::HandleInputEvent( } void InputHandlerManager::DidOverscroll(int routing_id, - gfx::Vector2dF accumulated_overscroll, - gfx::Vector2dF current_fling_velocity) { - client_->DidOverscroll(routing_id, - accumulated_overscroll, - current_fling_velocity); + const cc::DidOverscrollParams& params) { + client_->DidOverscroll(routing_id, params); } diff --git a/content/renderer/gpu/input_handler_manager.h b/content/renderer/gpu/input_handler_manager.h index cc41473..3811d63 100644 --- a/content/renderer/gpu/input_handler_manager.h +++ b/content/renderer/gpu/input_handler_manager.h @@ -18,6 +18,7 @@ class MessageLoopProxy; namespace cc { class InputHandler; +struct DidOverscrollParams; } namespace WebKit { @@ -55,9 +56,7 @@ class InputHandlerManager { const ui::LatencyInfo& latency_info); // Called from the compositor's thread. - void DidOverscroll(int routing_id, - gfx::Vector2dF accumulated_overscroll, - gfx::Vector2dF current_fling_velocity); + void DidOverscroll(int routing_id, const cc::DidOverscrollParams& params); private: // Called from the compositor's thread. diff --git a/content/renderer/gpu/input_handler_manager_client.h b/content/renderer/gpu/input_handler_manager_client.h index 418e779..c147a8a6 100644 --- a/content/renderer/gpu/input_handler_manager_client.h +++ b/content/renderer/gpu/input_handler_manager_client.h @@ -17,6 +17,7 @@ struct LatencyInfo; namespace cc { class InputHandler; +struct DidOverscrollParams; } namespace WebKit { @@ -45,8 +46,7 @@ class CONTENT_EXPORT InputHandlerManagerClient { cc::InputHandler* input_handler) = 0; virtual void DidRemoveInputHandler(int routing_id) = 0; virtual void DidOverscroll(int routing_id, - gfx::Vector2dF accumulated_overscroll, - gfx::Vector2dF current_fling_velocity) = 0; + const cc::DidOverscrollParams& params) = 0; protected: InputHandlerManagerClient() {} diff --git a/content/renderer/gpu/input_handler_proxy.cc b/content/renderer/gpu/input_handler_proxy.cc index a24cfbe..74cc6d1 100644 --- a/content/renderer/gpu/input_handler_proxy.cc +++ b/content/renderer/gpu/input_handler_proxy.cc @@ -322,18 +322,19 @@ void InputHandlerProxy::MainThreadHasStoppedFlinging() { fling_may_be_active_on_main_thread_ = false; } -void InputHandlerProxy::DidOverscroll(gfx::Vector2dF accumulated_overscroll, - gfx::Vector2dF current_fling_velocity) { +void InputHandlerProxy::DidOverscroll(const cc::DidOverscrollParams& params) { DCHECK(client_); if (fling_curve_) { static const int kFlingOverscrollThreshold = 1; fling_overscrolled_horizontally_ |= - std::abs(accumulated_overscroll.x()) >= kFlingOverscrollThreshold; + std::abs(params.accumulated_overscroll.x()) >= + kFlingOverscrollThreshold; fling_overscrolled_vertically_ |= - std::abs(accumulated_overscroll.y()) >= kFlingOverscrollThreshold; + std::abs(params.accumulated_overscroll.y()) >= + kFlingOverscrollThreshold; } - client_->DidOverscroll(accumulated_overscroll, current_fling_velocity); + client_->DidOverscroll(params); } bool InputHandlerProxy::CancelCurrentFling() { diff --git a/content/renderer/gpu/input_handler_proxy.h b/content/renderer/gpu/input_handler_proxy.h index 5a73cf5..e307827 100644 --- a/content/renderer/gpu/input_handler_proxy.h +++ b/content/renderer/gpu/input_handler_proxy.h @@ -46,8 +46,7 @@ class CONTENT_EXPORT InputHandlerProxy virtual void WillShutdown() OVERRIDE; virtual void Animate(base::TimeTicks time) OVERRIDE; virtual void MainThreadHasStoppedFlinging() OVERRIDE; - virtual void DidOverscroll(gfx::Vector2dF accumulated_overscroll, - gfx::Vector2dF current_fling_velocity) OVERRIDE; + virtual void DidOverscroll(const cc::DidOverscrollParams& params) OVERRIDE; // WebKit::WebGestureCurveTarget implementation. virtual void scrollBy(const WebKit::WebFloatSize& offset); diff --git a/content/renderer/gpu/input_handler_proxy_client.h b/content/renderer/gpu/input_handler_proxy_client.h index beebb179..6ef000c 100644 --- a/content/renderer/gpu/input_handler_proxy_client.h +++ b/content/renderer/gpu/input_handler_proxy_client.h @@ -32,8 +32,7 @@ class InputHandlerProxyClient { const WebKit::WebFloatPoint& velocity, const WebKit::WebSize& cumulative_scroll) = 0; - virtual void DidOverscroll(gfx::Vector2dF accumulated_overscroll, - gfx::Vector2dF current_fling_velocity) = 0; + virtual void DidOverscroll(const cc::DidOverscrollParams& params) = 0; protected: virtual ~InputHandlerProxyClient() {} diff --git a/content/renderer/gpu/input_handler_proxy_unittest.cc b/content/renderer/gpu/input_handler_proxy_unittest.cc index 9485949..ca3e2cf 100644 --- a/content/renderer/gpu/input_handler_proxy_unittest.cc +++ b/content/renderer/gpu/input_handler_proxy_unittest.cc @@ -125,8 +125,7 @@ class MockInputHandlerProxyClient return new FakeWebGestureCurve(velocity, cumulative_scroll); } - virtual void DidOverscroll(gfx::Vector2dF overscroll, - gfx::Vector2dF fling_velocity) {} + virtual void DidOverscroll(const cc::DidOverscrollParams& params) {} private: DISALLOW_COPY_AND_ASSIGN(MockInputHandlerProxyClient); @@ -991,9 +990,10 @@ TEST_F(InputHandlerProxyTest, GestureFlingStopsAtContentEdge) { testing::Mock::VerifyAndClearExpectations(&mock_input_handler_); // Simulate hitting the bottom content edge. - gfx::Vector2dF overscroll_amount(0, 100); - gfx::Vector2dF overscroll_velocity(0, 10); - input_handler_->DidOverscroll(overscroll_amount, overscroll_velocity); + cc::DidOverscrollParams overscroll_params; + overscroll_params.accumulated_overscroll = gfx::Vector2dF(0, 100); + overscroll_params.current_fling_velocity = gfx::Vector2dF(0, 10); + input_handler_->DidOverscroll(overscroll_params); // The next call to animate will no longer scroll vertically. EXPECT_CALL(mock_input_handler_, ScheduleAnimation()); diff --git a/content/renderer/gpu/input_handler_wrapper.cc b/content/renderer/gpu/input_handler_wrapper.cc index dbdfddd..348ff6d 100644 --- a/content/renderer/gpu/input_handler_wrapper.cc +++ b/content/renderer/gpu/input_handler_wrapper.cc @@ -50,11 +50,8 @@ WebKit::WebGestureCurve* InputHandlerWrapper::CreateFlingAnimationCurve( deviceSource, velocity, cumulative_scroll); } -void InputHandlerWrapper::DidOverscroll(gfx::Vector2dF accumulated_overscroll, - gfx::Vector2dF current_fling_velocity) { - input_handler_manager_->DidOverscroll(routing_id_, - accumulated_overscroll, - current_fling_velocity); +void InputHandlerWrapper::DidOverscroll(const cc::DidOverscrollParams& params) { + input_handler_manager_->DidOverscroll(routing_id_, params); } } // namespace content diff --git a/content/renderer/gpu/input_handler_wrapper.h b/content/renderer/gpu/input_handler_wrapper.h index 35edd0a..f72bae5 100644 --- a/content/renderer/gpu/input_handler_wrapper.h +++ b/content/renderer/gpu/input_handler_wrapper.h @@ -35,8 +35,7 @@ class InputHandlerWrapper int deviceSource, const WebKit::WebFloatPoint& velocity, const WebKit::WebSize& cumulativeScroll) OVERRIDE; - virtual void DidOverscroll(gfx::Vector2dF accumulated_overscroll, - gfx::Vector2dF current_fling_velocity) OVERRIDE; + virtual void DidOverscroll(const cc::DidOverscrollParams& params) OVERRIDE; private: friend class base::RefCountedThreadSafe<InputHandlerWrapper>; |