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 a421f0924025c3f2661ac50d32655fca9e672856..4fcdff0f41609b004a69f807ba995b3d4e5a7036 100644 |
--- a/content/browser/renderer_host/render_widget_host_impl.cc |
+++ b/content/browser/renderer_host/render_widget_host_impl.cc |
@@ -1137,6 +1137,8 @@ void RenderWidgetHostImpl::RendererExited(base::TerminationStatus status, |
select_range_pending_ = false; |
next_selection_range_.reset(); |
+ touch_event_queue_->Reset(); |
+ |
// Must reset these to ensure that gesture events work with a new renderer. |
gesture_event_filter_->Reset(); |
@@ -1756,7 +1758,11 @@ void RenderWidgetHostImpl::OnMsgBlur() { |
} |
void RenderWidgetHostImpl::OnMsgHasTouchEventHandlers(bool has_handlers) { |
+ if (has_touch_handler_ == has_handlers) |
+ return; |
has_touch_handler_ = has_handlers; |
+ if (!has_touch_handler_) |
+ touch_event_queue_->FlushQueue(); |
} |
void RenderWidgetHostImpl::OnMsgSetCursor(const WebCursor& cursor) { |
@@ -1950,6 +1956,14 @@ const gfx::Point& RenderWidgetHostImpl::GetLastScrollOffset() const { |
return last_scroll_offset_; |
} |
+bool RenderWidgetHostImpl::ShouldForwardTouchEvent() const { |
+ // Always send a touch event if the renderer has a touch-event handler. It is |
+ // possible that a renderer stops listening to touch-events while there are |
+ // still events in the touch-queue. In such cases, the new events should still |
+ // get into the queue. |
+ return has_touch_handler_ || !touch_event_queue_->empty(); |
+} |
+ |
void RenderWidgetHostImpl::StartUserGesture() { |
OnUserGesture(); |
} |