summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-22 04:06:19 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-22 04:06:19 +0000
commit26f4694825ed31bd0e01856d2c3654d935d1a1fc (patch)
tree18fc1f1e14ada2eefcd36e39d3e253cf193e89c2 /ui
parentc7c1e4d47f1360ec834cbe45eb6afba7bb946b35 (diff)
downloadchromium_src-26f4694825ed31bd0e01856d2c3654d935d1a1fc.zip
chromium_src-26f4694825ed31bd0e01856d2c3654d935d1a1fc.tar.gz
chromium_src-26f4694825ed31bd0e01856d2c3654d935d1a1fc.tar.bz2
aura: Add some checks trying to find the cause of a crash.
BUG=133963 Review URL: https://chromiumcodereview.appspot.com/10836310 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152723 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/aura/root_window.cc14
-rw-r--r--ui/aura/root_window.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc
index e12e36c..2e216b9 100644
--- a/ui/aura/root_window.cc
+++ b/ui/aura/root_window.cc
@@ -6,6 +6,7 @@
#include <vector>
+#include "base/auto_reset.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/debug/trace_event.h"
@@ -118,6 +119,7 @@ RootWindow::RootWindow(const gfx::Rect& initial_bounds)
last_cursor_(ui::kCursorNull),
mouse_pressed_handler_(NULL),
mouse_moved_handler_(NULL),
+ mouse_event_dispatch_target_(NULL),
ALLOW_THIS_IN_INITIALIZER_LIST(
gesture_recognizer_(ui::GestureRecognizer::Create(this))),
synthesize_mouse_move_(false),
@@ -589,6 +591,12 @@ void RootWindow::HandleMouseMoved(const ui::MouseEvent& event, Window* target) {
event.flags());
ProcessMouseEvent(mouse_moved_handler_, &translated_event);
}
+
+ if (mouse_event_dispatch_target_ != target) {
+ mouse_moved_handler_ = NULL;
+ return;
+ }
+
mouse_moved_handler_ = target;
// Send an entered event.
if (mouse_moved_handler_ && mouse_moved_handler_->delegate()) {
@@ -755,6 +763,8 @@ void RootWindow::OnWindowHidden(Window* invisible, bool destroyed) {
mouse_pressed_handler_ = NULL;
if (invisible->Contains(mouse_moved_handler_))
mouse_moved_handler_ = NULL;
+ if (invisible->Contains(mouse_event_dispatch_target_))
+ mouse_event_dispatch_target_ = NULL;
gesture_recognizer_->FlushTouchQueue(invisible);
}
@@ -976,11 +986,15 @@ bool RootWindow::DispatchMouseEventToTarget(ui::MouseEvent* event,
ui::EF_LEFT_MOUSE_BUTTON |
ui::EF_MIDDLE_MOUSE_BUTTON |
ui::EF_RIGHT_MOUSE_BUTTON;
+ AutoReset<Window*> reset(&mouse_event_dispatch_target_, target);
SetLastMouseLocation(this, event->location());
synthesize_mouse_move_ = false;
switch (event->type()) {
case ui::ET_MOUSE_MOVED:
+ mouse_event_dispatch_target_ = target;
HandleMouseMoved(*event, target);
+ if (mouse_event_dispatch_target_ != target)
+ return false;
break;
case ui::ET_MOUSE_PRESSED:
if (!mouse_pressed_handler_)
diff --git a/ui/aura/root_window.h b/ui/aura/root_window.h
index 9f4b9f1..2f5b795 100644
--- a/ui/aura/root_window.h
+++ b/ui/aura/root_window.h
@@ -368,6 +368,7 @@ class AURA_EXPORT RootWindow : public ui::CompositorDelegate,
Window* mouse_pressed_handler_;
Window* mouse_moved_handler_;
+ Window* mouse_event_dispatch_target_;
FocusManager* focus_manager_;
// The gesture_recognizer_ for this.