diff options
Diffstat (limited to 'content')
4 files changed, 9 insertions, 39 deletions
diff --git a/content/browser/renderer_host/render_widget_host_delegate.h b/content/browser/renderer_host/render_widget_host_delegate.h index d80d502..aa38066 100644 --- a/content/browser/renderer_host/render_widget_host_delegate.h +++ b/content/browser/renderer_host/render_widget_host_delegate.h @@ -78,11 +78,10 @@ class CONTENT_EXPORT RenderWidgetHostDelegate { // the event itself. virtual bool HandleWheelEvent(const blink::WebMouseWheelEvent& event); - // Notification the user has performed a direct interaction (mouse down, mouse - // wheel, raw key down, gesture tap, or browser-initiated navigation) while + // Notification the user has performed a direct interaction (mouse down, + // scroll, raw key down, gesture tap, or browser-initiated navigation) while // focus was on the page. Informs the delegate that a user is interacting with - // a site. Only the first mouse wheel event during a scroll will trigger this - // method. + // a site. virtual void OnUserInteraction(RenderWidgetHostImpl* render_widget_host, const blink::WebInputEvent::Type type) {} diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index 07fb77a..d50b558 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -98,13 +98,6 @@ 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> @@ -218,7 +211,6 @@ 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_); @@ -1849,21 +1841,11 @@ InputEventAckState RenderWidgetHostImpl::FilterInputEvent( if (!process_->HasConnection()) return INPUT_EVENT_ACK_STATE_UNKNOWN; - if (delegate_) { - if (event.type == WebInputEvent::MouseDown || - event.type == WebInputEvent::GestureTapDown || - event.type == WebInputEvent::RawKeyDown) { - delegate_->OnUserInteraction(this, event.type); - } else if (event.type == WebInputEvent::MouseWheel) { - if (mouse_wheel_coalesce_timer_->Elapsed().InSecondsF() > - kMouseWheelCoalesceIntervalInSeconds) { - // TODO(dominickn): once GestureScrollBegin has landed on all platforms, - // replace this branch and remove. - delegate_->OnUserInteraction(this, event.type); - } - - mouse_wheel_coalesce_timer_.reset(new base::ElapsedTimer()); - } + if (delegate_ && (event.type == WebInputEvent::MouseDown || + event.type == WebInputEvent::GestureScrollBegin || + event.type == WebInputEvent::GestureTapDown || + event.type == WebInputEvent::RawKeyDown)) { + delegate_->OnUserInteraction(this, event.type); } return view_ ? view_->FilterInputEvent(event) diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index 567d51e..7a079da 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h @@ -821,12 +821,6 @@ class CONTENT_EXPORT RenderWidgetHostImpl : public RenderWidgetHost, // renderer process before clearing any previously displayed content. base::TimeDelta new_content_rendering_delay_; - // Timer used to batch together mouse wheel events for the delegate - // OnUserInteraction method. A wheel event is only dispatched when a wheel - // event has not been seen for kMouseWheelCoalesceInterval seconds prior. - // TODO(dominickn): remove this when GestureScrollBegin has landed. - scoped_ptr<base::ElapsedTimer> mouse_wheel_coalesce_timer_; - base::WeakPtrFactory<RenderWidgetHostImpl> weak_factory_; DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostImpl); diff --git a/content/public/browser/web_contents_observer.h b/content/public/browser/web_contents_observer.h index 226f309..a3bc77f 100644 --- a/content/public/browser/web_contents_observer.h +++ b/content/public/browser/web_contents_observer.h @@ -327,15 +327,10 @@ class CONTENT_EXPORT WebContentsObserver : public IPC::Listener, // The type argument specifies the kind of interaction. Direct user input // signalled through this callback includes: // 1) any mouse down event (blink::WebInputEvent::MouseDown); - // 2) the start of a mouse wheel scroll (blink::WebInputEvent::MouseWheel); + // 2) the start of a scroll (blink::WebInputEvent::GestureScrollBegin); // 3) any raw key down event (blink::WebInputEvent::RawKeyDown); // 4) any gesture tap event (blink::WebInputEvent::GestureTapDown); and // 5) a browser navigation or reload (blink::WebInputEvent::Undefined). - // The start of a mouse wheel scroll is heuristically detected: a mouse - // wheel event fired at least 0.1 seconds after any other wheel event is - // regarded as the beginning of a scroll. This matches the interval used by - // the Blink EventHandler to detect the end of scrolls. - // TODO(dominickn): replace MouseWheel with GestureScrollBegin. virtual void DidGetUserInteraction(const blink::WebInputEvent::Type type) {} // This method is invoked when a RenderViewHost of this WebContents was |