Index: content/browser/renderer_host/input/input_router_impl.cc |
diff --git a/content/browser/renderer_host/input/input_router_impl.cc b/content/browser/renderer_host/input/input_router_impl.cc |
index 741d145d1eeb4a2c9d2c073f57deec4f5f4e4fc0..61305d162254b7253d58a152a15dd00aaa31257e 100644 |
--- a/content/browser/renderer_host/input/input_router_impl.cc |
+++ b/content/browser/renderer_host/input/input_router_impl.cc |
@@ -100,7 +100,6 @@ InputRouterImpl::InputRouterImpl(IPC::Sender* sender, |
move_caret_pending_(false), |
mouse_move_pending_(false), |
mouse_wheel_pending_(false), |
- has_touch_handler_(false), |
touch_ack_timeout_enabled_(false), |
touch_ack_timeout_delay_ms_(std::numeric_limits<size_t>::max()), |
current_ack_source_(ACK_SOURCE_NONE), |
@@ -261,9 +260,11 @@ const NativeWebKeyboardEvent* InputRouterImpl::GetLastKeyboardEvent() const { |
bool InputRouterImpl::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(); |
+ // still events in the touch-queue, but those events should be flushed, while |
+ // subsequent touch events will never stay in the queue (at least until |
+ // another touch handler is registered). |
+ DCHECK(touch_event_queue_->has_handlers() || touch_event_queue_->empty()); |
tdresser
2014/01/09 21:14:32
This DCHECK doesn't seem to make sense in conjunct
jdduke (slow)
2014/01/09 22:05:04
The comment wording was poorly modified on my part
|
+ return touch_event_queue_->has_handlers(); |
} |
void InputRouterImpl::OnViewUpdated(int view_flags) { |
@@ -502,11 +503,9 @@ void InputRouterImpl::OnSelectRangeAck() { |
} |
void InputRouterImpl::OnHasTouchEventHandlers(bool has_handlers) { |
- if (has_touch_handler_ == has_handlers) |
+ if (has_handlers == touch_event_queue_->has_handlers()) |
return; |
- has_touch_handler_ = has_handlers; |
- if (!has_handlers) |
- touch_event_queue_->FlushQueue(); |
+ touch_event_queue_->OnHasTouchEventHandlers(has_handlers); |
client_->OnHasTouchEventHandlers(has_handlers); |
} |