summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrbyers@chromium.org <rbyers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-30 00:20:10 +0000
committerrbyers@chromium.org <rbyers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-30 00:20:10 +0000
commita7b38deec9433cc37246321a83407c586b3d2c34 (patch)
tree8925f19e00fb951f0df0b4e5aedf1a651a871e76
parent45d5d8187e18346f5ee208fbdc189b27e5450a5b (diff)
downloadchromium_src-a7b38deec9433cc37246321a83407c586b3d2c34.zip
chromium_src-a7b38deec9433cc37246321a83407c586b3d2c34.tar.gz
chromium_src-a7b38deec9433cc37246321a83407c586b3d2c34.tar.bz2
Disable broken reposting of gesture events
This partially reverts r219190 "Add support for reposting the ET_GESTURE_TAP_DOWN gesture event to the RootWindow and in the corresponding function in the MenuController class". It caused a number of issues. Re-enabling this is tracked in BUG 170987 BUG=279309 Review URL: https://codereview.chromium.org/41013002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231678 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ui/aura/root_window.cc50
-rw-r--r--ui/aura/root_window.h5
-rw-r--r--ui/aura/root_window_unittest.cc10
-rw-r--r--ui/events/event.h4
-rw-r--r--ui/views/controls/menu/menu_controller.cc5
-rw-r--r--ui/views/event_utils_aura.cc5
6 files changed, 24 insertions, 55 deletions
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc
index 9c6d5ce..ebbec87 100644
--- a/ui/aura/root_window.cc
+++ b/ui/aura/root_window.cc
@@ -232,17 +232,16 @@ void RootWindow::RepostEvent(const ui::LocatedEvent& event) {
static_cast<const ui::MouseEvent&>(event),
static_cast<aura::Window*>(event.target()),
static_cast<aura::Window*>(this)));
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&RootWindow::DispatchHeldEvents,
+ repostable_event_factory_.GetWeakPtr()));
} else {
- held_repostable_event_.reset(
- new ui::GestureEvent(
- static_cast<const ui::GestureEvent&>(event),
- static_cast<aura::Window*>(event.target()),
- static_cast<aura::Window*>(this)));
+ DCHECK(event.type() == ui::ET_GESTURE_TAP_DOWN);
+ held_repostable_event_.reset();
+ // TODO(rbyers): Reposing of gestures is tricky to get
+ // right, so it's not yet supported. crbug.com/170987.
}
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&RootWindow::DispatchHeldEvents,
- repostable_event_factory_.GetWeakPtr()));
}
RootWindowHostDelegate* RootWindow::AsRootWindowHostDelegate() {
@@ -1107,32 +1106,6 @@ bool RootWindow::DispatchTouchEventImpl(ui::TouchEvent* event) {
return ProcessGestures(gestures.get()) ? true : handled;
}
-bool RootWindow::DispatchGestureEventRepost(ui::GestureEvent* event) {
- if (event->type() != ui::ET_GESTURE_TAP_DOWN)
- return false;
-
- // Cleanup stale gesture events for the old gesture target.
- GestureConsumer* old_consumer = GetGestureTarget(event);
- if (old_consumer)
- CleanupGestureRecognizerState(static_cast<aura::Window*>(old_consumer));
-
- Window* new_consumer = GetEventHandlerForPoint(event->root_location());
- if (new_consumer) {
- ui::GestureEvent begin_gesture(
- ui::ET_GESTURE_BEGIN,
- event->x(),
- event->y(),
- event->flags(),
- event->time_stamp(),
- ui::GestureEventDetails(ui::ET_GESTURE_BEGIN, 0, 0),
- event->touch_ids_bitfield());
- ProcessEvent(new_consumer, &begin_gesture);
- ProcessEvent(new_consumer, event);
- return event->handled();
- }
- return false;
-}
-
void RootWindow::DispatchHeldEvents() {
if (held_repostable_event_) {
if (held_repostable_event_->type() == ui::ET_MOUSE_PRESSED) {
@@ -1141,11 +1114,8 @@ void RootWindow::DispatchHeldEvents() {
held_repostable_event_.reset(); // must be reset before dispatch
DispatchMouseEventRepost(&mouse_event);
} else {
- DCHECK(held_repostable_event_->type() == ui::ET_GESTURE_TAP_DOWN);
- ui::GestureEvent gesture_event(
- static_cast<const ui::GestureEvent&>(*held_repostable_event_.get()));
- held_repostable_event_.reset(); // must be reset before dispatch
- DispatchGestureEventRepost(&gesture_event);
+ // TODO(rbyers): GESTURE_TAP_DOWN not yet supported: crbug.com/170987.
+ NOTREACHED();
}
held_repostable_event_.reset();
}
diff --git a/ui/aura/root_window.h b/ui/aura/root_window.h
index e716dcb..d5f22df 100644
--- a/ui/aura/root_window.h
+++ b/ui/aura/root_window.h
@@ -100,7 +100,7 @@ class AURA_EXPORT RootWindow : public Window,
// Repost event for re-processing. Used when exiting context menus.
// We only support the ET_MOUSE_PRESSED and ET_GESTURE_TAP_DOWN event
- // types.
+ // types (although the latter is currently a no-op).
void RepostEvent(const ui::LocatedEvent& event);
RootWindowHostDelegate* AsRootWindowHostDelegate();
@@ -353,9 +353,6 @@ class AURA_EXPORT RootWindow : public Window,
void DispatchMouseEventRepost(ui::MouseEvent* event);
bool DispatchMouseEventToTarget(ui::MouseEvent* event, Window* target);
bool DispatchTouchEventImpl(ui::TouchEvent* event);
- // Reposts the gesture event to the Window which is a target for the event
- // passed in.
- bool DispatchGestureEventRepost(ui::GestureEvent* event);
void DispatchHeldEvents();
// Posts a task to send synthesized mouse move event if there
diff --git a/ui/aura/root_window_unittest.cc b/ui/aura/root_window_unittest.cc
index 5819305..f2cf59b 100644
--- a/ui/aura/root_window_unittest.cc
+++ b/ui/aura/root_window_unittest.cc
@@ -966,7 +966,8 @@ TEST_F(RootWindowTest, RepostTapdownGestureTest) {
0);
root_window()->RepostEvent(event);
RunAllPendingInMessageLoop();
- EXPECT_TRUE(EventTypesToString(filter->events()).find("GESTURE_TAP_DOWN") !=
+ // TODO(rbyers): Currently disabled - crbug.com/170987
+ EXPECT_FALSE(EventTypesToString(filter->events()).find("GESTURE_TAP_DOWN") !=
std::string::npos);
filter->events().clear();
}
@@ -1019,7 +1020,9 @@ class RepostGestureEventRecorder : public EventFilterRecorder {
// be received after the reposted gesture event.
TEST_F(RootWindowTest, GestureRepostEventOrder) {
// Expected events at the end for the repost_target window defined below.
- const char kExpectedTargetEvents[] = "GESTURE_BEGIN GESTURE_TAP_DOWN "
+ const char kExpectedTargetEvents[] =
+ // TODO)(rbyers): Gesture event reposting is disabled - crbug.com/279039.
+ // "GESTURE_BEGIN GESTURE_TAP_DOWN "
"TOUCH_RELEASED TOUCH_PRESSED GESTURE_BEGIN GESTURE_TAP_DOWN TOUCH_MOVED "
" GESTURE_SCROLL_BEGIN GESTURE_SCROLL_UPDATE TOUCH_MOVED "
"GESTURE_SCROLL_UPDATE TOUCH_MOVED GESTURE_SCROLL_UPDATE TOUCH_RELEASED "
@@ -1063,7 +1066,8 @@ TEST_F(RootWindowTest, GestureRepostEventOrder) {
// We expect two tap down events. One from the repost and the other one from
// the scroll sequence posted above.
- EXPECT_EQ(tap_down_count, 2);
+ // TODO(rbyers): Currently disabled - crbug.com/170987
+ EXPECT_EQ(1, tap_down_count);
EXPECT_EQ(kExpectedTargetEvents,
EventTypesToString(repost_event_recorder->events()));
diff --git a/ui/events/event.h b/ui/events/event.h
index 5e3bfef..d1eb97e 100644
--- a/ui/events/event.h
+++ b/ui/events/event.h
@@ -666,10 +666,6 @@ class EVENTS_EXPORT GestureEvent : public LocatedEvent {
// gesture. If there are no touches associated with this gesture, returns -1.
int GetLowestTouchId() const;
- unsigned int touch_ids_bitfield() const {
- return touch_ids_bitfield_;
- }
-
private:
GestureEventDetails details_;
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc
index 4a53a4a..0035ae3 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -2147,8 +2147,9 @@ void MenuController::RepostEvent(SubmenuView* source,
if (event.IsMouseEvent()) {
clone.reset(new ui::MouseEvent(static_cast<const ui::MouseEvent&>(event)));
} else if (event.IsGestureEvent()) {
- const ui::GestureEvent& ge = static_cast<const ui::GestureEvent&>(event);
- clone.reset(new ui::GestureEvent(ge));
+ // TODO(rbyers): Gesture event repost is tricky to get right
+ // crbug.com/170987.
+ return;
} else {
NOTREACHED();
return;
diff --git a/ui/views/event_utils_aura.cc b/ui/views/event_utils_aura.cc
index 054b280..9a42656 100644
--- a/ui/views/event_utils_aura.cc
+++ b/ui/views/event_utils_aura.cc
@@ -35,8 +35,9 @@ bool RepostLocatedEvent(gfx::NativeWindow window,
const ui::MouseEvent& orig = static_cast<const ui::MouseEvent&>(event);
relocated.reset(new ui::MouseEvent(orig));
} else if (event.IsGestureEvent()) {
- const ui::GestureEvent& orig = static_cast<const ui::GestureEvent&>(event);
- relocated.reset(new ui::GestureEvent(orig));
+ // TODO(rbyers): Gesture event repost is tricky to get right
+ // crbug.com/170987.
+ return false;
} else {
NOTREACHED();
return false;