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

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: Whitespace. 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 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 } 1156 }
1157 1157
1158 void RenderWidgetHostViewAura::ProcessAckedTouchEvent( 1158 void RenderWidgetHostViewAura::ProcessAckedTouchEvent(
1159 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { 1159 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) {
1160 ScopedVector<ui::TouchEvent> events; 1160 ScopedVector<ui::TouchEvent> events;
1161 if (!MakeUITouchEventsFromWebTouchEvents(touch, &events, 1161 if (!MakeUITouchEventsFromWebTouchEvents(touch, &events,
1162 SCREEN_COORDINATES)) 1162 SCREEN_COORDINATES))
1163 return; 1163 return;
1164 1164
1165 aura::WindowTreeHost* host = window_->GetHost(); 1165 aura::WindowTreeHost* host = window_->GetHost();
1166 // |host| is NULL during tests. 1166 // |host| may be null during tests.
1167 if (!host) 1167 if (!host)
1168 return; 1168 return;
1169 1169
1170 ui::EventResult result = (ack_result == 1170 ui::EventResult result = (ack_result ==
1171 INPUT_EVENT_ACK_STATE_CONSUMED) ? ui::ER_HANDLED : ui::ER_UNHANDLED; 1171 INPUT_EVENT_ACK_STATE_CONSUMED) ? ui::ER_HANDLED : ui::ER_UNHANDLED;
1172 for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(), 1172 for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(),
1173 end = events.end(); iter != end; ++iter) { 1173 end = events.end(); iter != end; ++iter) {
1174 host->dispatcher()->ProcessedTouchEvent((*iter), window_, result); 1174 host->dispatcher()->ProcessedTouchEvent((*iter), window_, result);
1175 } 1175 }
1176 } 1176 }
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
2021 2021
2022 event->SetHandled(); 2022 event->SetHandled();
2023 } 2023 }
2024 2024
2025 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { 2025 void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) {
2026 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnTouchEvent"); 2026 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnTouchEvent");
2027 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event)) 2027 if (touch_editing_client_ && touch_editing_client_->HandleInputEvent(event))
2028 return; 2028 return;
2029 2029
2030 // Update the touch event first. 2030 // Update the touch event first.
2031 blink::WebTouchPoint* point = UpdateWebTouchEventFromUIEvent(*event, 2031 blink::WebTouchPoint* point =
2032 &touch_event_); 2032 UpdateWebTouchEventFromUIEvent(*event, &touch_event_);
2033
2034 bool should_forward = host_->ShouldForwardTouchEvent();
2033 2035
2034 // Forward the touch event only if a touch point was updated, and there's a 2036 // Forward the touch event only if a touch point was updated, and there's a
2035 // touch-event handler in the page, and no other touch-event is in the queue. 2037 // touch-event handler in the page, and no other touch-event is in the queue.
2036 // It is important to always consume the event if there is a touch-event 2038 // It is important to always consume the event if there is a touch-event
2037 // handler in the page, or some touch-event is already in the queue, even if 2039 // handler in the page, or some touch-event is already in the queue, even if
2038 // no point has been updated, to make sure that this event does not get 2040 // no point has been updated, to make sure that this event does not get
2039 // processed by the gesture recognizer before the events in the queue. 2041 // processed by the gesture recognizer before the events in the queue.
2040 if (host_->ShouldForwardTouchEvent()) 2042 if (point && should_forward) {
2043 DCHECK(window_->GetHost());
2044 if (window_->GetHost()->dispatcher()->OnForwardingAsyncTouchEvent(event))
2045 host_->ForwardTouchEventWithLatencyInfo(touch_event_, *event->latency());
2046 }
2047
2048 if (should_forward)
2041 event->StopPropagation(); 2049 event->StopPropagation();
jdduke (slow) 2014/10/22 17:51:02 Does it matter that the touch may have been ack'ed
tdresser 2014/10/22 18:24:08 In that case, we'll synchronously hit WindowEventD
2042 2050
2043 if (point) { 2051 if (point)
2044 if (host_->ShouldForwardTouchEvent())
2045 host_->ForwardTouchEventWithLatencyInfo(touch_event_, *event->latency());
2046 UpdateWebTouchEventAfterDispatch(&touch_event_, point); 2052 UpdateWebTouchEventAfterDispatch(&touch_event_, point);
2047 }
2048 } 2053 }
2049 2054
2050 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { 2055 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) {
2051 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent"); 2056 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent");
2052 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || 2057 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN ||
2053 event->type() == ui::ET_GESTURE_PINCH_UPDATE || 2058 event->type() == ui::ET_GESTURE_PINCH_UPDATE ||
2054 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { 2059 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) {
2055 event->SetHandled(); 2060 event->SetHandled();
2056 return; 2061 return;
2057 } 2062 }
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
2606 2611
2607 //////////////////////////////////////////////////////////////////////////////// 2612 ////////////////////////////////////////////////////////////////////////////////
2608 // RenderWidgetHostViewBase, public: 2613 // RenderWidgetHostViewBase, public:
2609 2614
2610 // static 2615 // static
2611 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2616 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2612 GetScreenInfoForWindow(results, NULL); 2617 GetScreenInfoForWindow(results, NULL);
2613 } 2618 }
2614 2619
2615 } // namespace content 2620 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698