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

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

Issue 1120293003: Make sure send one WebTouchEvent ack per ui::TouchEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: put in RenderWidgetHostViewAura Created 5 years, 7 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 <set> 7 #include <set>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 } 798 }
799 #endif 799 #endif
800 } 800 }
801 801
802 void RenderWidgetHostViewAura::ParentHierarchyChanged() { 802 void RenderWidgetHostViewAura::ParentHierarchyChanged() {
803 ancestor_window_observer_.reset(new WindowAncestorObserver(this)); 803 ancestor_window_observer_.reset(new WindowAncestorObserver(this));
804 // Snap when we receive a hierarchy changed. http://crbug.com/388908. 804 // Snap when we receive a hierarchy changed. http://crbug.com/388908.
805 HandleParentBoundsChanged(); 805 HandleParentBoundsChanged();
806 } 806 }
807 807
808 void RenderWidgetHostViewAura::SetTouchPointStateStationary(
809 blink::WebTouchEvent* event, int touch_id) {
810 if (event->type == blink::WebInputEvent::TouchMove
811 || event->type == blink::WebInputEvent::TouchCancel) {
tdresser 2015/05/06 11:58:18 Why TouchMove and TouchCancel? Can't this occur wi
jdduke (slow) 2015/05/06 15:23:45 I don't think we will ever generate multiple press
tdresser 2015/05/06 15:28:34 Right, thanks. Do we generate multiple cancel poi
lanwei 2015/05/07 02:37:56 For touchstart and touchend, because motion_event
tdresser 2015/05/07 12:13:06 Acknowledged.
812 size_t index = static_cast<int>(pointer_state_.GetIndexFromId(touch_id));
tdresser 2015/05/06 11:58:18 I'm a bit uneasy about relying on the fact that we
jdduke (slow) 2015/05/06 15:23:45 +1
lanwei 2015/05/07 02:37:56 You are right, index is not safe, I am using touch
813 for (size_t i = 0; i < event->touchesLength; ++i) {
814 if (i != index)
815 event->touches[i].state = blink::WebTouchPoint::StateStationary;
816 }
817 }
818 }
819
808 void RenderWidgetHostViewAura::MovePluginWindows( 820 void RenderWidgetHostViewAura::MovePluginWindows(
809 const std::vector<WebPluginGeometry>& plugin_window_moves) { 821 const std::vector<WebPluginGeometry>& plugin_window_moves) {
810 #if defined(OS_WIN) 822 #if defined(OS_WIN)
811 // We need to clip the rectangle to the tab's viewport, otherwise we will draw 823 // We need to clip the rectangle to the tab's viewport, otherwise we will draw
812 // over the browser UI. 824 // over the browser UI.
813 if (!window_->GetRootWindow()) { 825 if (!window_->GetRootWindow()) {
814 DCHECK(plugin_window_moves.empty()); 826 DCHECK(plugin_window_moves.empty());
815 return; 827 return;
816 } 828 }
817 HWND parent = window_->GetHost()->GetAcceleratedWidget(); 829 HWND parent = window_->GetHost()->GetAcceleratedWidget();
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after
2177 2189
2178 blink::WebTouchEvent touch_event = ui::CreateWebTouchEventFromMotionEvent( 2190 blink::WebTouchEvent touch_event = ui::CreateWebTouchEventFromMotionEvent(
2179 pointer_state_, event->may_cause_scrolling()); 2191 pointer_state_, event->may_cause_scrolling());
2180 pointer_state_.CleanupRemovedTouchPoints(*event); 2192 pointer_state_.CleanupRemovedTouchPoints(*event);
2181 2193
2182 // It is important to always mark events as being handled asynchronously when 2194 // It is important to always mark events as being handled asynchronously when
2183 // they are forwarded. This ensures that the current event does not get 2195 // they are forwarded. This ensures that the current event does not get
2184 // processed by the gesture recognizer before events currently awaiting 2196 // processed by the gesture recognizer before events currently awaiting
2185 // dispatch in the touch queue. 2197 // dispatch in the touch queue.
2186 event->DisableSynchronousHandling(); 2198 event->DisableSynchronousHandling();
2199
2200 // Set unchange touch point to StateStationary for touchmove and
2201 // touchcancel to make sure only send one ack per WebTouchEvent.
2202 SetTouchPointStateStationary(&touch_event, event->touch_id());
2187 host_->ForwardTouchEventWithLatencyInfo(touch_event, *event->latency()); 2203 host_->ForwardTouchEventWithLatencyInfo(touch_event, *event->latency());
2188 } 2204 }
2189 2205
2190 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { 2206 void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) {
2191 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent"); 2207 TRACE_EVENT0("input", "RenderWidgetHostViewAura::OnGestureEvent");
2192 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN || 2208 if ((event->type() == ui::ET_GESTURE_PINCH_BEGIN ||
2193 event->type() == ui::ET_GESTURE_PINCH_UPDATE || 2209 event->type() == ui::ET_GESTURE_PINCH_UPDATE ||
2194 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) { 2210 event->type() == ui::ET_GESTURE_PINCH_END) && !pinch_zoom_enabled_) {
2195 event->SetHandled(); 2211 event->SetHandled();
2196 return; 2212 return;
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
2764 2780
2765 //////////////////////////////////////////////////////////////////////////////// 2781 ////////////////////////////////////////////////////////////////////////////////
2766 // RenderWidgetHostViewBase, public: 2782 // RenderWidgetHostViewBase, public:
2767 2783
2768 // static 2784 // static
2769 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { 2785 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) {
2770 GetScreenInfoForWindow(results, NULL); 2786 GetScreenInfoForWindow(results, NULL);
2771 } 2787 }
2772 2788
2773 } // namespace content 2789 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | ui/events/gestures/motion_event_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698