Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1139)

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 2918053002: Move middle-click autoscroll to synthetic fling. (Closed)
Patch Set: Delete redundant cursor shape print Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 473ef4addb377e5d7cf3ea4f85ad5a8bd87f4ad2..db49686555d7fa4ea1d95e49339ea03a3343044e 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -91,6 +91,7 @@
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/geometry/vector2d_conversions.h"
+#include "ui/gfx/geometry/vector2d_f.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/skbitmap_operations.h"
@@ -563,6 +564,9 @@ bool RenderWidgetHostImpl::OnMessageReceived(const IPC::Message &msg) {
IPC_MESSAGE_HANDLER(ViewHostMsg_DidNotProduceFrame, DidNotProduceFrame)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnUpdateRect)
IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnSetCursor)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_AutoscrollStart, OnAutoscrollStart)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_AutoscrollFling, OnAutoscrollFling)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_AutoscrollEnd, OnAutoscrollEnd)
IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged,
OnTextInputStateChanged)
IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnLockMouse)
@@ -2036,6 +2040,42 @@ void RenderWidgetHostImpl::OnSetCursor(const WebCursor& cursor) {
SetCursor(cursor);
}
+void RenderWidgetHostImpl::OnAutoscrollStart(const gfx::PointF& position) {
+ WebGestureEvent scroll_begin = SyntheticWebGestureEventBuilder::Build(
+ WebInputEvent::kGestureScrollBegin,
+ blink::kWebGestureDeviceSyntheticAutoscroll);
+
+ scroll_begin.x = position.x();
+ scroll_begin.y = position.y();
+ scroll_begin.source_device = blink::kWebGestureDeviceSyntheticAutoscroll;
+
+ input_router_->SendGestureEvent(GestureEventWithLatencyInfo(scroll_begin));
+}
+
+void RenderWidgetHostImpl::OnAutoscrollFling(const gfx::Vector2dF& velocity) {
+ WebGestureEvent event = SyntheticWebGestureEventBuilder::Build(
+ WebInputEvent::kGestureFlingStart,
+ blink::kWebGestureDeviceSyntheticAutoscroll);
+ event.data.fling_start.velocity_x = velocity.x();
+ event.data.fling_start.velocity_y = velocity.y();
+ event.source_device = blink::kWebGestureDeviceSyntheticAutoscroll;
+
+ input_router_->SendGestureEvent(GestureEventWithLatencyInfo(event));
+}
+
+void RenderWidgetHostImpl::OnAutoscrollEnd() {
+ WebGestureEvent cancel_event = SyntheticWebGestureEventBuilder::Build(
+ WebInputEvent::kGestureFlingCancel,
+ blink::kWebGestureDeviceSyntheticAutoscroll);
+ cancel_event.data.fling_cancel.prevent_boosting = true;
+ input_router_->SendGestureEvent(GestureEventWithLatencyInfo(cancel_event));
+
+ WebGestureEvent end_event = SyntheticWebGestureEventBuilder::Build(
+ WebInputEvent::kGestureScrollEnd,
+ blink::kWebGestureDeviceSyntheticAutoscroll);
+ input_router_->SendGestureEvent(GestureEventWithLatencyInfo(end_event));
+}
+
void RenderWidgetHostImpl::SetTouchEventEmulationEnabled(
bool enabled, ui::GestureProviderConfigType config_type) {
if (enabled) {
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698