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

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: Fix out of order ack problem. Created 6 years, 1 month 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 2019 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 2030
2031 event->SetHandled(); 2031 event->SetHandled();
2032 } 2032 }
2033 2033
2034 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { 2034 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) {
2035 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnTouchEvent"); 2035 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnTouchEvent");
2036 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) 2036 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event))
2037 return; 2037 return;
2038 2038
2039 // Update the touch event first. 2039 // Update the touch event first.
2040 blink::WebTouchPoint* point = UpdateWebTouchEventFromUIEvent(*event, 2040 blink::WebTouchPoint* point =
2041 &touch_event_); 2041 UpdateWebTouchEventFromUIEvent(*event, &touch_event_);
2042 2042
2043 // Forward the touch event only if a touch point was updated, and there's a 2043 if (!point && host_->ShouldForwardTouchEvent()) {
2044 // touch-event handler in the page, and no other touch-event is in the queue. 2044 event->DisableSynchronousHandling();
2045 // It is important to always consume the event if there is a touch-event 2045 // Ignore the most recent touch event, as it wasn't valid.
2046 // handler in the page, or some touch-event is already in the queue, even if 2046 DCHECK(window_->GetHost());
2047 // no point has been updated, to make sure that this event does not get 2047 window_->GetHost()->dispatcher()->IgnoreLastTouchEvent(window_);
jdduke (slow) 2014/11/20 19:49:16 Is this better than calling |ui::GestureRecognizer
tdresser 2014/11/21 13:25:21 Done. I was thinking it was better from a layerin
2048 // processed by the gesture recognizer before the events in the queue. 2048 }
2049 if (host_->ShouldForwardTouchEvent())
2050 event->StopPropagation();
2051 2049
2052 if (point) { 2050 if (!point)
2053 if (host_->ShouldForwardTouchEvent()) 2051 return;
2054 host_->ForwardTouchEventWithLatencyInfo(touch_event_, *event->latency()); 2052
2055 UpdateWebTouchEventAfterDispatch(&touch_event_, point); 2053 // Forward the touch event only if a touch point was updated, and
2054 // there's a touch-event handler in the page, and no other
2055 // touch-event is in the queue. It is important to always mark
2056 // events as being handled asynchronously if there is a touch-event
2057 // handler in the page, or some touch-event is already in the queue,
2058 // even if no point has been updated. This ensures that this event
2059 // does not get processed by the gesture recognizer before events
2060 // currently awaiting dispatch in the touch queue.
2061 if (host_->ShouldForwardTouchEvent()) {
2062 event->DisableSynchronousHandling();
2063 host_->ForwardTouchEventWithLatencyInfo(touch_event_, *event->latency());
2056 } 2064 }
2065 UpdateWebTouchEventAfterDispatch(&touch_event_, point);
2057 } 2066 }
2058 2067
2059 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { 2068 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) {
2060 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent"); 2069 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent");
2061 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || 2070 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN ||
2062 event->type() == ui::ET_GESTURE_PINCH_UPDATE || 2071 event->type() == ui::ET_GESTURE_PINCH_UPDATE ||
2063 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { 2072 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) {
2064 event->SetHandled(); 2073 event->SetHandled();
2065 return; 2074 return;
2066 } 2075 }
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
2578 2587
2579 //////////////////////////////////////////////////////////////////////////////// 2588 ////////////////////////////////////////////////////////////////////////////////
2580 // RenderWidgetHostViewBase, public: 2589 // RenderWidgetHostViewBase, public:
2581 2590
2582 // static 2591 // static
2583 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2592 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2584 GetScreenInfoForWindow(results, NULL); 2593 GetScreenInfoForWindow(results, NULL);
2585 } 2594 }
2586 2595
2587 } // namespace content 2596 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698