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

Side by Side Diff: content/browser/renderer_host/input/gesture_event_queue.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: Add pinch coalesce test Created 6 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/input/gesture_event_queue.h" 5 #include "content/browser/renderer_host/input/gesture_event_queue.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "content/browser/renderer_host/input/input_router.h" 10 #include "content/browser/renderer_host/input/input_router.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 278 }
279 279
280 void GestureEventQueue::MergeOrInsertScrollAndPinchEvent( 280 void GestureEventQueue::MergeOrInsertScrollAndPinchEvent(
281 const GestureEventWithLatencyInfo& gesture_event) { 281 const GestureEventWithLatencyInfo& gesture_event) {
282 if (coalesced_gesture_events_.size() <= 1) { 282 if (coalesced_gesture_events_.size() <= 1) {
283 EnqueueEvent(gesture_event); 283 EnqueueEvent(gesture_event);
284 return; 284 return;
285 } 285 }
286 GestureEventWithLatencyInfo* last_event = &coalesced_gesture_events_.back(); 286 GestureEventWithLatencyInfo* last_event = &coalesced_gesture_events_.back();
287 if (last_event->CanCoalesceWith(gesture_event)) { 287 if (last_event->CanCoalesceWith(gesture_event)) {
288 last_event->CoalesceWith(gesture_event); 288 last_event->CoalesceWith(gesture_event);
289 if (!combined_scroll_pinch_.IsIdentity()) { 289 if (!combined_scroll_pinch_.IsIdentity()) {
290 combined_scroll_pinch_.ConcatTransform( 290 combined_scroll_pinch_.ConcatTransform(
291 GetTransformForEvent(gesture_event)); 291 GetTransformForEvent(gesture_event));
292 } 292 }
293 return; 293 return;
294 } 294 }
295 if (coalesced_gesture_events_.size() == 2 || 295 if (coalesced_gesture_events_.size() == 2 ||
296 (coalesced_gesture_events_.size() == 3 && ignore_next_ack_) || 296 (coalesced_gesture_events_.size() == 3 && ignore_next_ack_) ||
297 !ShouldTryMerging(gesture_event, *last_event)) { 297 !ShouldTryMerging(gesture_event, *last_event)) {
298 EnqueueEvent(gesture_event); 298 EnqueueEvent(gesture_event);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 379
380 void GestureEventQueue::EnqueueEvent( 380 void GestureEventQueue::EnqueueEvent(
381 const GestureEventWithLatencyInfo& gesture_event) { 381 const GestureEventWithLatencyInfo& gesture_event) {
382 coalesced_gesture_events_.push_back(gesture_event); 382 coalesced_gesture_events_.push_back(gesture_event);
383 // Scroll and pinch events contributing to |combined_scroll_pinch_| will be 383 // Scroll and pinch events contributing to |combined_scroll_pinch_| will be
384 // manually added to the queue in |MergeOrInsertScrollAndPinchEvent()|. 384 // manually added to the queue in |MergeOrInsertScrollAndPinchEvent()|.
385 combined_scroll_pinch_ = gfx::Transform(); 385 combined_scroll_pinch_ = gfx::Transform();
386 } 386 }
387 387
388 } // namespace content 388 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/common/input/web_input_event_traits.cc » ('j') | content/common/input/web_input_event_traits.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698