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

Side by Side Diff: ui/events/gesture_detection/gesture_provider.cc

Issue 212663010: Store the id of a contributing motion event in GestureEventData (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Store motion_event_id, not touch_id. 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 | Annotate | Revision Log
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 "ui/events/gesture_detection/gesture_provider.h" 5 #include "ui/events/gesture_detection/gesture_provider.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 13 matching lines...) Expand all
24 case MotionEvent::ACTION_POINTER_UP: return "ACTION_POINTER_UP"; 24 case MotionEvent::ACTION_POINTER_UP: return "ACTION_POINTER_UP";
25 case MotionEvent::ACTION_DOWN: return "ACTION_DOWN"; 25 case MotionEvent::ACTION_DOWN: return "ACTION_DOWN";
26 case MotionEvent::ACTION_UP: return "ACTION_UP"; 26 case MotionEvent::ACTION_UP: return "ACTION_UP";
27 case MotionEvent::ACTION_CANCEL: return "ACTION_CANCEL"; 27 case MotionEvent::ACTION_CANCEL: return "ACTION_CANCEL";
28 case MotionEvent::ACTION_MOVE: return "ACTION_MOVE"; 28 case MotionEvent::ACTION_MOVE: return "ACTION_MOVE";
29 } 29 }
30 return ""; 30 return "";
31 } 31 }
32 32
33 GestureEventData CreateGesture(EventType type, 33 GestureEventData CreateGesture(EventType type,
34 int motion_event_id,
34 base::TimeTicks time, 35 base::TimeTicks time,
35 float x, 36 float x,
36 float y, 37 float y,
37 const GestureEventDetails& details) { 38 const GestureEventDetails& details) {
38 return GestureEventData(type, time, x, y, details); 39 return GestureEventData(type, motion_event_id, time, x, y, details);
39 } 40 }
40 41
41 GestureEventData CreateGesture(EventType type, 42 GestureEventData CreateGesture(EventType type,
43 int motion_event_id,
42 base::TimeTicks time, 44 base::TimeTicks time,
43 float x, 45 float x,
44 float y) { 46 float y) {
45 return GestureEventData(type, time, x, y); 47 return GestureEventData(type, motion_event_id, time, x, y);
46 } 48 }
47 49
48 GestureEventData CreateGesture(EventType type, 50 GestureEventData CreateGesture(EventType type,
49 const MotionEvent& event, 51 const MotionEvent& event,
50 const GestureEventDetails& details) { 52 const GestureEventDetails& details) {
51 return CreateGesture( 53 return GestureEventData(type,
52 type, event.GetEventTime(), event.GetX(), event.GetY(), details); 54 event.GetId(),
55 event.GetEventTime(),
56 event.GetX(),
57 event.GetY(),
58 details);
53 } 59 }
54 60
55 GestureEventData CreateGesture(EventType type, 61 GestureEventData CreateGesture(EventType type,
56 const MotionEvent& event) { 62 const MotionEvent& event) {
57 return CreateGesture(type, event.GetEventTime(), event.GetX(), event.GetY()); 63 return CreateGesture(type,
64 event.GetId(),
65 event.GetEventTime(),
66 event.GetX(),
67 event.GetY());
58 } 68 }
59 69
60 float Round(float f) { 70 float Round(float f) {
61 return (f > 0.f) ? std::floor(f + 0.5f) : std::ceil(f - 0.5f); 71 return (f > 0.f) ? std::floor(f + 0.5f) : std::ceil(f - 0.5f);
62 } 72 }
63 73
64 GestureEventDetails CreateTapGestureDetails(EventType type, 74 GestureEventDetails CreateTapGestureDetails(EventType type,
65 const MotionEvent& event) { 75 const MotionEvent& event) {
66 // Set the tap count to 1 even for ET_GESTURE_DOUBLE_TAP, in order to be 76 // Set the tap count to 1 even for ET_GESTURE_DOUBLE_TAP, in order to be
67 // consistent with double tap behavior on a mobile viewport. See 77 // consistent with double tap behavior on a mobile viewport. See
(...skipping 30 matching lines...) Expand all
98 bool handled = scale_gesture_detector_.OnTouchEvent(event); 108 bool handled = scale_gesture_detector_.OnTouchEvent(event);
99 if (!in_scale_gesture && 109 if (!in_scale_gesture &&
100 (event.GetAction() == MotionEvent::ACTION_UP || 110 (event.GetAction() == MotionEvent::ACTION_UP ||
101 event.GetAction() == MotionEvent::ACTION_CANCEL)) { 111 event.GetAction() == MotionEvent::ACTION_CANCEL)) {
102 return false; 112 return false;
103 } 113 }
104 return handled; 114 return handled;
105 } 115 }
106 116
107 // ScaleGestureDetector::ScaleGestureListener implementation. 117 // ScaleGestureDetector::ScaleGestureListener implementation.
108 virtual bool OnScaleBegin(const ScaleGestureDetector& detector) OVERRIDE { 118 virtual bool OnScaleBegin(const ScaleGestureDetector& detector,
119 const MotionEvent& e) OVERRIDE {
109 if (ignore_detector_events_) 120 if (ignore_detector_events_)
110 return false; 121 return false;
111 pinch_event_sent_ = false; 122 pinch_event_sent_ = false;
112 return true; 123 return true;
113 } 124 }
114 125
115 virtual void OnScaleEnd(const ScaleGestureDetector& detector) OVERRIDE { 126 virtual void OnScaleEnd(const ScaleGestureDetector& detector,
127 const MotionEvent& e) OVERRIDE {
116 if (!pinch_event_sent_) 128 if (!pinch_event_sent_)
117 return; 129 return;
118 provider_->Send( 130 provider_->Send(CreateGesture(ET_GESTURE_PINCH_END,
119 CreateGesture(ET_GESTURE_PINCH_END, detector.GetEventTime(), 0, 0)); 131 e.GetId(),
132 detector.GetEventTime(),
133 0,
134 0));
120 pinch_event_sent_ = false; 135 pinch_event_sent_ = false;
121 } 136 }
122 137
123 virtual bool OnScale(const ScaleGestureDetector& detector) OVERRIDE { 138 virtual bool OnScale(const ScaleGestureDetector& detector,
139 const MotionEvent& e) OVERRIDE {
124 if (ignore_detector_events_) 140 if (ignore_detector_events_)
125 return false; 141 return false;
126 if (!pinch_event_sent_) { 142 if (!pinch_event_sent_) {
127 pinch_event_sent_ = true; 143 pinch_event_sent_ = true;
128 provider_->Send(CreateGesture(ET_GESTURE_PINCH_BEGIN, 144 provider_->Send(CreateGesture(ET_GESTURE_PINCH_BEGIN,
145 e.GetId(),
129 detector.GetEventTime(), 146 detector.GetEventTime(),
130 detector.GetFocusX(), 147 detector.GetFocusX(),
131 detector.GetFocusY())); 148 detector.GetFocusY()));
132 } 149 }
133 GestureEventDetails pinch_details( 150 GestureEventDetails pinch_details(
134 ET_GESTURE_PINCH_UPDATE, detector.GetScaleFactor(), 0); 151 ET_GESTURE_PINCH_UPDATE, detector.GetScaleFactor(), 0);
135 provider_->Send(CreateGesture(ET_GESTURE_PINCH_UPDATE, 152 provider_->Send(CreateGesture(ET_GESTURE_PINCH_UPDATE,
153 e.GetId(),
136 detector.GetEventTime(), 154 detector.GetEventTime(),
137 detector.GetFocusX(), 155 detector.GetFocusX(),
138 detector.GetFocusY(), 156 detector.GetFocusY(),
139 pinch_details)); 157 pinch_details));
140 return true; 158 return true;
141 } 159 }
142 160
143 bool IsScaleGestureDetectionInProgress() const { 161 bool IsScaleGestureDetectionInProgress() const {
144 return !ignore_detector_events_ && scale_gesture_detector_.IsInProgress(); 162 return !ignore_detector_events_ && scale_gesture_detector_.IsInProgress();
145 } 163 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 } 286 }
269 287
270 last_raw_x_ = e2.GetRawX(); 288 last_raw_x_ = e2.GetRawX();
271 last_raw_y_ = e2.GetRawY(); 289 last_raw_y_ = e2.GetRawY();
272 if (!provider_->IsScrollInProgress()) { 290 if (!provider_->IsScrollInProgress()) {
273 // Note that scroll start hints are in distance traveled, where 291 // Note that scroll start hints are in distance traveled, where
274 // scroll deltas are in the opposite direction. 292 // scroll deltas are in the opposite direction.
275 GestureEventDetails scroll_details( 293 GestureEventDetails scroll_details(
276 ET_GESTURE_SCROLL_BEGIN, -raw_distance_x, -raw_distance_y); 294 ET_GESTURE_SCROLL_BEGIN, -raw_distance_x, -raw_distance_y);
277 provider_->Send(CreateGesture(ET_GESTURE_SCROLL_BEGIN, 295 provider_->Send(CreateGesture(ET_GESTURE_SCROLL_BEGIN,
296 e1.GetId(),
jdduke (slow) 2014/04/02 18:33:12 Hmm... e1 is the ACTION_DOWN, don't we want the id
tdresser 2014/04/03 14:01:23 There were a couple other similar issues - my init
278 e2.GetEventTime(), 297 e2.GetEventTime(),
279 e1.GetX(), 298 e1.GetX(),
280 e1.GetY(), 299 e1.GetY(),
281 scroll_details)); 300 scroll_details));
282 } 301 }
283 302
284 // distance_x and distance_y is the scrolling offset since last OnScroll. 303 // distance_x and distance_y is the scrolling offset since last OnScroll.
285 // Because we are passing integers to Blink, this could introduce 304 // Because we are passing integers to Blink, this could introduce
286 // rounding errors. The rounding errors will accumulate overtime. 305 // rounding errors. The rounding errors will accumulate overtime.
287 // To solve this, we should be adding back the rounding errors each time 306 // To solve this, we should be adding back the rounding errors each time
(...skipping 19 matching lines...) Expand all
307 float velocity_x, 326 float velocity_x,
308 float velocity_y) OVERRIDE { 327 float velocity_y) OVERRIDE {
309 if (snap_scroll_controller_.IsSnappingScrolls()) { 328 if (snap_scroll_controller_.IsSnappingScrolls()) {
310 if (snap_scroll_controller_.IsSnapHorizontal()) { 329 if (snap_scroll_controller_.IsSnapHorizontal()) {
311 velocity_y = 0; 330 velocity_y = 0;
312 } else { 331 } else {
313 velocity_x = 0; 332 velocity_x = 0;
314 } 333 }
315 } 334 }
316 335
317 provider_->Fling( 336 provider_->Fling(e2.GetEventTime(),
318 e2.GetEventTime(), e1.GetX(), e1.GetY(), velocity_x, velocity_y); 337 e1.GetId(),
jdduke (slow) 2014/04/02 18:33:12 Hmm, I think we want e2.getId() on the fling (the
tdresser 2014/04/03 14:01:23 Done.
338 e1.GetX(),
339 e1.GetY(),
340 velocity_x,
341 velocity_y);
319 return true; 342 return true;
320 } 343 }
321 344
322 virtual void OnShowPress(const MotionEvent& e) OVERRIDE { 345 virtual void OnShowPress(const MotionEvent& e) OVERRIDE {
323 GestureEventDetails show_press_details(ET_GESTURE_SHOW_PRESS, 0, 0); 346 GestureEventDetails show_press_details(ET_GESTURE_SHOW_PRESS, 0, 0);
324 // TODO(jdduke): Expose minor axis length and rotation in |MotionEvent|. 347 // TODO(jdduke): Expose minor axis length and rotation in |MotionEvent|.
325 show_press_details.set_bounding_box( 348 show_press_details.set_bounding_box(
326 gfx::RectF(e.GetTouchMajor(), e.GetTouchMajor())); 349 gfx::RectF(e.GetTouchMajor(), e.GetTouchMajor()));
327 provider_->Send( 350 provider_->Send(
328 CreateGesture(ET_GESTURE_SHOW_PRESS, e, show_press_details)); 351 CreateGesture(ET_GESTURE_SHOW_PRESS, e, show_press_details));
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 case MotionEvent::ACTION_MOVE: 419 case MotionEvent::ACTION_MOVE:
397 if (double_tap_mode_ == DOUBLE_TAP_MODE_DRAG_DETECTION_IN_PROGRESS) { 420 if (double_tap_mode_ == DOUBLE_TAP_MODE_DRAG_DETECTION_IN_PROGRESS) {
398 float distance_x = double_tap_drag_zoom_anchor_x_ - e.GetX(); 421 float distance_x = double_tap_drag_zoom_anchor_x_ - e.GetX();
399 float distance_y = double_tap_drag_zoom_anchor_y_ - e.GetY(); 422 float distance_y = double_tap_drag_zoom_anchor_y_ - e.GetY();
400 423
401 // Begin double-tap drag zoom mode if the move distance is 424 // Begin double-tap drag zoom mode if the move distance is
402 // further than the threshold. 425 // further than the threshold.
403 if (IsDistanceGreaterThanTouchSlop(distance_x, distance_y)) { 426 if (IsDistanceGreaterThanTouchSlop(distance_x, distance_y)) {
404 GestureEventDetails scroll_details( 427 GestureEventDetails scroll_details(
405 ET_GESTURE_SCROLL_BEGIN, -distance_x, -distance_y); 428 ET_GESTURE_SCROLL_BEGIN, -distance_x, -distance_y);
406 provider_->Send( 429 provider_->Send(CreateGesture(
407 CreateGesture(ET_GESTURE_SCROLL_BEGIN, e, scroll_details)); 430 ET_GESTURE_SCROLL_BEGIN, e, scroll_details));
408 provider_->Send( 431 provider_->Send(
409 CreateGesture(ET_GESTURE_PINCH_BEGIN, 432 CreateGesture(ET_GESTURE_PINCH_BEGIN,
433 e.GetId(),
410 e.GetEventTime(), 434 e.GetEventTime(),
411 Round(double_tap_drag_zoom_anchor_x_), 435 Round(double_tap_drag_zoom_anchor_x_),
412 Round(double_tap_drag_zoom_anchor_y_))); 436 Round(double_tap_drag_zoom_anchor_y_)));
413 double_tap_mode_ = DOUBLE_TAP_MODE_DRAG_ZOOM; 437 double_tap_mode_ = DOUBLE_TAP_MODE_DRAG_ZOOM;
414 } 438 }
415 } else if (double_tap_mode_ == DOUBLE_TAP_MODE_DRAG_ZOOM) { 439 } else if (double_tap_mode_ == DOUBLE_TAP_MODE_DRAG_ZOOM) {
416 provider_->Send(CreateGesture(ET_GESTURE_SCROLL_UPDATE, e)); 440 provider_->Send(CreateGesture(ET_GESTURE_SCROLL_UPDATE, e));
417 441
418 float dy = double_tap_y_ - e.GetY(); 442 float dy = double_tap_y_ - e.GetY();
419 float scale = std::pow(dy > 0 ? 1.0f - kDoubleTapDragZoomSpeed 443 float scale = std::pow(dy > 0 ? 1.0f - kDoubleTapDragZoomSpeed
420 : 1.0f + kDoubleTapDragZoomSpeed, 444 : 1.0f + kDoubleTapDragZoomSpeed,
421 std::abs(dy * px_to_dp_)); 445 std::abs(dy * px_to_dp_));
422 GestureEventDetails pinch_details(ET_GESTURE_PINCH_UPDATE, scale, 0); 446 GestureEventDetails pinch_details(ET_GESTURE_PINCH_UPDATE, scale, 0);
423 provider_->Send(CreateGesture(ET_GESTURE_PINCH_UPDATE, 447 provider_->Send(CreateGesture(ET_GESTURE_PINCH_UPDATE,
448 e.GetId(),
424 e.GetEventTime(), 449 e.GetEventTime(),
425 Round(double_tap_drag_zoom_anchor_x_), 450 Round(double_tap_drag_zoom_anchor_x_),
426 Round(double_tap_drag_zoom_anchor_y_), 451 Round(double_tap_drag_zoom_anchor_y_),
427 pinch_details)); 452 pinch_details));
428 } 453 }
429 break; 454 break;
430 case MotionEvent::ACTION_UP: 455 case MotionEvent::ACTION_UP:
431 if (double_tap_mode_ != DOUBLE_TAP_MODE_DRAG_ZOOM) { 456 if (double_tap_mode_ != DOUBLE_TAP_MODE_DRAG_ZOOM) {
432 // Normal double-tap gesture. 457 // Normal double-tap gesture.
433 provider_->Send( 458 provider_->Send(
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 } 655 }
631 656
632 bool handled = gesture_listener_->OnTouchEvent(event, in_scale_gesture); 657 bool handled = gesture_listener_->OnTouchEvent(event, in_scale_gesture);
633 handled |= scale_gesture_listener_->OnTouchEvent(event); 658 handled |= scale_gesture_listener_->OnTouchEvent(event);
634 659
635 if (event.GetAction() == MotionEvent::ACTION_UP || 660 if (event.GetAction() == MotionEvent::ACTION_UP ||
636 event.GetAction() == MotionEvent::ACTION_CANCEL) { 661 event.GetAction() == MotionEvent::ACTION_CANCEL) {
637 // "Last finger raised" could be an end to movement, but it should 662 // "Last finger raised" could be an end to movement, but it should
638 // only terminate scrolling if the event did not cause a fling. 663 // only terminate scrolling if the event did not cause a fling.
639 if (was_touch_scrolling_ && !handled) 664 if (was_touch_scrolling_ && !handled)
640 EndTouchScrollIfNecessary(event.GetEventTime(), true); 665 EndTouchScrollIfNecessary(event.GetEventTime(), event.GetId(), true);
641 666
642 // We shouldn't necessarily cancel a tap on ACTION_UP, as the double-tap 667 // We shouldn't necessarily cancel a tap on ACTION_UP, as the double-tap
643 // timeout may yet trigger a SINGLE_TAP. 668 // timeout may yet trigger a SINGLE_TAP.
644 if (event.GetAction() == MotionEvent::ACTION_CANCEL) 669 if (event.GetAction() == MotionEvent::ACTION_CANCEL)
645 SendTapCancelIfNecessary(event); 670 SendTapCancelIfNecessary(event);
646 671
647 current_down_event_.reset(); 672 current_down_event_.reset();
648 } 673 }
649 674
650 return true; 675 return true;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 721
697 scale_gesture_listener_.reset( 722 scale_gesture_listener_.reset(
698 new ScaleGestureListenerImpl(config.scale_gesture_detector_config, this)); 723 new ScaleGestureListenerImpl(config.scale_gesture_detector_config, this));
699 } 724 }
700 725
701 bool GestureProvider::CanHandle(const MotionEvent& event) const { 726 bool GestureProvider::CanHandle(const MotionEvent& event) const {
702 return event.GetAction() == MotionEvent::ACTION_DOWN || current_down_event_; 727 return event.GetAction() == MotionEvent::ACTION_DOWN || current_down_event_;
703 } 728 }
704 729
705 void GestureProvider::Fling(base::TimeTicks time, 730 void GestureProvider::Fling(base::TimeTicks time,
731 int motion_event_id,
706 float x, 732 float x,
707 float y, 733 float y,
708 float velocity_x, 734 float velocity_x,
709 float velocity_y) { 735 float velocity_y) {
710 if (!velocity_x && !velocity_y) { 736 if (!velocity_x && !velocity_y) {
711 EndTouchScrollIfNecessary(time, true); 737 EndTouchScrollIfNecessary(time, motion_event_id, true);
712 return; 738 return;
713 } 739 }
714 740
715 if (!touch_scroll_in_progress_) { 741 if (!touch_scroll_in_progress_) {
716 // The native side needs a ET_GESTURE_SCROLL_BEGIN before 742 // The native side needs a ET_GESTURE_SCROLL_BEGIN before
717 // ET_SCROLL_FLING_START to send the fling to the correct target. Send if it 743 // ET_SCROLL_FLING_START to send the fling to the correct target. Send if it
718 // has not sent. The distance traveled in one second is a reasonable scroll 744 // has not sent. The distance traveled in one second is a reasonable scroll
719 // start hint. 745 // start hint.
720 GestureEventDetails scroll_details( 746 GestureEventDetails scroll_details(
721 ET_GESTURE_SCROLL_BEGIN, velocity_x, velocity_y); 747 ET_GESTURE_SCROLL_BEGIN, velocity_x, velocity_y);
722 Send(CreateGesture(ET_GESTURE_SCROLL_BEGIN, time, x, y, scroll_details)); 748 Send(CreateGesture(
749 ET_GESTURE_SCROLL_BEGIN, motion_event_id, time, x, y, scroll_details));
723 } 750 }
724 EndTouchScrollIfNecessary(time, false); 751 EndTouchScrollIfNecessary(time, motion_event_id, false);
725 752
726 GestureEventDetails fling_details( 753 GestureEventDetails fling_details(
727 ET_SCROLL_FLING_START, velocity_x, velocity_y); 754 ET_SCROLL_FLING_START, velocity_x, velocity_y);
728 Send(CreateGesture(ET_SCROLL_FLING_START, time, x, y, fling_details)); 755 Send(CreateGesture(
756 ET_SCROLL_FLING_START, motion_event_id, time, x, y, fling_details));
729 } 757 }
730 758
731 void GestureProvider::Send(const GestureEventData& gesture) { 759 void GestureProvider::Send(const GestureEventData& gesture) {
732 DCHECK(!gesture.time.is_null()); 760 DCHECK(!gesture.time.is_null());
733 // The only valid events that should be sent without an active touch sequence 761 // The only valid events that should be sent without an active touch sequence
734 // are SHOW_PRESS and TAP, potentially triggered by the double-tap 762 // are SHOW_PRESS and TAP, potentially triggered by the double-tap
735 // delay timing out. 763 // delay timing out.
736 DCHECK(current_down_event_ || gesture.type == ET_GESTURE_TAP || 764 DCHECK(current_down_event_ || gesture.type == ET_GESTURE_TAP ||
737 gesture.type == ET_GESTURE_SHOW_PRESS); 765 gesture.type == ET_GESTURE_SHOW_PRESS);
738 766
739 switch (gesture.type) { 767 switch (gesture.type) {
740 case ET_GESTURE_TAP_DOWN: 768 case ET_GESTURE_TAP_DOWN:
741 needs_tap_ending_event_ = true; 769 needs_tap_ending_event_ = true;
742 break; 770 break;
743 case ET_GESTURE_TAP_UNCONFIRMED: 771 case ET_GESTURE_TAP_UNCONFIRMED:
744 needs_show_press_event_ = false; 772 needs_show_press_event_ = false;
745 break; 773 break;
746 case ET_GESTURE_TAP: 774 case ET_GESTURE_TAP:
747 if (needs_show_press_event_) 775 if (needs_show_press_event_)
748 Send(CreateGesture( 776 Send(CreateGesture(ET_GESTURE_SHOW_PRESS,
749 ET_GESTURE_SHOW_PRESS, gesture.time, gesture.x, gesture.y)); 777 gesture.motion_event_id,
778 gesture.time,
779 gesture.x,
780 gesture.y));
750 needs_tap_ending_event_ = false; 781 needs_tap_ending_event_ = false;
751 break; 782 break;
752 case ET_GESTURE_DOUBLE_TAP: 783 case ET_GESTURE_DOUBLE_TAP:
753 needs_tap_ending_event_ = false; 784 needs_tap_ending_event_ = false;
754 break; 785 break;
755 case ET_GESTURE_TAP_CANCEL: 786 case ET_GESTURE_TAP_CANCEL:
756 if (!needs_tap_ending_event_) 787 if (!needs_tap_ending_event_)
757 return; 788 return;
758 needs_tap_ending_event_ = false; 789 needs_tap_ending_event_ = false;
759 break; 790 break;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 GestureEventDetails long_tap_details(ET_GESTURE_LONG_TAP, 0, 0); 834 GestureEventDetails long_tap_details(ET_GESTURE_LONG_TAP, 0, 0);
804 long_tap_details.set_bounding_box( 835 long_tap_details.set_bounding_box(
805 gfx::RectF(event.GetTouchMajor(), event.GetTouchMajor())); 836 gfx::RectF(event.GetTouchMajor(), event.GetTouchMajor()));
806 Send(CreateGesture(ET_GESTURE_LONG_TAP, event, long_tap_details)); 837 Send(CreateGesture(ET_GESTURE_LONG_TAP, event, long_tap_details));
807 return true; 838 return true;
808 } 839 }
809 return false; 840 return false;
810 } 841 }
811 842
812 void GestureProvider::EndTouchScrollIfNecessary(base::TimeTicks time, 843 void GestureProvider::EndTouchScrollIfNecessary(base::TimeTicks time,
844 int motion_event_id,
813 bool send_scroll_end_event) { 845 bool send_scroll_end_event) {
814 if (!touch_scroll_in_progress_) 846 if (!touch_scroll_in_progress_)
815 return; 847 return;
816 touch_scroll_in_progress_ = false; 848 touch_scroll_in_progress_ = false;
817 if (send_scroll_end_event) 849 if (send_scroll_end_event)
818 Send(CreateGesture(ET_GESTURE_SCROLL_END, time, 0, 0)); 850 Send(CreateGesture(ET_GESTURE_SCROLL_END, motion_event_id, time, 0, 0));
819 } 851 }
820 852
821 } // namespace ui 853 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698