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

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

Issue 551373006: Re-enable Eager Gesture Recognition on Aura (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address sadrul's comments. 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 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 } 1161 }
1162 1162
1163 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( 1163 void RenderWidgetHostViewAura::ProcessAckedTouchEvent(
1164 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { 1164 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) {
1165 ScopedVector<ui::TouchEvent> events; 1165 ScopedVector<ui::TouchEvent> events;
1166 if (!MakeUITouchEventsFromWebTouchEvents(touch, &events, 1166 if (!MakeUITouchEventsFromWebTouchEvents(touch, &events,
1167 SCREEN_COORDINATES)) 1167 SCREEN_COORDINATES))
1168 return; 1168 return;
1169 1169
1170 aura::WindowTreeHost* host = window_->GetHost(); 1170 aura::WindowTreeHost* host = window_->GetHost();
1171 // |host| is NULL during tests. 1171 // |host| may be null during tests.
1172 if (!host) 1172 if (!host)
1173 return; 1173 return;
1174 1174
1175 ui::EventResult result = (ack_result == 1175 ui::EventResult result = (ack_result ==
1176 INPUT_EVENT_ACK_STATE_CONSUMED) ? ui::ER_HANDLED : ui::ER_UNHANDLED; 1176 INPUT_EVENT_ACK_STATE_CONSUMED) ? ui::ER_HANDLED : ui::ER_UNHANDLED;
1177 for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(), 1177 for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(),
1178 end = events.end(); iter != end; ++iter) { 1178 end = events.end(); iter != end; ++iter) {
1179 host->dispatcher()->ProcessedTouchEvent((*iter), window_, result); 1179 host->dispatcher()->ProcessedTouchEvent((*iter), window_, result);
1180 } 1180 }
1181 } 1181 }
(...skipping 848 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
2043 bool should_forward = host_->ShouldForwardTouchEvent();
2042 2044
2043 // Forward the touch event only if a touch point was updated, and there's a 2045 // Forward the touch event only if a touch point was updated, and there's a
2044 // touch-event handler in the page, and no other touch-event is in the queue. 2046 // touch-event handler in the page, and no other touch-event is in the queue.
2045 // It is important to always consume the event if there is a touch-event 2047 // It is important to always consume the event if there is a touch-event
2046 // handler in the page, or some touch-event is already in the queue, even if 2048 // handler in the page, or some touch-event is already in the queue, even if
2047 // no point has been updated, to make sure that this event does not get 2049 // no point has been updated, to make sure that this event does not get
2048 // processed by the gesture recognizer before the events in the queue. 2050 // processed by the gesture recognizer before the events in the queue.
2049 if (host_->ShouldForwardTouchEvent()) 2051 if (point && should_forward) {
2052 DCHECK(window_->GetHost());
2053 if (window_->GetHost()->dispatcher()->OnProcessingTouchEventAsync(event))
2054 host_->ForwardTouchEventWithLatencyInfo(touch_event_, *event->latency());
2055 }
2056
2057 if (should_forward)
2050 event->StopPropagation(); 2058 event->StopPropagation();
2051 2059
2052 if (point) { 2060 if (point)
2053 if (host_->ShouldForwardTouchEvent())
2054 host_->ForwardTouchEventWithLatencyInfo(touch_event_, *event->latency());
2055 UpdateWebTouchEventAfterDispatch(&touch_event_, point); 2061 UpdateWebTouchEventAfterDispatch(&touch_event_, point);
2056 }
2057 } 2062 }
2058 2063
2059 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { 2064 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) {
2060 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent"); 2065 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent");
2061 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || 2066 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN ||
2062 event->type() == ui::ET_GESTURE_PINCH_UPDATE || 2067 event->type() == ui::ET_GESTURE_PINCH_UPDATE ||
2063 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { 2068 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) {
2064 event->SetHandled(); 2069 event->SetHandled();
2065 return; 2070 return;
2066 } 2071 }
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
2615 2620
2616 //////////////////////////////////////////////////////////////////////////////// 2621 ////////////////////////////////////////////////////////////////////////////////
2617 // RenderWidgetHostViewBase, public: 2622 // RenderWidgetHostViewBase, public:
2618 2623
2619 // static 2624 // static
2620 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2625 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2621 GetScreenInfoForWindow(results, NULL); 2626 GetScreenInfoForWindow(results, NULL);
2622 } 2627 }
2623 2628
2624 } // namespace content 2629 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698