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

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

Issue 954973003: Always forward touch events to the TouchEventQueue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More validation Created 5 years, 10 months 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 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 // Update the touch event first. 2060 // Update the touch event first.
2061 if (!pointer_state_.OnTouch(*event)) { 2061 if (!pointer_state_.OnTouch(*event)) {
2062 event->StopPropagation(); 2062 event->StopPropagation();
2063 return; 2063 return;
2064 } 2064 }
2065 2065
2066 blink::WebTouchEvent touch_event = CreateWebTouchEventFromMotionEvent( 2066 blink::WebTouchEvent touch_event = CreateWebTouchEventFromMotionEvent(
2067 pointer_state_, event->may_cause_scrolling()); 2067 pointer_state_, event->may_cause_scrolling());
2068 pointer_state_.CleanupRemovedTouchPoints(*event); 2068 pointer_state_.CleanupRemovedTouchPoints(*event);
2069 2069
2070 // Forward the touch event only if a touch point was updated, and 2070 // It is important to always mark events as being handled asynchronously when
2071 // there's a touch-event handler in the page, and no other 2071 // they are forwarded. This ensures that the current event does not get
2072 // touch-event is in the queue. It is important to always mark 2072 // processed by the gesture recognizer before events currently awaiting
2073 // events as being handled asynchronously if there is a touch-event 2073 // dispatch in the touch queue.
2074 // handler in the page, or some touch-event is already in the queue, 2074 event->DisableSynchronousHandling();
2075 // even if no point has been updated. This ensures that this event 2075 host_->ForwardTouchEventWithLatencyInfo(touch_event, *event->latency());
2076 // does not get processed by the gesture recognizer before events
2077 // currently awaiting dispatch in the touch queue.
2078 if (host_->ShouldForwardTouchEvent()) {
2079 event->DisableSynchronousHandling();
2080 host_->ForwardTouchEventWithLatencyInfo(touch_event, *event->latency());
2081 }
2082 } 2076 }
2083 2077
2084 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { 2078 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) {
2085 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent"); 2079 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent");
2086 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || 2080 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN ||
2087 event->type() == ui::ET_GESTURE_PINCH_UPDATE || 2081 event->type() == ui::ET_GESTURE_PINCH_UPDATE ||
2088 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { 2082 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) {
2089 event->SetHandled(); 2083 event->SetHandled();
2090 return; 2084 return;
2091 } 2085 }
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
2679 2673
2680 //////////////////////////////////////////////////////////////////////////////// 2674 ////////////////////////////////////////////////////////////////////////////////
2681 // RenderWidgetHostViewBase, public: 2675 // RenderWidgetHostViewBase, public:
2682 2676
2683 // static 2677 // static
2684 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2678 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2685 GetScreenInfoForWindow(results, NULL); 2679 GetScreenInfoForWindow(results, NULL);
2686 } 2680 }
2687 2681
2688 } // namespace content 2682 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698