| Index: content/browser/renderer_host/input/gesture_event_queue.cc
|
| diff --git a/content/browser/renderer_host/input/gesture_event_queue.cc b/content/browser/renderer_host/input/gesture_event_queue.cc
|
| index a435d33e92da25dd414db4a5dfe571ff5e1f1d4f..6c256f275448847df8838e2c8ef8d1fd9285d80e 100644
|
| --- a/content/browser/renderer_host/input/gesture_event_queue.cc
|
| +++ b/content/browser/renderer_host/input/gesture_event_queue.cc
|
| @@ -21,16 +21,16 @@ namespace {
|
| bool IsCompatibleScrollorPinch(
|
| const GestureEventWithLatencyInfo& new_event,
|
| const GestureEventWithLatencyInfo& event_in_queue) {
|
| - DCHECK(new_event.event.type == WebInputEvent::GestureScrollUpdate ||
|
| - new_event.event.type == WebInputEvent::GesturePinchUpdate)
|
| + DCHECK(new_event.event.type() == WebInputEvent::GestureScrollUpdate ||
|
| + new_event.event.type() == WebInputEvent::GesturePinchUpdate)
|
| << "Invalid event type for pinch/scroll coalescing: "
|
| - << WebInputEvent::GetName(new_event.event.type);
|
| - DLOG_IF(WARNING, new_event.event.timeStampSeconds <
|
| - event_in_queue.event.timeStampSeconds)
|
| + << WebInputEvent::GetName(new_event.event.type());
|
| + DLOG_IF(WARNING, new_event.event.timeStampSeconds() <
|
| + event_in_queue.event.timeStampSeconds())
|
| << "Event time not monotonic?\n";
|
| - return (event_in_queue.event.type == WebInputEvent::GestureScrollUpdate ||
|
| - event_in_queue.event.type == WebInputEvent::GesturePinchUpdate) &&
|
| - event_in_queue.event.modifiers == new_event.event.modifiers &&
|
| + return (event_in_queue.event.type() == WebInputEvent::GestureScrollUpdate ||
|
| + event_in_queue.event.type() == WebInputEvent::GesturePinchUpdate) &&
|
| + event_in_queue.event.modifiers() == new_event.event.modifiers() &&
|
| event_in_queue.event.sourceDevice == new_event.event.sourceDevice;
|
| }
|
|
|
| @@ -38,17 +38,17 @@ bool IsCompatibleScrollorPinch(
|
| gfx::Transform GetTransformForEvent(
|
| const GestureEventWithLatencyInfo& gesture_event) {
|
| gfx::Transform gesture_transform;
|
| - if (gesture_event.event.type == WebInputEvent::GestureScrollUpdate) {
|
| + if (gesture_event.event.type() == WebInputEvent::GestureScrollUpdate) {
|
| gesture_transform.Translate(gesture_event.event.data.scrollUpdate.deltaX,
|
| gesture_event.event.data.scrollUpdate.deltaY);
|
| - } else if (gesture_event.event.type == WebInputEvent::GesturePinchUpdate) {
|
| + } else if (gesture_event.event.type() == WebInputEvent::GesturePinchUpdate) {
|
| float scale = gesture_event.event.data.pinchUpdate.scale;
|
| gesture_transform.Translate(-gesture_event.event.x, -gesture_event.event.y);
|
| gesture_transform.Scale(scale, scale);
|
| gesture_transform.Translate(gesture_event.event.x, gesture_event.event.y);
|
| } else {
|
| NOTREACHED() << "Invalid event type for transform retrieval: "
|
| - << WebInputEvent::GetName(gesture_event.event.type);
|
| + << WebInputEvent::GetName(gesture_event.event.type());
|
| }
|
| return gesture_transform;
|
| }
|
| @@ -98,9 +98,9 @@ bool GestureEventQueue::ShouldDiscardFlingCancelEvent(
|
| GestureQueue::const_reverse_iterator it =
|
| coalesced_gesture_events_.rbegin();
|
| while (it != coalesced_gesture_events_.rend()) {
|
| - if (it->event.type == WebInputEvent::GestureFlingStart)
|
| + if (it->event.type() == WebInputEvent::GestureFlingStart)
|
| return false;
|
| - if (it->event.type == WebInputEvent::GestureFlingCancel)
|
| + if (it->event.type() == WebInputEvent::GestureFlingCancel)
|
| return true;
|
| it++;
|
| }
|
| @@ -111,7 +111,7 @@ bool GestureEventQueue::ShouldForwardForBounceReduction(
|
| const GestureEventWithLatencyInfo& gesture_event) {
|
| if (debounce_interval_ <= base::TimeDelta())
|
| return true;
|
| - switch (gesture_event.event.type) {
|
| + switch (gesture_event.event.type()) {
|
| case WebInputEvent::GestureScrollUpdate:
|
| if (!scrolling_in_progress_) {
|
| debounce_deferring_timer_.Start(
|
| @@ -143,13 +143,13 @@ bool GestureEventQueue::ShouldForwardForBounceReduction(
|
|
|
| bool GestureEventQueue::ShouldForwardForGFCFiltering(
|
| const GestureEventWithLatencyInfo& gesture_event) const {
|
| - return gesture_event.event.type != WebInputEvent::GestureFlingCancel ||
|
| - !ShouldDiscardFlingCancelEvent(gesture_event);
|
| + return gesture_event.event.type() != WebInputEvent::GestureFlingCancel ||
|
| + !ShouldDiscardFlingCancelEvent(gesture_event);
|
| }
|
|
|
| bool GestureEventQueue::ShouldForwardForTapSuppression(
|
| const GestureEventWithLatencyInfo& gesture_event) {
|
| - switch (gesture_event.event.type) {
|
| + switch (gesture_event.event.type()) {
|
| case WebInputEvent::GestureFlingCancel:
|
| if (gesture_event.event.sourceDevice ==
|
| blink::WebGestureDeviceTouchscreen)
|
| @@ -179,7 +179,7 @@ bool GestureEventQueue::ShouldForwardForTapSuppression(
|
|
|
| void GestureEventQueue::QueueAndForwardIfNecessary(
|
| const GestureEventWithLatencyInfo& gesture_event) {
|
| - switch (gesture_event.event.type) {
|
| + switch (gesture_event.event.type()) {
|
| case WebInputEvent::GestureFlingCancel:
|
| fling_in_progress_ = false;
|
| break;
|
| @@ -212,7 +212,7 @@ bool GestureEventQueue::OnScrollBegin(
|
| EventsInFlightCount() < coalesced_gesture_events_.size();
|
| if (synthetic && have_unsent_events) {
|
| GestureEventWithLatencyInfo* last_event = &coalesced_gesture_events_.back();
|
| - if (last_event->event.type == WebInputEvent::GestureScrollEnd &&
|
| + if (last_event->event.type() == WebInputEvent::GestureScrollEnd &&
|
| last_event->event.data.scrollEnd.synthetic) {
|
| coalesced_gesture_events_.pop_back();
|
| return true;
|
| @@ -234,15 +234,14 @@ void GestureEventQueue::ProcessGestureAck(InputEventAckState ack_result,
|
| // It's possible that the ack for the second event in an in-flight, coalesced
|
| // Gesture{Scroll,Pinch}Update pair is received prior to the first event ack.
|
| size_t event_index = 0;
|
| - if (ignore_next_ack_ &&
|
| - coalesced_gesture_events_.size() > 1 &&
|
| - coalesced_gesture_events_[0].event.type != type &&
|
| - coalesced_gesture_events_[1].event.type == type) {
|
| + if (ignore_next_ack_ && coalesced_gesture_events_.size() > 1 &&
|
| + coalesced_gesture_events_[0].event.type() != type &&
|
| + coalesced_gesture_events_[1].event.type() == type) {
|
| event_index = 1;
|
| }
|
| GestureEventWithLatencyInfo event_with_latency =
|
| coalesced_gesture_events_[event_index];
|
| - DCHECK_EQ(event_with_latency.event.type, type);
|
| + DCHECK_EQ(event_with_latency.event.type(), type);
|
| event_with_latency.latency.AddNewLatencyFrom(latency);
|
|
|
| // Ack'ing an event may enqueue additional gesture events. By ack'ing the
|
| @@ -276,16 +275,16 @@ void GestureEventQueue::ProcessGestureAck(InputEventAckState ack_result,
|
| // Check for the coupled GesturePinchUpdate before sending either event,
|
| // handling the case where the first GestureScrollUpdate ack is synchronous.
|
| GestureEventWithLatencyInfo second_gesture_event;
|
| - if (first_gesture_event.event.type == WebInputEvent::GestureScrollUpdate &&
|
| + if (first_gesture_event.event.type() == WebInputEvent::GestureScrollUpdate &&
|
| coalesced_gesture_events_.size() > 1 &&
|
| - coalesced_gesture_events_[1].event.type ==
|
| + coalesced_gesture_events_[1].event.type() ==
|
| WebInputEvent::GesturePinchUpdate) {
|
| second_gesture_event = coalesced_gesture_events_[1];
|
| ignore_next_ack_ = true;
|
| }
|
|
|
| client_->SendGestureEventImmediately(first_gesture_event);
|
| - if (second_gesture_event.event.type != WebInputEvent::Undefined)
|
| + if (second_gesture_event.event.type() != WebInputEvent::Undefined)
|
| client_->SendGestureEventImmediately(second_gesture_event);
|
| }
|
|
|
| @@ -334,7 +333,7 @@ void GestureEventQueue::QueueScrollOrPinchAndForwardIfNecessary(
|
| // (similarly for an in-flight pinch with a new scroll).
|
| const GestureEventWithLatencyInfo& first_event =
|
| coalesced_gesture_events_.front();
|
| - if (gesture_event.event.type != first_event.event.type &&
|
| + if (gesture_event.event.type() != first_event.event.type() &&
|
| IsCompatibleScrollorPinch(gesture_event, first_event)) {
|
| ignore_next_ack_ = true;
|
| client_->SendGestureEventImmediately(gesture_event);
|
| @@ -357,19 +356,19 @@ void GestureEventQueue::QueueScrollOrPinchAndForwardIfNecessary(
|
| // Keep the oldest LatencyInfo.
|
| DCHECK_LE(last_event->latency.trace_id(), gesture_event.latency.trace_id());
|
| GestureEventWithLatencyInfo scroll_event(
|
| - WebInputEvent::GestureScrollUpdate, gesture_event.event.modifiers,
|
| - gesture_event.event.timeStampSeconds, last_event->latency);
|
| + WebInputEvent::GestureScrollUpdate, gesture_event.event.modifiers(),
|
| + gesture_event.event.timeStampSeconds(), last_event->latency);
|
| GestureEventWithLatencyInfo pinch_event(
|
| - WebInputEvent::GesturePinchUpdate, gesture_event.event.modifiers,
|
| - gesture_event.event.timeStampSeconds, last_event->latency);
|
| + WebInputEvent::GesturePinchUpdate, gesture_event.event.modifiers(),
|
| + gesture_event.event.timeStampSeconds(), last_event->latency);
|
| pinch_event.event.sourceDevice = scroll_event.event.sourceDevice =
|
| gesture_event.event.sourceDevice;
|
| pinch_event.event.x =
|
| - gesture_event.event.type == WebInputEvent::GesturePinchUpdate
|
| + gesture_event.event.type() == WebInputEvent::GesturePinchUpdate
|
| ? gesture_event.event.x
|
| : last_event->event.x;
|
| pinch_event.event.y =
|
| - gesture_event.event.type == WebInputEvent::GesturePinchUpdate
|
| + gesture_event.event.type() == WebInputEvent::GesturePinchUpdate
|
| ? gesture_event.event.y
|
| : last_event->event.y;
|
|
|
|
|