Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 680413006: Re-enable Eager Gesture Recognition on Aura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Support interleaved sync and async acks. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 2015 matching lines...) Expand 10 before | Expand all | Expand 10 after
2026 2026
2027 event->SetHandled(); 2027 event->SetHandled();
2028 } 2028 }
2029 2029
2030 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { 2030 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) {
2031 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnTouchEvent"); 2031 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnTouchEvent");
2032 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) 2032 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event))
2033 return; 2033 return;
2034 2034
2035 // Update the touch event first. 2035 // Update the touch event first.
2036 blink::WebTouchPoint* point = UpdateWebTouchEventFromUIEvent(*event, 2036 blink::WebTouchPoint* point =
2037 &touch_event_); 2037 UpdateWebTouchEventFromUIEvent(*event, &touch_event_);
2038 2038
2039 // Forward the touch event only if a touch point was updated, and there's a 2039 if (!point && host_->ShouldForwardTouchEvent()) {
2040 // touch-event handler in the page, and no other touch-event is in the queue. 2040 event->DisableSynchronousHandling();
2041 // It is important to always consume the event if there is a touch-event 2041 // Mark the most recent touch event as handled, as it wasn't valid.
2042 // handler in the page, or some touch-event is already in the queue, even if 2042 ui::GestureRecognizer::Get()->AckSyncTouchEvent(*event, ui::ER_HANDLED,
2043 // no point has been updated, to make sure that this event does not get 2043 window_);
2044 // processed by the gesture recognizer before the events in the queue. 2044 }
2045 if (host_->ShouldForwardTouchEvent())
2046 event->StopPropagation();
2047 2045
2048 if (point) { 2046 if (!point)
2049 if (host_->ShouldForwardTouchEvent()) 2047 return;
2050 host_->ForwardTouchEventWithLatencyInfo(touch_event_, *event->latency()); 2048
2051 UpdateWebTouchEventAfterDispatch(&touch_event_, point); 2049 // Forward the touch event only if a touch point was updated, and
2050 // there's a touch-event handler in the page, and no other
2051 // touch-event is in the queue. It is important to always mark
2052 // events as being handled asynchronously if there is a touch-event
2053 // handler in the page, or some touch-event is already in the queue,
2054 // even if no point has been updated. This ensures that this event
2055 // does not get processed by the gesture recognizer before events
2056 // currently awaiting dispatch in the touch queue.
2057 if (host_->ShouldForwardTouchEvent()) {
2058 event->DisableSynchronousHandling();
2059 host_->ForwardTouchEventWithLatencyInfo(touch_event_, *event->latency());
2052 } 2060 }
2061 UpdateWebTouchEventAfterDispatch(&touch_event_, point);
2053 } 2062 }
2054 2063
2055 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { 2064 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) {
2056 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent"); 2065 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent");
2057 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || 2066 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN ||
2058 event->type() == ui::ET_GESTURE_PINCH_UPDATE || 2067 event->type() == ui::ET_GESTURE_PINCH_UPDATE ||
2059 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { 2068 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) {
2060 event->SetHandled(); 2069 event->SetHandled();
2061 return; 2070 return;
2062 } 2071 }
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
2574 2583
2575 //////////////////////////////////////////////////////////////////////////////// 2584 ////////////////////////////////////////////////////////////////////////////////
2576 // RenderWidgetHostViewBase, public: 2585 // RenderWidgetHostViewBase, public:
2577 2586
2578 // static 2587 // static
2579 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2588 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2580 GetScreenInfoForWindow(results, NULL); 2589 GetScreenInfoForWindow(results, NULL);
2581 } 2590 }
2582 2591
2583 } // namespace content 2592 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698