summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortdanderson@google.com <tdanderson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-15 18:42:35 +0000
committertdanderson@google.com <tdanderson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-15 18:42:35 +0000
commitfda7b0eee218e60f690bfca6d2068a696bc13e7b (patch)
tree5c9fd946275a78adb9a4914be1cd0afdab0b5ceb
parent5edee018a7b8d98376ccfccdc73cf14a94ccbde3 (diff)
downloadchromium_src-fda7b0eee218e60f690bfca6d2068a696bc13e7b.zip
chromium_src-fda7b0eee218e60f690bfca6d2068a696bc13e7b.tar.gz
chromium_src-fda7b0eee218e60f690bfca6d2068a696bc13e7b.tar.bz2
Merge 289152 "Do not dispatch gestures to a NULL aura::Window ta..."
> Do not dispatch gestures to a NULL aura::Window target > > It is possible for the gesture recognizer to report > a NULL target for a gesture event, in which case > we should not attempt event dispatch. An early return > already exists in > WindowEventDispatcher::DispatchGestureEvent() to > guard against this possibility, so add a similar > check to WindowEventDispatcher::ProcessGestures(). > > BUG=384962 > TEST=WindowEventDispatcherTest.CallToProcessedTouchEvent > > Review URL: https://codereview.chromium.org/450413002 TBR=tdanderson@chromium.org Review URL: https://codereview.chromium.org/478743002 git-svn-id: svn://svn.chromium.org/chrome/branches/2062/src@289953 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ui/aura/window_event_dispatcher.cc3
-rw-r--r--ui/aura/window_event_dispatcher_unittest.cc13
2 files changed, 16 insertions, 0 deletions
diff --git a/ui/aura/window_event_dispatcher.cc b/ui/aura/window_event_dispatcher.cc
index 87d25b1..5cf693d 100644
--- a/ui/aura/window_event_dispatcher.cc
+++ b/ui/aura/window_event_dispatcher.cc
@@ -281,6 +281,9 @@ ui::EventDispatchDetails WindowEventDispatcher::ProcessGestures(
return details;
Window* target = GetGestureTarget(gestures->get().at(0));
+ if (!target)
+ return details;
+
for (size_t i = 0; i < gestures->size(); ++i) {
ui::GestureEvent* event = gestures->get().at(i);
event->ConvertLocationToTarget(window(), target);
diff --git a/ui/aura/window_event_dispatcher_unittest.cc b/ui/aura/window_event_dispatcher_unittest.cc
index 11eeaa0..23e0b23 100644
--- a/ui/aura/window_event_dispatcher_unittest.cc
+++ b/ui/aura/window_event_dispatcher_unittest.cc
@@ -776,6 +776,19 @@ TEST_F(WindowEventDispatcherTest, TouchMovesHeld) {
EXPECT_TRUE(recorder.events().empty());
}
+// Verifies that a direct call to ProcessedTouchEvent() with a
+// TOUCH_PRESSED event does not cause a crash.
+TEST_F(WindowEventDispatcherTest, CallToProcessedTouchEvent) {
+ test::TestWindowDelegate delegate;
+ scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(
+ &delegate, 1, gfx::Rect(50, 50, 100, 100), root_window()));
+
+ ui::TouchEvent touch(
+ ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 1, ui::EventTimeForNow());
+ host()->dispatcher()->ProcessedTouchEvent(
+ &touch, window.get(), ui::ER_UNHANDLED);
+}
+
// This event handler requests the dispatcher to start holding pointer-move
// events when it receives the first scroll-update gesture.
class HoldPointerOnScrollHandler : public ui::test::TestEventHandler {