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

Side by Side Diff: content/browser/renderer_host/input/touch_event_queue.cc

Issue 844983004: Support transitioning between platform scrolling and JS pinching (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | content/browser/renderer_host/input/touch_event_queue_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 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/browser/renderer_host/input/touch_event_queue.h" 5 #include "content/browser/renderer_host/input/touch_event_queue.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/browser/renderer_host/input/timeout_monitor.h" 10 #include "content/browser/renderer_host/input/timeout_monitor.h"
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 } else { 513 } else {
514 scoped_ptr<TouchEventWithLatencyInfo> async_move = 514 scoped_ptr<TouchEventWithLatencyInfo> async_move =
515 pending_async_touchmove_.Pass(); 515 pending_async_touchmove_.Pass();
516 async_move->event.cancelable = false; 516 async_move->event.cancelable = false;
517 touch_queue_.push_front(new CoalescedWebTouchEvent(*async_move, true)); 517 touch_queue_.push_front(new CoalescedWebTouchEvent(*async_move, true));
518 SendTouchEventImmediately(*async_move); 518 SendTouchEventImmediately(*async_move);
519 return; 519 return;
520 } 520 }
521 } 521 }
522 522
523 // Note: Marking touchstart events as not-cancelable prevents them from 523 // Note: Touchstart events are marked cancelable to allow transitions between
524 // blocking subsequent gestures, but it may not be the best long term solution 524 // platform scrolling and JS pinching. Touchend events, however, remain
525 // for tracking touch point dispatch. 525 // uncancelable, mitigating the risk of jank when transitioning to a fling.
526 if (send_touch_events_async_) 526 if (send_touch_events_async_ && touch.event.type != WebInputEvent::TouchStart)
527 touch.event.cancelable = false; 527 touch.event.cancelable = false;
528 528
529 // A synchronous ack will reset |dispatching_touch_|, in which case 529 // A synchronous ack will reset |dispatching_touch_|, in which case
530 // the touch timeout should not be started. 530 // the touch timeout should not be started.
531 base::AutoReset<bool> dispatching_touch(&dispatching_touch_, true); 531 base::AutoReset<bool> dispatching_touch(&dispatching_touch_, true);
532 SendTouchEventImmediately(touch); 532 SendTouchEventImmediately(touch);
533 if (dispatching_touch_ && timeout_handler_) 533 if (dispatching_touch_ && timeout_handler_)
534 timeout_handler_->StartIfNecessary(touch); 534 timeout_handler_->StartIfNecessary(touch);
535 } 535 }
536 536
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 if (event.type == WebInputEvent::TouchEnd || 754 if (event.type == WebInputEvent::TouchEnd ||
755 event.type == WebInputEvent::TouchCancel) { 755 event.type == WebInputEvent::TouchCancel) {
756 // The points have been released. Erase the ACK states. 756 // The points have been released. Erase the ACK states.
757 for (unsigned i = 0; i < event.touchesLength; ++i) { 757 for (unsigned i = 0; i < event.touchesLength; ++i) {
758 const WebTouchPoint& point = event.touches[i]; 758 const WebTouchPoint& point = event.touches[i];
759 if (point.state == WebTouchPoint::StateReleased || 759 if (point.state == WebTouchPoint::StateReleased ||
760 point.state == WebTouchPoint::StateCancelled) 760 point.state == WebTouchPoint::StateCancelled)
761 touch_consumer_states_.clear_bit(point.id); 761 touch_consumer_states_.clear_bit(point.id);
762 } 762 }
763 } else if (event.type == WebInputEvent::TouchStart) { 763 } else if (event.type == WebInputEvent::TouchStart) {
764 if (touch_scrolling_mode_ == TOUCH_SCROLLING_MODE_ASYNC_TOUCHMOVE &&
765 ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) {
766 send_touch_events_async_ = false;
767 }
764 for (unsigned i = 0; i < event.touchesLength; ++i) { 768 for (unsigned i = 0; i < event.touchesLength; ++i) {
765 const WebTouchPoint& point = event.touches[i]; 769 const WebTouchPoint& point = event.touches[i];
766 if (point.state == WebTouchPoint::StatePressed) { 770 if (point.state == WebTouchPoint::StatePressed) {
767 if (ack_result != INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS) 771 if (ack_result != INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS)
768 touch_consumer_states_.mark_bit(point.id); 772 touch_consumer_states_.mark_bit(point.id);
769 else 773 else
770 touch_consumer_states_.clear_bit(point.id); 774 touch_consumer_states_.clear_bit(point.id);
771 } 775 }
772 } 776 }
773 } 777 }
774 } 778 }
775 779
776 } // namespace content 780 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/input/touch_event_queue_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698