summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authortdresser@chromium.org <tdresser@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-14 23:55:00 +0000
committertdresser@chromium.org <tdresser@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-14 23:55:00 +0000
commitccb6bf4408f8956c82c04836240c11d3ace1725e (patch)
tree363b338a1ba252acc818e52ae3a64ba0e12e29f1 /ui
parentd66eac44cda6b48f70bf6ef06adc72c8638b39bf (diff)
downloadchromium_src-ccb6bf4408f8956c82c04836240c11d3ace1725e.zip
chromium_src-ccb6bf4408f8956c82c04836240c11d3ace1725e.tar.gz
chromium_src-ccb6bf4408f8956c82c04836240c11d3ace1725e.tar.bz2
Revert of Don't treat first touch move differently from future touch moves (https://codereview.chromium.org/228973003/)
Reason for revert: This never set |seen_scroll_update_this_sequence_| to true, resulting in: https://code.google.com/p/chromium/issues/detail?id=393695 The fact that no tests caught this issue is pretty scary; we'll need some beefier tests as well as the trivial fix. Original issue's description: > Don't treat first move touch differently from future touch moves. > > See http://lists.w3.org/Archives/Public/public-touchevents/2014Apr/0005.html for details. > > BUG=354460 > TEST=TouchEventQueueTest.TouchAbsorptionWithConsumedFirstMove, TouchEventQueueTest.TouchCancelOnScroll > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=282642 TBR=jdduke, sadrul Review URL: https://codereview.chromium.org/394523004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283089 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/aura/gestures/gesture_recognizer_unittest.cc71
-rw-r--r--ui/events/gesture_detection/touch_disposition_gesture_filter.cc2
-rw-r--r--ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc15
3 files changed, 23 insertions, 65 deletions
diff --git a/ui/aura/gestures/gesture_recognizer_unittest.cc b/ui/aura/gestures/gesture_recognizer_unittest.cc
index 872fded..d8a8d10 100644
--- a/ui/aura/gestures/gesture_recognizer_unittest.cc
+++ b/ui/aura/gestures/gesture_recognizer_unittest.cc
@@ -2099,8 +2099,7 @@ scoped_ptr<GestureEventConsumeDelegate> delegate(
}
TEST_P(GestureRecognizerTest, GestureEventPinchFromTap) {
- // Disabled under unified gesture recognizer due to behavior differences in
- // scroll and bounding box behavior.
+ // TODO(tdresser): enable this test with unified GR once two finger tap.
if (UsingUnifiedGR())
return;
@@ -3148,16 +3147,10 @@ TEST_P(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) {
EXPECT_FALSE(delegate->tap_down());
EXPECT_TRUE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
+ EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
EXPECT_FALSE(delegate->scroll_end());
- // With the unified gesture detector, consuming the first touch move event
- // won't prevent all future scrolling.
- if (UsingUnifiedGR())
- EXPECT_TRUE(delegate->scroll_begin());
- else
- EXPECT_FALSE(delegate->scroll_begin());
-
// Release the touch back at the start point. This should end without causing
// a tap.
delegate->Reset();
@@ -3171,11 +3164,7 @@ TEST_P(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) {
EXPECT_TRUE(delegate->end());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
-
- if (UsingUnifiedGR())
- EXPECT_TRUE(delegate->scroll_end());
- else
- EXPECT_FALSE(delegate->scroll_end());
+ EXPECT_FALSE(delegate->scroll_end());
}
// Tests the behavior of 2F scroll when all the touch-move events are consumed.
@@ -3322,16 +3311,10 @@ TEST_P(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) {
EXPECT_FALSE(delegate->tap_down());
EXPECT_TRUE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
+ EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
EXPECT_FALSE(delegate->scroll_end());
- // With the unified gesture detector, consuming the first touch move event
- // won't prevent all future scrolling.
- if (UsingUnifiedGR())
- EXPECT_TRUE(delegate->scroll_begin());
- else
- EXPECT_FALSE(delegate->scroll_begin());
-
// Now, stop consuming touch-move events, and move the touch-point again.
delegate->set_consume_touch_move(false);
tes.SendScrollEvent(event_processor(), 159, 259, kTouchId, delegate.get());
@@ -3340,23 +3323,13 @@ TEST_P(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) {
EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
EXPECT_FALSE(delegate->scroll_begin());
+ EXPECT_FALSE(delegate->scroll_update());
EXPECT_FALSE(delegate->scroll_end());
-
- if (UsingUnifiedGR()) {
- // Scroll not prevented by consumed first touch move.
- EXPECT_TRUE(delegate->scroll_update());
- EXPECT_EQ(29, delegate->scroll_x());
- EXPECT_EQ(29, delegate->scroll_y());
- EXPECT_EQ(gfx::Point(0, 0).ToString(),
- delegate->scroll_begin_position().ToString());
- } else {
- EXPECT_FALSE(delegate->scroll_update());
- // No scroll has occurred, because an early touch move was consumed.
- EXPECT_EQ(0, delegate->scroll_x());
- EXPECT_EQ(0, delegate->scroll_y());
- EXPECT_EQ(gfx::Point(0, 0).ToString(),
- delegate->scroll_begin_position().ToString());
- }
+ // No scroll has occurred, because an early touch move was consumed.
+ EXPECT_EQ(0, delegate->scroll_x());
+ EXPECT_EQ(0, delegate->scroll_y());
+ EXPECT_EQ(gfx::Point(0, 0).ToString(),
+ delegate->scroll_begin_position().ToString());
// Start consuming touch-move events again.
delegate->set_consume_touch_move(true);
@@ -3396,12 +3369,8 @@ TEST_P(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) {
EXPECT_TRUE(delegate->end());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
+ EXPECT_FALSE(delegate->scroll_end());
EXPECT_FALSE(delegate->fling());
-
- if (UsingUnifiedGR())
- EXPECT_TRUE(delegate->scroll_end());
- else
- EXPECT_FALSE(delegate->scroll_end());
}
// Check that appropriate touch events generate double tap gesture events.
@@ -3739,15 +3708,14 @@ TEST_P(GestureRecognizerTest, GestureEventConsumedTouchMoveCanFireTapCancel) {
delegate->set_consume_touch_move(true);
delegate->Reset();
// Move the touch-point enough so that it would normally be considered a
- // scroll. But since the touch-moves will be consumed, no scrolling should
- // occur.
- // With the unified gesture detector, we will receive a scroll begin gesture,
- // whereas with the aura gesture recognizer we won't.
+ // scroll. But since the touch-moves will be consumed, the scroll should not
+ // start.
tes.SendScrollEvent(event_processor(), 130, 230, kTouchId, delegate.get());
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_TRUE(delegate->tap_cancel());
EXPECT_FALSE(delegate->begin());
+ EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
EXPECT_FALSE(delegate->scroll_end());
}
@@ -3946,15 +3914,8 @@ TEST_P(GestureRecognizerTest, GestureEventConsumedTouchMoveScrollTest) {
DispatchEventUsingWindowDispatcher(&move2);
delegate->ReceivedAck();
- if (UsingUnifiedGR()) {
- // With the unified gesture detector, consuming the first touch move event
- // won't prevent all future scrolling.
- EXPECT_TRUE(delegate->scroll_begin());
- EXPECT_TRUE(delegate->scroll_update());
- } else {
- EXPECT_FALSE(delegate->scroll_begin());
- EXPECT_FALSE(delegate->scroll_update());
- }
+ EXPECT_FALSE(delegate->scroll_begin());
+ EXPECT_FALSE(delegate->scroll_update());
}
// Test that consuming the first touch move event of a touch point doesn't
diff --git a/ui/events/gesture_detection/touch_disposition_gesture_filter.cc b/ui/events/gesture_detection/touch_disposition_gesture_filter.cc
index ed33236..0e775dd 100644
--- a/ui/events/gesture_detection/touch_disposition_gesture_filter.cc
+++ b/ui/events/gesture_detection/touch_disposition_gesture_filter.cc
@@ -78,7 +78,7 @@ DispositionHandlingInfo GetDispositionHandlingInfo(EventType type) {
case ET_GESTURE_DOUBLE_TAP:
return Info(RT_START | RT_CURRENT, ET_GESTURE_TAP_UNCONFIRMED);
case ET_GESTURE_SCROLL_BEGIN:
- return Info(RT_START);
+ return Info(RT_START | RT_CURRENT);
case ET_GESTURE_SCROLL_UPDATE:
return Info(RT_CURRENT, ET_GESTURE_SCROLL_BEGIN);
case ET_GESTURE_SCROLL_END:
diff --git a/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc b/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc
index 7424ee8..c7e744a 100644
--- a/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc
+++ b/ui/events/gesture_detection/touch_disposition_gesture_filter_unittest.cc
@@ -719,10 +719,9 @@ TEST_F(TouchDispositionGestureFilterTest, TapCancelledWhenTouchConsumed) {
PushGesture(ET_GESTURE_SCROLL_BEGIN);
MoveTouchPoint(0, 2, 2);
SendTouchConsumedAck();
- EXPECT_TRUE(
- GesturesMatch(Gestures(ET_GESTURE_TAP_CANCEL, ET_GESTURE_SCROLL_BEGIN),
- GetAndResetSentGestures()));
- EXPECT_EQ(LastSentGestureLocation(), gfx::PointF(1, 1));
+ EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_TAP_CANCEL),
+ GetAndResetSentGestures()));
+ EXPECT_EQ(LastSentGestureLocation(), gfx::PointF(2, 2));
}
TEST_F(TouchDispositionGestureFilterTest,
@@ -1033,18 +1032,16 @@ TEST_F(TouchDispositionGestureFilterTest, TestDisallowedMultiFingerSwipe) {
PushGesture(ET_GESTURE_SCROLL_BEGIN);
MoveTouchPoint(0, 0, 0);
SendTouchConsumedAck();
- EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_SCROLL_BEGIN),
- GetAndResetSentGestures()));
+ EXPECT_FALSE(GesturesSent());
PushGesture(ET_GESTURE_PINCH_BEGIN);
PressTouchPoint(1, 1);
SendTouchNotConsumedAck();
- EXPECT_TRUE(GesturesMatch(Gestures(ET_GESTURE_PINCH_BEGIN),
- GetAndResetSentGestures()));
+ EXPECT_FALSE(GesturesSent());
PushGesture(ET_GESTURE_SWIPE);
PressTouchPoint(1, 1);
- SendTouchConsumedAck();
+ SendTouchNotConsumedAck();
EXPECT_FALSE(GesturesSent());
}