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

Unified Diff: content/browser/frame_host/render_widget_host_view_child_frame.cc

Issue 2173603002: Filter GestureFlingStarts with Vx=Vy=0 in RenderWidgetHostViewChildFrame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clarify comments, and include reference to RWHVA::FilterInputEvent(). Created 4 years, 5 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
Index: content/browser/frame_host/render_widget_host_view_child_frame.cc
diff --git a/content/browser/frame_host/render_widget_host_view_child_frame.cc b/content/browser/frame_host/render_widget_host_view_child_frame.cc
index 09f1353e453a7a173507f4aff28078083853de7d..8fbfdc163d3866366f5a4d5027a5b26eae854068 100644
--- a/content/browser/frame_host/render_widget_host_view_child_frame.cc
+++ b/content/browser/frame_host/render_widget_host_view_child_frame.cc
@@ -33,6 +33,7 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/common/browser_plugin_guest_mode.h"
#include "gpu/ipc/common/gpu_messages.h"
+#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/geometry/size_f.h"
@@ -655,6 +656,31 @@ void RenderWidgetHostViewChildFrame::OnSetNeedsBeginFrames(
}
}
+InputEventAckState RenderWidgetHostViewChildFrame::FilterInputEvent(
+ const blink::WebInputEvent& input_event) {
+ if (input_event.type == blink::WebInputEvent::GestureFlingStart) {
+ const blink::WebGestureEvent& gesture_event =
+ static_cast<const blink::WebGestureEvent&>(input_event);
+ // Zero-velocity touchpad flings are an Aura-specific signal that the
+ // touchpad scroll has ended, and should not be forwarded to the renderer.
+ if (gesture_event.sourceDevice == blink::WebGestureDeviceTouchpad &&
+ !gesture_event.data.flingStart.velocityX &&
+ !gesture_event.data.flingStart.velocityY) {
+ // Here we indicate that there was no consumer for this event, as
+ // otherwise the fling animation system will try to run an animation
+ // and will also expect a notification when the fling ends. Since
+ // CrOS just uses the GestureFlingStart with zero-velocity as a means
+ // of indicating that touchpad scroll has ended, we don't actually want
+ // a fling animation.
+ // Note: this event handling is modeled on similar code in
+ // TenderWidgetHostViewAura::FilterInputEvent().
+ return INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS;
+ }
+ }
+
+ return INPUT_EVENT_ACK_STATE_NOT_CONSUMED;
+}
+
BrowserAccessibilityManager*
RenderWidgetHostViewChildFrame::CreateBrowserAccessibilityManager(
BrowserAccessibilityDelegate* delegate, bool for_root_frame) {

Powered by Google App Engine
This is Rietveld 408576698