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

Side by Side Diff: ui/events/blink/blink_event_util.cc

Issue 2723023005: Make sure resent events that don't match ids are not coalesced. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | ui/events/blink/blink_event_util_unittest.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 // MSVC++ requires this to be set before any other includes to get M_PI. 5 // MSVC++ requires this to be set before any other includes to get M_PI.
6 #define _USE_MATH_DEFINES 6 #define _USE_MATH_DEFINES
7 7
8 #include "ui/events/blink/blink_event_util.h" 8 #include "ui/events/blink/blink_event_util.h"
9 9
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 event->movementX += x; 254 event->movementX += x;
255 event->movementY += y; 255 event->movementY += y;
256 } 256 }
257 257
258 bool CanCoalesce(const WebMouseWheelEvent& event_to_coalesce, 258 bool CanCoalesce(const WebMouseWheelEvent& event_to_coalesce,
259 const WebMouseWheelEvent& event) { 259 const WebMouseWheelEvent& event) {
260 return event.modifiers() == event_to_coalesce.modifiers() && 260 return event.modifiers() == event_to_coalesce.modifiers() &&
261 event.scrollByPage == event_to_coalesce.scrollByPage && 261 event.scrollByPage == event_to_coalesce.scrollByPage &&
262 event.phase == event_to_coalesce.phase && 262 event.phase == event_to_coalesce.phase &&
263 event.momentumPhase == event_to_coalesce.momentumPhase && 263 event.momentumPhase == event_to_coalesce.momentumPhase &&
264 event.resendingPluginId == event_to_coalesce.resendingPluginId &&
264 event.hasPreciseScrollingDeltas == 265 event.hasPreciseScrollingDeltas ==
265 event_to_coalesce.hasPreciseScrollingDeltas; 266 event_to_coalesce.hasPreciseScrollingDeltas;
266 } 267 }
267 268
268 void Coalesce(const WebMouseWheelEvent& event_to_coalesce, 269 void Coalesce(const WebMouseWheelEvent& event_to_coalesce,
269 WebMouseWheelEvent* event) { 270 WebMouseWheelEvent* event) {
270 DCHECK(CanCoalesce(event_to_coalesce, *event)); 271 DCHECK(CanCoalesce(event_to_coalesce, *event));
271 float unaccelerated_x = 272 float unaccelerated_x =
272 GetUnacceleratedDelta(event->deltaX, event->accelerationRatioX) + 273 GetUnacceleratedDelta(event->deltaX, event->accelerationRatioX) +
273 GetUnacceleratedDelta(event_to_coalesce.deltaX, 274 GetUnacceleratedDelta(event_to_coalesce.deltaX,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 341 }
341 } 342 }
342 event->movedBeyondSlopRegion |= old_event.movedBeyondSlopRegion; 343 event->movedBeyondSlopRegion |= old_event.movedBeyondSlopRegion;
343 event->dispatchType = MergeDispatchTypes(old_event.dispatchType, 344 event->dispatchType = MergeDispatchTypes(old_event.dispatchType,
344 event_to_coalesce.dispatchType); 345 event_to_coalesce.dispatchType);
345 } 346 }
346 347
347 bool CanCoalesce(const WebGestureEvent& event_to_coalesce, 348 bool CanCoalesce(const WebGestureEvent& event_to_coalesce,
348 const WebGestureEvent& event) { 349 const WebGestureEvent& event) {
349 if (event.type() != event_to_coalesce.type() || 350 if (event.type() != event_to_coalesce.type() ||
351 event.resendingPluginId != event_to_coalesce.resendingPluginId ||
350 event.sourceDevice != event_to_coalesce.sourceDevice || 352 event.sourceDevice != event_to_coalesce.sourceDevice ||
351 event.modifiers() != event_to_coalesce.modifiers()) 353 event.modifiers() != event_to_coalesce.modifiers())
352 return false; 354 return false;
353 355
354 if (event.type() == WebInputEvent::GestureScrollUpdate) 356 if (event.type() == WebInputEvent::GestureScrollUpdate)
355 return true; 357 return true;
356 358
357 // GesturePinchUpdate scales can be combined only if they share a focal point, 359 // GesturePinchUpdate scales can be combined only if they share a focal point,
358 // e.g., with double-tap drag zoom. 360 // e.g., with double-tap drag zoom.
359 if (event.type() == WebInputEvent::GesturePinchUpdate && 361 if (event.type() == WebInputEvent::GesturePinchUpdate &&
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 switch (type) { 980 switch (type) {
979 case blink::WebGestureEvent::GestureScrollUpdate: 981 case blink::WebGestureEvent::GestureScrollUpdate:
980 case blink::WebGestureEvent::GesturePinchUpdate: 982 case blink::WebGestureEvent::GesturePinchUpdate:
981 return true; 983 return true;
982 default: 984 default:
983 return false; 985 return false;
984 } 986 }
985 } 987 }
986 988
987 } // namespace ui 989 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/events/blink/blink_event_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698