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

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

Issue 712133003: Track whether a scroll sequence has been partially prevented (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 } 260 }
261 261
262 void Coalesce(const WebGestureEvent& event_to_coalesce, 262 void Coalesce(const WebGestureEvent& event_to_coalesce,
263 WebGestureEvent* event) { 263 WebGestureEvent* event) {
264 DCHECK(CanCoalesce(event_to_coalesce, *event)); 264 DCHECK(CanCoalesce(event_to_coalesce, *event));
265 if (event->type == WebInputEvent::GestureScrollUpdate) { 265 if (event->type == WebInputEvent::GestureScrollUpdate) {
266 event->data.scrollUpdate.deltaX += 266 event->data.scrollUpdate.deltaX +=
267 event_to_coalesce.data.scrollUpdate.deltaX; 267 event_to_coalesce.data.scrollUpdate.deltaX;
268 event->data.scrollUpdate.deltaY += 268 event->data.scrollUpdate.deltaY +=
269 event_to_coalesce.data.scrollUpdate.deltaY; 269 event_to_coalesce.data.scrollUpdate.deltaY;
270 DCHECK_EQ(
271 event->data.scrollUpdate.previousUpdateInSequencePrevented,
272 event_to_coalesce.data.scrollUpdate.previousUpdateInSequencePrevented);
270 } else if (event->type == WebInputEvent::GesturePinchUpdate) { 273 } else if (event->type == WebInputEvent::GesturePinchUpdate) {
271 event->data.pinchUpdate.scale *= event_to_coalesce.data.pinchUpdate.scale; 274 event->data.pinchUpdate.scale *= event_to_coalesce.data.pinchUpdate.scale;
272 // Ensure the scale remains bounded above 0 and below Infinity so that 275 // Ensure the scale remains bounded above 0 and below Infinity so that
273 // we can reliably perform operations like log on the values. 276 // we can reliably perform operations like log on the values.
274 if (event->data.pinchUpdate.scale < numeric_limits<float>::min()) 277 if (event->data.pinchUpdate.scale < numeric_limits<float>::min())
275 event->data.pinchUpdate.scale = numeric_limits<float>::min(); 278 event->data.pinchUpdate.scale = numeric_limits<float>::min();
276 else if (event->data.pinchUpdate.scale > numeric_limits<float>::max()) 279 else if (event->data.pinchUpdate.scale > numeric_limits<float>::max())
277 event->data.pinchUpdate.scale = numeric_limits<float>::max(); 280 event->data.pinchUpdate.scale = numeric_limits<float>::max();
278 } 281 }
279 } 282 }
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 case WebInputEvent::TouchStart: 478 case WebInputEvent::TouchStart:
476 case WebInputEvent::TouchMove: 479 case WebInputEvent::TouchMove:
477 case WebInputEvent::TouchEnd: 480 case WebInputEvent::TouchEnd:
478 return !static_cast<const WebTouchEvent&>(event).cancelable; 481 return !static_cast<const WebTouchEvent&>(event).cancelable;
479 default: 482 default:
480 return false; 483 return false;
481 } 484 }
482 } 485 }
483 486
484 } // namespace content 487 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698