diff options
author | loislo@chromium.org <loislo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-07 06:33:53 +0000 |
---|---|---|
committer | loislo@chromium.org <loislo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-07 06:33:53 +0000 |
commit | 735dce06ed30b61b49de10642f45566ec612a5d5 (patch) | |
tree | 705a899a8154e25c0562ebf544f96d7fc08ab806 /ui | |
parent | c02581ed5de3df60501f14a1555f8820867548ba (diff) | |
download | chromium_src-735dce06ed30b61b49de10642f45566ec612a5d5.zip chromium_src-735dce06ed30b61b49de10642f45566ec612a5d5.tar.gz chromium_src-735dce06ed30b61b49de10642f45566ec612a5d5.tar.bz2 |
It broke win aura bot
[ RUN ] WindowTest.TransferCaptureTouchEvents
.\window_unittest.cc(700): error: Value of: d1.gesture_event_count()
Actual: 2
Expected: 1
.\window_unittest.cc(710): error: Value of: d2.gesture_event_count()
Actual: 2
Expected: 1
[ FAILED ] WindowTest.TransferCaptureTouchEvents (0 ms)
Revert 140967 - Fix TAP_DOWN gesture event:
1. GESTURE_TAP_DOWN should be sent only on the first TOUCH_PRESSED.
2. New gesture GESTURE_BEGIN shuold be sent on all TOUCH_PRESSED.
3. Rename GESTURE_TAP_UP to GESTURE_END.
BUG=131007
TEST=manual
Review URL: https://chromiumcodereview.appspot.com/10533029
TBR=varunjain@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10539041
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140972 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/aura/gestures/gesture_recognizer_unittest.cc | 74 | ||||
-rw-r--r-- | ui/aura/root_window_unittest.cc | 23 | ||||
-rw-r--r-- | ui/aura/window_unittest.cc | 9 | ||||
-rw-r--r-- | ui/base/events.h | 5 | ||||
-rw-r--r-- | ui/base/gestures/gesture_sequence.cc | 22 | ||||
-rw-r--r-- | ui/base/gestures/gesture_sequence.h | 3 | ||||
-rw-r--r-- | ui/views/view_unittest.cc | 2 | ||||
-rw-r--r-- | ui/views/widget/root_view.cc | 2 | ||||
-rw-r--r-- | ui/views/widget/widget.cc | 8 |
9 files changed, 32 insertions, 116 deletions
diff --git a/ui/aura/gestures/gesture_recognizer_unittest.cc b/ui/aura/gestures/gesture_recognizer_unittest.cc index 2621d54..84ef01c 100644 --- a/ui/aura/gestures/gesture_recognizer_unittest.cc +++ b/ui/aura/gestures/gesture_recognizer_unittest.cc @@ -36,8 +36,7 @@ class GestureEventConsumeDelegate : public TestWindowDelegate { GestureEventConsumeDelegate() : tap_(false), tap_down_(false), - begin_(false), - end_(false), + tap_up_(false), double_tap_(false), scroll_begin_(false), scroll_update_(false), @@ -61,8 +60,7 @@ class GestureEventConsumeDelegate : public TestWindowDelegate { void Reset() { tap_ = false; tap_down_ = false; - begin_ = false; - end_ = false; + tap_up_ = false; double_tap_ = false; scroll_begin_ = false; scroll_update_ = false; @@ -87,8 +85,7 @@ class GestureEventConsumeDelegate : public TestWindowDelegate { bool tap() const { return tap_; } bool tap_down() const { return tap_down_; } - bool begin() const { return begin_; } - bool end() const { return end_; } + bool tap_up() const { return tap_up_; } bool double_tap() const { return double_tap_; } bool scroll_begin() const { return scroll_begin_; } bool scroll_update() const { return scroll_update_; } @@ -127,11 +124,8 @@ class GestureEventConsumeDelegate : public TestWindowDelegate { case ui::ET_GESTURE_TAP_DOWN: tap_down_ = true; break; - case ui::ET_GESTURE_BEGIN: - begin_ = true; - break; - case ui::ET_GESTURE_END: - end_ = true; + case ui::ET_GESTURE_TAP_UP: + tap_up_ = true; break; case ui::ET_GESTURE_DOUBLE_TAP: double_tap_ = true; @@ -179,8 +173,7 @@ class GestureEventConsumeDelegate : public TestWindowDelegate { private: bool tap_; bool tap_down_; - bool begin_; - bool end_; + bool tap_up_; bool double_tap_; bool scroll_begin_; bool scroll_update_; @@ -410,7 +403,6 @@ TEST_F(GestureRecognizerTest, GestureEventTap) { root_window()->DispatchTouchEvent(&press); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); - EXPECT_TRUE(delegate->begin()); EXPECT_FALSE(delegate->double_tap()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_FALSE(delegate->scroll_update()); @@ -427,8 +419,6 @@ TEST_F(GestureRecognizerTest, GestureEventTap) { root_window()->DispatchTouchEvent(&release); EXPECT_TRUE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); - EXPECT_FALSE(delegate->begin()); - EXPECT_TRUE(delegate->end()); EXPECT_FALSE(delegate->double_tap()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_FALSE(delegate->scroll_update()); @@ -457,7 +447,6 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { root_window()->DispatchTouchEvent(&press); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); - EXPECT_TRUE(delegate->begin()); EXPECT_FALSE(delegate->double_tap()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_FALSE(delegate->scroll_update()); @@ -476,8 +465,6 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { root_window()->DispatchTouchEvent(&release); EXPECT_TRUE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); - EXPECT_FALSE(delegate->begin()); - EXPECT_TRUE(delegate->end()); EXPECT_FALSE(delegate->double_tap()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_FALSE(delegate->scroll_update()); @@ -500,7 +487,6 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { root_window()->DispatchTouchEvent(&press); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); - EXPECT_TRUE(delegate->begin()); EXPECT_FALSE(delegate->double_tap()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_FALSE(delegate->scroll_update()); @@ -517,8 +503,6 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { root_window()->DispatchTouchEvent(&release); EXPECT_TRUE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); - EXPECT_FALSE(delegate->begin()); - EXPECT_TRUE(delegate->end()); EXPECT_FALSE(delegate->double_tap()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_FALSE(delegate->scroll_update()); @@ -541,7 +525,6 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { root_window()->DispatchTouchEvent(&press); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); - EXPECT_TRUE(delegate->begin()); EXPECT_FALSE(delegate->double_tap()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_FALSE(delegate->scroll_update()); @@ -557,7 +540,6 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { root_window()->DispatchTouchEvent(&move); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); - EXPECT_FALSE(delegate->begin()); EXPECT_FALSE(delegate->double_tap()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_FALSE(delegate->scroll_update()); @@ -574,8 +556,6 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { root_window()->DispatchTouchEvent(&release); EXPECT_TRUE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); - EXPECT_FALSE(delegate->begin()); - EXPECT_TRUE(delegate->end()); EXPECT_FALSE(delegate->double_tap()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_FALSE(delegate->scroll_update()); @@ -598,7 +578,6 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { root_window()->DispatchTouchEvent(&press); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); - EXPECT_TRUE(delegate->begin()); EXPECT_FALSE(delegate->double_tap()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_FALSE(delegate->scroll_update()); @@ -614,7 +593,6 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { root_window()->DispatchTouchEvent(&move); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); - EXPECT_FALSE(delegate->begin()); EXPECT_FALSE(delegate->double_tap()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_FALSE(delegate->scroll_update()); @@ -630,7 +608,6 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { root_window()->DispatchTouchEvent(&move1); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); - EXPECT_FALSE(delegate->begin()); EXPECT_FALSE(delegate->double_tap()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_FALSE(delegate->scroll_update()); @@ -646,7 +623,6 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { root_window()->DispatchTouchEvent(&move2); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); - EXPECT_FALSE(delegate->begin()); EXPECT_FALSE(delegate->double_tap()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_FALSE(delegate->scroll_update()); @@ -663,8 +639,6 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) { root_window()->DispatchTouchEvent(&release); EXPECT_TRUE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); - EXPECT_FALSE(delegate->begin()); - EXPECT_TRUE(delegate->end()); EXPECT_FALSE(delegate->double_tap()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_FALSE(delegate->scroll_update()); @@ -695,7 +669,6 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) { root_window()->DispatchTouchEvent(&press); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); - EXPECT_TRUE(delegate->begin()); EXPECT_FALSE(delegate->double_tap()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_FALSE(delegate->scroll_update()); @@ -708,7 +681,6 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) { SendScrollEvent(root_window(), 130, 230, kTouchId, delegate.get()); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); - EXPECT_FALSE(delegate->begin()); EXPECT_FALSE(delegate->double_tap()); EXPECT_TRUE(delegate->scroll_begin()); EXPECT_TRUE(delegate->scroll_update()); @@ -722,7 +694,6 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) { SendScrollEvent(root_window(), 110, 211, kTouchId, delegate.get()); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); - EXPECT_FALSE(delegate->begin()); EXPECT_FALSE(delegate->double_tap()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_TRUE(delegate->scroll_update()); @@ -733,7 +704,6 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) { SendScrollEvent(root_window(), 140, 215, kTouchId, delegate.get()); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); - EXPECT_FALSE(delegate->begin()); EXPECT_FALSE(delegate->double_tap()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_TRUE(delegate->scroll_update()); @@ -749,8 +719,6 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) { root_window()->DispatchTouchEvent(&release); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); - EXPECT_FALSE(delegate->begin()); - EXPECT_TRUE(delegate->end()); EXPECT_FALSE(delegate->double_tap()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_FALSE(delegate->scroll_update()); @@ -888,7 +856,6 @@ TEST_F(GestureRecognizerTest, GestureEventLongPress) { kTouchId, GetTime()); root_window()->DispatchTouchEvent(&press1); EXPECT_TRUE(delegate->tap_down()); - EXPECT_TRUE(delegate->begin()); // We haven't pressed long enough for a long press to occur EXPECT_FALSE(delegate->long_press()); @@ -972,7 +939,6 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledBySecondTap) { kTouchId1, GetTime()); root_window()->DispatchTouchEvent(&press); EXPECT_TRUE(delegate->tap_down()); - EXPECT_TRUE(delegate->begin()); // We haven't pressed long enough for a long press to occur EXPECT_FALSE(delegate->long_press()); @@ -983,7 +949,6 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledBySecondTap) { kTouchId2, GetTime()); root_window()->DispatchTouchEvent(&press2); EXPECT_FALSE(delegate->tap_down()); // no touch down for second tap. - EXPECT_TRUE(delegate->begin()); // Wait until the timer runs out gesture_sequence->ForceTimeout(); @@ -1247,7 +1212,6 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { root_window()->DispatchTouchEvent(&press); EXPECT_FALSE(queued_delegate->tap()); EXPECT_FALSE(queued_delegate->tap_down()); - EXPECT_FALSE(queued_delegate->begin()); EXPECT_FALSE(queued_delegate->double_tap()); EXPECT_FALSE(queued_delegate->scroll_begin()); EXPECT_FALSE(queued_delegate->scroll_update()); @@ -1262,8 +1226,6 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { root_window()->DispatchTouchEvent(&release); EXPECT_FALSE(queued_delegate->tap()); EXPECT_FALSE(queued_delegate->tap_down()); - EXPECT_FALSE(queued_delegate->begin()); - EXPECT_FALSE(queued_delegate->end()); EXPECT_FALSE(queued_delegate->double_tap()); EXPECT_FALSE(queued_delegate->scroll_begin()); EXPECT_FALSE(queued_delegate->scroll_update()); @@ -1281,8 +1243,6 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { root_window()->DispatchTouchEvent(&press2); EXPECT_FALSE(delegate->tap()); EXPECT_TRUE(delegate->tap_down()); - EXPECT_FALSE(queued_delegate->begin()); - EXPECT_FALSE(queued_delegate->end()); EXPECT_FALSE(delegate->double_tap()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_FALSE(delegate->scroll_update()); @@ -1297,8 +1257,6 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { queued_delegate->ReceivedAck(); EXPECT_FALSE(queued_delegate->tap()); EXPECT_TRUE(queued_delegate->tap_down()); - EXPECT_TRUE(queued_delegate->begin()); - EXPECT_FALSE(queued_delegate->end()); EXPECT_FALSE(queued_delegate->double_tap()); EXPECT_FALSE(queued_delegate->scroll_begin()); EXPECT_FALSE(queued_delegate->scroll_update()); @@ -1309,8 +1267,6 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { queued_delegate->ReceivedAck(); EXPECT_TRUE(queued_delegate->tap()); EXPECT_FALSE(queued_delegate->tap_down()); - EXPECT_FALSE(queued_delegate->begin()); - EXPECT_TRUE(queued_delegate->end()); EXPECT_FALSE(queued_delegate->double_tap()); EXPECT_FALSE(queued_delegate->scroll_begin()); EXPECT_FALSE(queued_delegate->scroll_update()); @@ -1324,10 +1280,6 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { root_window()->DispatchTouchEvent(&press3); EXPECT_FALSE(queued_delegate->tap()); EXPECT_FALSE(queued_delegate->tap_down()); - EXPECT_FALSE(queued_delegate->begin()); - EXPECT_FALSE(queued_delegate->end()); - EXPECT_FALSE(queued_delegate->begin()); - EXPECT_FALSE(queued_delegate->end()); EXPECT_FALSE(queued_delegate->double_tap()); EXPECT_FALSE(queued_delegate->scroll_begin()); EXPECT_FALSE(queued_delegate->scroll_update()); @@ -1340,16 +1292,12 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { root_window()->DispatchTouchEvent(&press4); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); - EXPECT_FALSE(delegate->begin()); - EXPECT_FALSE(delegate->end()); EXPECT_FALSE(delegate->double_tap()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_FALSE(delegate->scroll_update()); EXPECT_FALSE(delegate->scroll_end()); EXPECT_FALSE(queued_delegate->tap()); EXPECT_FALSE(queued_delegate->tap_down()); - EXPECT_FALSE(queued_delegate->begin()); - EXPECT_FALSE(queued_delegate->end()); EXPECT_FALSE(queued_delegate->double_tap()); EXPECT_FALSE(queued_delegate->scroll_begin()); EXPECT_FALSE(queued_delegate->scroll_update()); @@ -1365,14 +1313,12 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { root_window()->DispatchTouchEvent(&move); EXPECT_FALSE(delegate->tap()); EXPECT_FALSE(delegate->tap_down()); - EXPECT_FALSE(delegate->begin()); EXPECT_FALSE(delegate->double_tap()); EXPECT_FALSE(delegate->scroll_begin()); EXPECT_FALSE(delegate->scroll_update()); EXPECT_FALSE(delegate->scroll_end()); EXPECT_FALSE(queued_delegate->tap()); EXPECT_FALSE(queued_delegate->tap_down()); - EXPECT_FALSE(queued_delegate->begin()); EXPECT_FALSE(queued_delegate->double_tap()); EXPECT_FALSE(queued_delegate->scroll_begin()); EXPECT_FALSE(queued_delegate->scroll_update()); @@ -1382,8 +1328,6 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { queued_delegate->ReceivedAck(); EXPECT_FALSE(queued_delegate->tap()); EXPECT_TRUE(queued_delegate->tap_down()); - EXPECT_TRUE(queued_delegate->begin()); - EXPECT_FALSE(queued_delegate->end()); EXPECT_FALSE(queued_delegate->double_tap()); EXPECT_FALSE(queued_delegate->scroll_begin()); EXPECT_FALSE(queued_delegate->scroll_update()); @@ -1393,8 +1337,6 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { queued_delegate->ReceivedAck(); EXPECT_FALSE(queued_delegate->tap()); EXPECT_FALSE(queued_delegate->tap_down()); // no touch down for second tap. - EXPECT_TRUE(queued_delegate->begin()); - EXPECT_FALSE(queued_delegate->end()); EXPECT_FALSE(queued_delegate->double_tap()); EXPECT_FALSE(queued_delegate->scroll_begin()); EXPECT_FALSE(queued_delegate->scroll_update()); @@ -1407,8 +1349,6 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) { queued_delegate->ReceivedAck(); EXPECT_FALSE(queued_delegate->tap()); EXPECT_FALSE(queued_delegate->tap_down()); - EXPECT_FALSE(queued_delegate->begin()); - EXPECT_FALSE(queued_delegate->end()); EXPECT_FALSE(queued_delegate->double_tap()); EXPECT_TRUE(queued_delegate->scroll_begin()); EXPECT_FALSE(queued_delegate->scroll_update()); @@ -1842,7 +1782,7 @@ TEST_F(GestureRecognizerTest, CaptureSendsTapUp) { capture->SetCapture(); RunAllPendingInMessageLoop(); - EXPECT_TRUE(delegate->end()); + EXPECT_TRUE(delegate->tap_up()); } TEST_F(GestureRecognizerTest, TwoFingerTap) { diff --git a/ui/aura/root_window_unittest.cc b/ui/aura/root_window_unittest.cc index 1b8c804..f1c456b 100644 --- a/ui/aura/root_window_unittest.cc +++ b/ui/aura/root_window_unittest.cc @@ -425,11 +425,8 @@ std::string EventTypeToString(ui::EventType type) { case ui::ET_GESTURE_TAP_DOWN: return "GESTURE_TAP_DOWN"; - case ui::ET_GESTURE_BEGIN: - return "GESTURE_BEGIN"; - - case ui::ET_GESTURE_END: - return "GESTURE_END"; + case ui::ET_GESTURE_TAP_UP: + return "GESTURE_TAP_UP"; case ui::ET_GESTURE_DOUBLE_TAP: return "GESTURE_DOUBLE_TAP"; @@ -473,9 +470,9 @@ TEST_F(RootWindowTest, GestureToMouseEventTest) { base::TimeDelta::FromMilliseconds(time_ms)); root_window()->DispatchTouchEvent(&touch_pressed_event); root_window()->DispatchTouchEvent(&touch_released_event); - EXPECT_EQ("TOUCH_PRESSED GESTURE_BEGIN GESTURE_TAP_DOWN TOUCH_RELEASED " - "GESTURE_TAP MOUSE_ENTERED MOUSE_MOVED MOUSE_PRESSED " - "MOUSE_RELEASED GESTURE_END", + EXPECT_EQ("TOUCH_PRESSED GESTURE_TAP_DOWN TOUCH_RELEASED GESTURE_TAP " + "MOUSE_ENTERED MOUSE_MOVED MOUSE_PRESSED MOUSE_RELEASED " + "GESTURE_TAP_UP", EventTypesToString(filter->events())); filter->events().clear(); } @@ -485,7 +482,7 @@ TEST_F(RootWindowTest, GestureToMouseEventTest) { TouchEvent touch_event(ui::ET_TOUCH_PRESSED, gfx::Point(100, 101), 1, base::TimeDelta()); root_window()->DispatchTouchEvent(&touch_event); - EXPECT_EQ("TOUCH_PRESSED GESTURE_BEGIN GESTURE_TAP_DOWN", + EXPECT_EQ("TOUCH_PRESSED GESTURE_TAP_DOWN", EventTypesToString(filter->events())); filter->events().clear(); } @@ -521,7 +518,7 @@ TEST_F(RootWindowTest, GestureToMouseEventTest) { base::TimeDelta()); root_window()->DispatchTouchEvent(&touch_event); EXPECT_EQ("TOUCH_RELEASED GESTURE_SCROLL_END MOUSE_DRAGGED MOUSE_RELEASED " - "GESTURE_END", + "GESTURE_TAP_UP", EventTypesToString(filter->events())); filter->events().clear(); } @@ -559,9 +556,9 @@ TEST_F(RootWindowTest, MouseMoveThenTouch) { base::TimeDelta::FromMilliseconds(time_ms)); root_window()->DispatchTouchEvent(&touch_pressed_event); root_window()->DispatchTouchEvent(&touch_released_event); - EXPECT_EQ("TOUCH_PRESSED GESTURE_BEGIN GESTURE_TAP_DOWN TOUCH_RELEASED " - "GESTURE_TAP MOUSE_EXITED MOUSE_ENTERED MOUSE_MOVED " - "MOUSE_PRESSED MOUSE_RELEASED GESTURE_END", + EXPECT_EQ("TOUCH_PRESSED GESTURE_TAP_DOWN TOUCH_RELEASED GESTURE_TAP " + "MOUSE_EXITED MOUSE_ENTERED MOUSE_MOVED MOUSE_PRESSED " + "MOUSE_RELEASED GESTURE_TAP_UP", EventTypesToString(filter->events())); filter->events().clear(); } diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc index 2b9a68a..9252097 100644 --- a/ui/aura/window_unittest.cc +++ b/ui/aura/window_unittest.cc @@ -626,8 +626,7 @@ TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) { TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime()); root_window()->DispatchTouchEvent(&press); - // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN. - EXPECT_EQ(2, delegate1.gesture_event_count()); + EXPECT_EQ(1, delegate1.gesture_event_count()); delegate1.ResetCounts(); w2->SetCapture(); @@ -659,8 +658,7 @@ TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) { gfx::Point(10, 10), 0, getTime()); root_window()->DispatchTouchEvent(&press2); EXPECT_EQ(0, delegate1.gesture_event_count()); - // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN. - EXPECT_EQ(2, delegate2.gesture_event_count()); + EXPECT_EQ(1, delegate2.gesture_event_count()); } TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) { @@ -672,8 +670,7 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) { gfx::Point(10, 10), 0, getTime()); root_window()->DispatchTouchEvent(&press); - // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN. - EXPECT_EQ(2, delegate.gesture_event_count()); + EXPECT_EQ(1, delegate.gesture_event_count()); delegate.ResetCounts(); window->SetCapture(); diff --git a/ui/base/events.h b/ui/base/events.h index 1d8b2d6..6712b19 100644 --- a/ui/base/events.h +++ b/ui/base/events.h @@ -52,9 +52,8 @@ enum EventType { ET_GESTURE_SCROLL_END, ET_GESTURE_SCROLL_UPDATE, ET_GESTURE_TAP, - ET_GESTURE_TAP_DOWN, - ET_GESTURE_BEGIN, // Sent before any other gesture types. - ET_GESTURE_END, // Sent after any other gestures. + ET_GESTURE_TAP_DOWN, // Sent before any other gesture types. + ET_GESTURE_TAP_UP, // Sent after any other gestures. ET_GESTURE_DOUBLE_TAP, ET_GESTURE_TWO_FINGER_TAP, ET_GESTURE_PINCH_BEGIN, diff --git a/ui/base/gestures/gesture_sequence.cc b/ui/base/gestures/gesture_sequence.cc index 7e3302c..f11d5d1 100644 --- a/ui/base/gestures/gesture_sequence.cc +++ b/ui/base/gestures/gesture_sequence.cc @@ -248,11 +248,6 @@ GestureSequence::Gestures* GestureSequence::ProcessTouchEventForGesture( const int point_id = points_[event.GetTouchId()].point_id(); if (point_id < 0) return NULL; - - // Send GESTURE_BEGIN for any touch pressed. - if (event.GetEventType() == ui::ET_TOUCH_PRESSED) - AppendBeginGestureEvent(point, gestures.get()); - switch (Signature(state_, point_id, event.GetEventType(), false)) { case GST_NO_GESTURE_FIRST_PRESSED: TouchDown(event, point, gestures.get()); @@ -356,6 +351,7 @@ GestureSequence::Gestures* GestureSequence::ProcessTouchEventForGesture( case GST_PINCH_THIRD_PRESSED: case GST_PINCH_FOURTH_PRESSED: case GST_PINCH_FIFTH_PRESSED: + AppendTapDownGestureEvent(point, gestures.get()); pinch_distance_current_ = BoundingBoxDiagonal(bounding_box_); pinch_distance_start_ = pinch_distance_current_; break; @@ -363,7 +359,7 @@ GestureSequence::Gestures* GestureSequence::ProcessTouchEventForGesture( if (event.GetEventType() == ui::ET_TOUCH_RELEASED || event.GetEventType() == ui::ET_TOUCH_CANCELLED) - AppendEndGestureEvent(point, gestures.get()); + AppendTapUpGestureEvent(point, gestures.get()); if (state_ != last_state) DVLOG(4) << "Gesture Sequence" @@ -480,23 +476,13 @@ void GestureSequence::AppendTapDownGestureEvent(const GesturePoint& point, point.first_touch_position(), flags_, base::Time::FromDoubleT(point.last_touch_time()), - 0, 0.f, 1 << point.touch_id())); -} - -void GestureSequence::AppendBeginGestureEvent(const GesturePoint& point, - Gestures* gestures) { - gestures->push_back(helper_->CreateGestureEvent( - ui::ET_GESTURE_BEGIN, - point.first_touch_position(), - flags_, - base::Time::FromDoubleT(point.last_touch_time()), point_count_, 0.f, 1 << point.touch_id())); } -void GestureSequence::AppendEndGestureEvent(const GesturePoint& point, +void GestureSequence::AppendTapUpGestureEvent(const GesturePoint& point, Gestures* gestures) { gestures->push_back(helper_->CreateGestureEvent( - ui::ET_GESTURE_END, + ui::ET_GESTURE_TAP_UP, point.first_touch_position(), flags_, base::Time::FromDoubleT(point.last_touch_time()), diff --git a/ui/base/gestures/gesture_sequence.h b/ui/base/gestures/gesture_sequence.h index 07d8cc4..b976bb3 100644 --- a/ui/base/gestures/gesture_sequence.h +++ b/ui/base/gestures/gesture_sequence.h @@ -78,8 +78,7 @@ class UI_EXPORT GestureSequence { // Tap gestures. void AppendTapDownGestureEvent(const GesturePoint& point, Gestures* gestures); - void AppendBeginGestureEvent(const GesturePoint& point, Gestures* gestures); - void AppendEndGestureEvent(const GesturePoint& point, Gestures* gestures); + void AppendTapUpGestureEvent(const GesturePoint& point, Gestures* gestures); void AppendClickGestureEvent(const GesturePoint& point, Gestures* gestures); void AppendDoubleClickGestureEvent(const GesturePoint& point, Gestures* gestures); diff --git a/ui/views/view_unittest.cc b/ui/views/view_unittest.cc index 3b6099d..70e6cee 100644 --- a/ui/views/view_unittest.cc +++ b/ui/views/view_unittest.cc @@ -603,7 +603,7 @@ TEST_F(ViewTest, GestureEvent) { EXPECT_EQ(ui::ET_UNKNOWN, v1->last_gesture_event_type_); // Simulate an up so that RootView is no longer targetting |v3|. - GestureEventForTest g1_up(ui::ET_GESTURE_END, 110, 110, 0); + GestureEventForTest g1_up(ui::ET_GESTURE_TAP_UP, 110, 110, 0); root->OnGestureEvent(g1_up); v1->Reset(); diff --git a/ui/views/widget/root_view.cc b/ui/views/widget/root_view.cc index f10bd5b..6b6c14b 100644 --- a/ui/views/widget/root_view.cc +++ b/ui/views/widget/root_view.cc @@ -450,7 +450,7 @@ ui::GestureStatus RootView::OnGestureEvent(const GestureEvent& event) { View* handler = gesture_handler_; GestureEvent handler_event(event, this, gesture_handler_); // TODO: should only do this for the last touch id that goes up. - if (event.type() == ui::ET_GESTURE_END) + if (event.type() == ui::ET_GESTURE_TAP_UP) gesture_handler_ = NULL; return handler->OnGestureEvent(handler_event); } diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc index 2231378..7626e96 100644 --- a/ui/views/widget/widget.cc +++ b/ui/views/widget/widget.cc @@ -1116,11 +1116,9 @@ ui::GestureStatus Widget::OnGestureEvent(const GestureEvent& event) { // dragging) may explicitly capture. break; - case ui::ET_GESTURE_END: - if (event.delta_x() == 1) { - is_touch_down_ = false; - ReleaseCapture(); - } + case ui::ET_GESTURE_TAP_UP: + is_touch_down_ = false; + ReleaseCapture(); break; default: |