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

Side by Side Diff: content/common/input/web_input_event_traits.cc

Issue 718153002: Indicate whether a touch event will cause scrolling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « content/browser/renderer_host/ui_events_helper.cc ('k') | ui/aura/window_event_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/common/input/web_input_event_traits.h" 5 #include "content/common/input/web_input_event_traits.h"
6 6
7 #include <bitset> 7 #include <bitset>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 // correct state, i.e. the touch-points that moved in the last event, but 228 // correct state, i.e. the touch-points that moved in the last event, but
229 // didn't change in the current event, will have Stationary state. It is 229 // didn't change in the current event, will have Stationary state. It is
230 // necessary to change them back to Moved state. 230 // necessary to change them back to Moved state.
231 WebTouchEvent old_event = *event; 231 WebTouchEvent old_event = *event;
232 *event = event_to_coalesce; 232 *event = event_to_coalesce;
233 for (unsigned i = 0; i < event->touchesLength; ++i) { 233 for (unsigned i = 0; i < event->touchesLength; ++i) {
234 int i_old = GetIndexOfTouchID(old_event, event->touches[i].id); 234 int i_old = GetIndexOfTouchID(old_event, event->touches[i].id);
235 if (old_event.touches[i_old].state == blink::WebTouchPoint::StateMoved) 235 if (old_event.touches[i_old].state == blink::WebTouchPoint::StateMoved)
236 event->touches[i].state = blink::WebTouchPoint::StateMoved; 236 event->touches[i].state = blink::WebTouchPoint::StateMoved;
237 } 237 }
238 event->causesScrollingIfUncanceled |=
239 old_event.causesScrollingIfUncanceled;
238 } 240 }
239 241
240 bool CanCoalesce(const WebGestureEvent& event_to_coalesce, 242 bool CanCoalesce(const WebGestureEvent& event_to_coalesce,
241 const WebGestureEvent& event) { 243 const WebGestureEvent& event) {
242 if (event.type != event_to_coalesce.type || 244 if (event.type != event_to_coalesce.type ||
243 event.sourceDevice != event_to_coalesce.sourceDevice || 245 event.sourceDevice != event_to_coalesce.sourceDevice ||
244 event.modifiers != event_to_coalesce.modifiers) 246 event.modifiers != event_to_coalesce.modifiers)
245 return false; 247 return false;
246 248
247 if (event.type == WebInputEvent::GestureScrollUpdate) 249 if (event.type == WebInputEvent::GestureScrollUpdate)
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 case WebInputEvent::TouchStart: 475 case WebInputEvent::TouchStart:
474 case WebInputEvent::TouchMove: 476 case WebInputEvent::TouchMove:
475 case WebInputEvent::TouchEnd: 477 case WebInputEvent::TouchEnd:
476 return !static_cast<const WebTouchEvent&>(event).cancelable; 478 return !static_cast<const WebTouchEvent&>(event).cancelable;
477 default: 479 default:
478 return false; 480 return false;
479 } 481 }
480 } 482 }
481 483
482 } // namespace content 484 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/ui_events_helper.cc ('k') | ui/aura/window_event_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698