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

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

Issue 1407053010: Make mouse wheel events trigger WebContentsObserver::DidGetUserInteraction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing static initializer Created 5 years, 1 month 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/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 0a9f05f72f23cc6a3b0b088113025297d8c231da..62103fdef4437c496ae113ba5cbe5d229ffb060c 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -92,6 +92,13 @@ using blink::WebTextDirection;
namespace content {
namespace {
+// The amount of time after a mouse wheel event is sent to the delegate
+// OnUserInteraction method before another mouse wheel event will be sent. This
+// interval is used by the Blink EventHandler in its orthogonal heuristic for
+// detecting the end of a scroll event (if no event has been seen in 0.1
+// seconds, send an end scroll).
+const double kMouseWheelCoalesceIntervalInSeconds = 0.1;
+
bool g_check_for_pending_resize_ack = true;
// <process id, routing id>
@@ -204,6 +211,7 @@ RenderWidgetHostImpl::RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate,
base::TimeDelta::FromMilliseconds(kHungRendererDelayMs)),
new_content_rendering_delay_(
base::TimeDelta::FromMilliseconds(kNewContentRenderingDelayMs)),
+ mouse_wheel_coalesce_timer_(new base::ElapsedTimer()),
weak_factory_(this) {
CHECK(delegate_);
CHECK_NE(MSG_ROUTING_NONE, routing_id_);
@@ -1860,6 +1868,13 @@ InputEventAckState RenderWidgetHostImpl::FilterInputEvent(
event.type == WebInputEvent::GestureTapDown ||
event.type == WebInputEvent::RawKeyDown) {
delegate_->OnUserInteraction(event.type);
+ } else if (event.type == WebInputEvent::MouseWheel) {
+ if (mouse_wheel_coalesce_timer_->Elapsed().InSecondsF() >
+ kMouseWheelCoalesceIntervalInSeconds) {
+ delegate_->OnUserInteraction(event.type);
+ }
+
+ mouse_wheel_coalesce_timer_.reset(new base::ElapsedTimer());
}
}
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/public/browser/web_contents_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698