Index: content/browser/renderer_host/input/mouse_wheel_event_queue.cc |
diff --git a/content/browser/renderer_host/input/mouse_wheel_event_queue.cc b/content/browser/renderer_host/input/mouse_wheel_event_queue.cc |
index 1728da15397f81f3146534e1220b523969983213..a602748afc470d3d38230c9d558bd30f4db103fd 100644 |
--- a/content/browser/renderer_host/input/mouse_wheel_event_queue.cc |
+++ b/content/browser/renderer_host/input/mouse_wheel_event_queue.cc |
@@ -37,8 +37,6 @@ class QueuedWebMouseWheelEvent : public MouseWheelEventWithLatencyInfo { |
MouseWheelEventQueue::MouseWheelEventQueue(MouseWheelEventQueueClient* client, |
bool enable_scroll_latching) |
: client_(client), |
- needs_scroll_begin_(true), |
- needs_scroll_end_(false), |
enable_scroll_latching_(enable_scroll_latching), |
scrolling_device_(blink::kWebGestureDeviceUninitialized) { |
DCHECK(client); |
@@ -180,8 +178,8 @@ void MouseWheelEventQueue::ProcessMouseWheelAck( |
// because the events generated will be a GSB (non-synthetic) and GSE |
// (non-synthetic). This situation arises when OSX generates double |
// phase end information. |
- bool empty_sequence = |
- !needs_update && needs_scroll_begin_ && current_phase_ended; |
+ bool empty_sequence = !needs_update && !client_->is_in_gesture_scroll() && |
+ current_phase_ended; |
if (enable_scroll_latching_) { |
if (event_sent_for_gesture_ack_->event.momentum_phase == |
@@ -192,7 +190,7 @@ void MouseWheelEventQueue::ProcessMouseWheelAck( |
} |
if (needs_update || !empty_sequence) { |
- if (needs_scroll_begin_) { |
+ if (!client_->is_in_gesture_scroll()) { |
SendScrollBegin(scroll_update, false); |
} |
@@ -221,7 +219,7 @@ void MouseWheelEventQueue::ProcessMouseWheelAck( |
} else { // !enable_scroll_latching_ |
if (needs_update || !empty_sequence) { |
- if (needs_scroll_begin_) { |
+ if (!client_->is_in_gesture_scroll()) { |
// If no GSB has been sent, it will be a non-synthetic GSB. |
SendScrollBegin(scroll_update, false); |
} else if (has_phase_info) { |
@@ -284,8 +282,6 @@ void MouseWheelEventQueue::OnGestureScrollEvent( |
// Don't send the pending ScrollEnd if a fling is happening. |
// The next wheel event will still need a ScrollBegin. |
scroll_end_timer_.Stop(); |
- needs_scroll_begin_ = true; |
- needs_scroll_end_ = false; |
} else { |
scroll_end_timer_.Reset(); |
} |
@@ -307,7 +303,8 @@ void MouseWheelEventQueue::TryForwardNextEventToRenderer() { |
void MouseWheelEventQueue::SendScrollEnd(WebGestureEvent update_event, |
bool synthetic) { |
- DCHECK((synthetic && !needs_scroll_end_) || needs_scroll_end_); |
+ DCHECK((synthetic && !client_->is_in_gesture_scroll()) || |
+ client_->is_in_gesture_scroll()); |
WebGestureEvent scroll_end(update_event); |
scroll_end.SetTimeStampSeconds( |
@@ -320,13 +317,9 @@ void MouseWheelEventQueue::SendScrollEnd(WebGestureEvent update_event, |
scroll_end.data.scroll_end.delta_units = |
update_event.data.scroll_update.delta_units; |
- if (!synthetic) { |
- needs_scroll_begin_ = true; |
- needs_scroll_end_ = false; |
+ if (!synthetic && scroll_end_timer_.IsRunning()) |
+ scroll_end_timer_.Reset(); |
- if (scroll_end_timer_.IsRunning()) |
- scroll_end_timer_.Reset(); |
- } |
client_->ForwardGestureEventWithLatencyInfo( |
scroll_end, ui::LatencyInfo(ui::SourceEventType::WHEEL)); |
} |
@@ -334,7 +327,8 @@ void MouseWheelEventQueue::SendScrollEnd(WebGestureEvent update_event, |
void MouseWheelEventQueue::SendScrollBegin( |
const WebGestureEvent& gesture_update, |
bool synthetic) { |
- DCHECK((synthetic && !needs_scroll_begin_) || needs_scroll_begin_); |
+ DCHECK((synthetic && client_->is_in_gesture_scroll()) || |
+ !client_->is_in_gesture_scroll()); |
WebGestureEvent scroll_begin(gesture_update); |
scroll_begin.SetType(WebInputEvent::kGestureScrollBegin); |
@@ -349,8 +343,6 @@ void MouseWheelEventQueue::SendScrollBegin( |
scroll_begin.data.scroll_begin.delta_hint_units = |
gesture_update.data.scroll_update.delta_units; |
- needs_scroll_begin_ = false; |
- needs_scroll_end_ = true; |
client_->ForwardGestureEventWithLatencyInfo( |
scroll_begin, ui::LatencyInfo(ui::SourceEventType::WHEEL)); |
} |