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

Unified Diff: content/common/input/web_input_event_traits.cc

Issue 200623003: Adopt "QuickScale" double-tap drag zoom code in the GestureProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment Created 6 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 side-by-side diff with in-line comments
Download patch
Index: content/common/input/web_input_event_traits.cc
diff --git a/content/common/input/web_input_event_traits.cc b/content/common/input/web_input_event_traits.cc
index fb34d9e282f3eb1627114af112ab9749e15a4e07..85c2d77f60d9094671a9cc5304fef34a57934d1a 100644
--- a/content/common/input/web_input_event_traits.cc
+++ b/content/common/input/web_input_event_traits.cc
@@ -145,17 +145,33 @@ void Coalesce(const WebTouchEvent& event_to_coalesce, WebTouchEvent* event) {
bool CanCoalesce(const WebGestureEvent& event_to_coalesce,
const WebGestureEvent& event) {
- return event.type == event_to_coalesce.type &&
- event.type == WebInputEvent::GestureScrollUpdate &&
- event.sourceDevice == event_to_coalesce.sourceDevice &&
- event.modifiers == event_to_coalesce.modifiers;
+ if (event.type != event_to_coalesce.type ||
+ event.sourceDevice != event_to_coalesce.sourceDevice ||
+ event.modifiers != event_to_coalesce.modifiers)
+ return false;
+
+ if (event.type == WebInputEvent::GestureScrollUpdate)
+ return true;
+
+ if (event.type == WebInputEvent::GesturePinchUpdate &&
tdresser 2014/04/03 17:53:30 Can you add a comment explaining why the co-ordina
jdduke (slow) 2014/04/03 19:28:01 Done.
+ event.x == event_to_coalesce.x &&
+ event.y == event_to_coalesce.y)
+ return true;
+
+ return false;
}
void Coalesce(const WebGestureEvent& event_to_coalesce,
WebGestureEvent* event) {
DCHECK(CanCoalesce(event_to_coalesce, *event));
- event->data.scrollUpdate.deltaX += event_to_coalesce.data.scrollUpdate.deltaX;
- event->data.scrollUpdate.deltaY += event_to_coalesce.data.scrollUpdate.deltaY;
+ if (event->type == WebInputEvent::GestureScrollUpdate) {
+ event->data.scrollUpdate.deltaX +=
+ event_to_coalesce.data.scrollUpdate.deltaX;
+ event->data.scrollUpdate.deltaY +=
+ event_to_coalesce.data.scrollUpdate.deltaY;
+ } else if (event->type == WebInputEvent::GesturePinchUpdate) {
+ event->data.pinchUpdate.scale *= event_to_coalesce.data.pinchUpdate.scale;
+ }
}
struct WebInputEventSize {

Powered by Google App Engine
This is Rietveld 408576698