diff options
Diffstat (limited to 'content')
16 files changed, 37 insertions, 49 deletions
diff --git a/content/browser/android/in_process/synchronous_compositor_impl.cc b/content/browser/android/in_process/synchronous_compositor_impl.cc index 97b785ad..f3c1b63 100644 --- a/content/browser/android/in_process/synchronous_compositor_impl.cc +++ b/content/browser/android/in_process/synchronous_compositor_impl.cc @@ -214,11 +214,10 @@ void SynchronousCompositorImpl::SetInputHandler( } void SynchronousCompositorImpl::DidOverscroll( - gfx::Vector2dF accumulated_overscroll, - gfx::Vector2dF current_fling_velocity) { + const cc::DidOverscrollParams& params) { if (compositor_client_) { - compositor_client_->DidOverscroll(accumulated_overscroll, - current_fling_velocity); + compositor_client_->DidOverscroll(params.latest_overscroll_delta, + params.current_fling_velocity); } } diff --git a/content/browser/android/in_process/synchronous_compositor_impl.h b/content/browser/android/in_process/synchronous_compositor_impl.h index 1e2c66e..cd34617 100644 --- a/content/browser/android/in_process/synchronous_compositor_impl.h +++ b/content/browser/android/in_process/synchronous_compositor_impl.h @@ -16,6 +16,7 @@ namespace cc { class InputHandler; +struct DidOverscrollParams; } namespace WebKit { @@ -70,8 +71,7 @@ class SynchronousCompositorImpl virtual gfx::Vector2dF GetTotalScrollOffset() OVERRIDE; void SetInputHandler(cc::InputHandler* input_handler); - void DidOverscroll(gfx::Vector2dF accumulated_overscroll, - gfx::Vector2dF current_fling_velocity); + void DidOverscroll(const cc::DidOverscrollParams& params); private: explicit SynchronousCompositorImpl(WebContents* contents); diff --git a/content/browser/android/in_process/synchronous_input_event_filter.cc b/content/browser/android/in_process/synchronous_input_event_filter.cc index 81483b2..17c909d 100644 --- a/content/browser/android/in_process/synchronous_input_event_filter.cc +++ b/content/browser/android/in_process/synchronous_input_event_filter.cc @@ -5,6 +5,7 @@ #include "content/browser/android/in_process/synchronous_input_event_filter.h" #include "base/callback.h" +#include "cc/input/input_handler.h" #include "content/browser/android/in_process/synchronous_compositor_impl.h" #include "content/public/browser/browser_thread.h" #include "ui/base/latency_info.h" @@ -66,14 +67,13 @@ void SynchronousInputEventFilter::DidRemoveInputHandler(int routing_id) { void SynchronousInputEventFilter::DidOverscroll( int routing_id, - gfx::Vector2dF accumulated_overscroll, - gfx::Vector2dF current_fling_velocity) { + const cc::DidOverscrollParams& params) { // The SynchronusCompositorImpl can be NULL if the WebContents that it's // bound to has already been deleted. SynchronousCompositorImpl* compositor = SynchronousCompositorImpl::FromRoutingID(routing_id); if (compositor) - compositor->DidOverscroll(accumulated_overscroll, current_fling_velocity); + compositor->DidOverscroll(params); } } // namespace content diff --git a/content/browser/android/in_process/synchronous_input_event_filter.h b/content/browser/android/in_process/synchronous_input_event_filter.h index 73a912d..18601c2 100644 --- a/content/browser/android/in_process/synchronous_input_event_filter.h +++ b/content/browser/android/in_process/synchronous_input_event_filter.h @@ -37,8 +37,7 @@ class SynchronousInputEventFilter : public InputHandlerManagerClient { 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; private: void SetBoundHandlerOnUIThread(const Handler& handler); diff --git a/content/public/browser/android/synchronous_compositor_client.h b/content/public/browser/android/synchronous_compositor_client.h index cf42ffb..fea09cc 100644 --- a/content/public/browser/android/synchronous_compositor_client.h +++ b/content/public/browser/android/synchronous_compositor_client.h @@ -27,7 +27,7 @@ class SynchronousCompositorClient { // See LayerScrollOffsetDelegate for details. virtual void SetTotalRootLayerScrollOffset(gfx::Vector2dF new_value) = 0; virtual gfx::Vector2dF GetTotalRootLayerScrollOffset() = 0; - virtual void DidOverscroll(gfx::Vector2dF accumulated_overscroll, + virtual void DidOverscroll(gfx::Vector2dF latest_overscroll_delta, gfx::Vector2dF current_fling_velocity) = 0; // When true, should periodically call 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>; |