summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authormazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-31 05:58:42 +0000
committermazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-31 05:58:42 +0000
commitd2e66ce57ab4b9ef93d17cd7c42cc0a3c29744ba (patch)
treee05fd7ef660d70b5c37cfc10a70f36277289033b /ui
parent3243beed152cd2eb03d39aa9ef1e95c1645fa109 (diff)
downloadchromium_src-d2e66ce57ab4b9ef93d17cd7c42cc0a3c29744ba.zip
chromium_src-d2e66ce57ab4b9ef93d17cd7c42cc0a3c29744ba.tar.gz
chromium_src-d2e66ce57ab4b9ef93d17cd7c42cc0a3c29744ba.tar.bz2
Revert 154383 - Avoid copying mouse events where possible in RootWindow.
This broke CompoundEventFilterTest.TouchHidesCursor test. This CL adds ConvertLocationToTarget to LocatedEvent and uses it to avoid unnecessary copies. Copying a mouse event nullifies its native events. That's a problematic for EventRewriter because it cannot know if Search key is pressed while mouse click without NativeEvent (Information on whether Search key is pressed is lost). EventRewriter needs to know whether Search key is pressed for remapping Search key to other modifier keys based on user's modifier key remapping settings. EventRewriter also remaps Alt+Left mouse button to Right mouse button, so the fix is needed to handle it properly. BUG=145242, 145385 Review URL: https://chromiumcodereview.appspot.com/10890041 TBR=mazda@chromium.org Review URL: https://chromiumcodereview.appspot.com/10916046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154392 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/aura/root_window.cc24
-rw-r--r--ui/base/event.h8
2 files changed, 18 insertions, 14 deletions
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc
index 41b97422..eb7b07d 100644
--- a/ui/aura/root_window.cc
+++ b/ui/aura/root_window.cc
@@ -300,8 +300,9 @@ bool RootWindow::DispatchGestureEvent(ui::GestureEvent* event) {
}
if (target) {
- event->ConvertLocationToTarget(static_cast<Window*>(this), target);
- ui::GestureStatus status = ProcessGestureEvent(target, event);
+ ui::GestureEvent translated_event(
+ *event, static_cast<Window*>(this), target);
+ ui::GestureStatus status = ProcessGestureEvent(target, &translated_event);
return status != ui::GESTURE_STATUS_UNKNOWN;
}
@@ -931,9 +932,9 @@ bool RootWindow::OnHostScrollEvent(ui::ScrollEvent* event) {
Window::ConvertPointToTarget(this, target, &location_in_window);
if (IsNonClientLocation(target, location_in_window))
flags |= ui::EF_IS_NON_CLIENT;
- event->set_flags(flags);
- event->ConvertLocationToTarget(static_cast<Window*>(this), target);
- return ProcessMouseEvent(target, event);
+ ui::ScrollEvent translated_event(
+ *event, static_cast<Window*>(this), target, event->type(), flags);
+ return ProcessMouseEvent(target, &translated_event);
}
return false;
}
@@ -1096,9 +1097,16 @@ bool RootWindow::DispatchMouseEventToTarget(ui::MouseEvent* event,
Window::ConvertPointToTarget(this, target, &location_in_window);
if (IsNonClientLocation(target, location_in_window))
flags |= ui::EF_IS_NON_CLIENT;
- event->set_flags(flags);
- event->ConvertLocationToTarget(static_cast<Window*>(this), target);
- return ProcessMouseEvent(target, event);
+ if (event->type() == ui::ET_MOUSEWHEEL) {
+ ui::MouseWheelEvent translated_event(
+ *static_cast<ui::MouseWheelEvent*>(event),
+ static_cast<Window*>(this), target, event->type(), flags);
+ return ProcessMouseEvent(target, &translated_event);
+ } else {
+ ui::MouseEvent translated_event(
+ *event, static_cast<Window*>(this), target, event->type(), flags);
+ return ProcessMouseEvent(target, &translated_event);
+ }
}
return false;
}
diff --git a/ui/base/event.h b/ui/base/event.h
index 5905aa2..bc388e3 100644
--- a/ui/base/event.h
+++ b/ui/base/event.h
@@ -147,11 +147,6 @@ class UI_EXPORT LocatedEvent : public Event {
// This is applied to both |location_| and |root_location_|.
virtual void UpdateForRootTransform(const Transform& root_transform);
- template <class T> void ConvertLocationToTarget(T* source, T* target) {
- if (target && target != source)
- T::ConvertPointToTarget(source, target, &location_);
- }
-
protected:
explicit LocatedEvent(const base::NativeEvent& native_event);
@@ -167,7 +162,8 @@ class UI_EXPORT LocatedEvent : public Event {
system_location_(model.system_location_) {
// TODO(erg): May need to create system_location_ by converting location to
// system coordinates here.
- ConvertLocationToTarget(source, target);
+ if (target && target != source)
+ T::ConvertPointToTarget(source, target, &location_);
}
// Used for synthetic events in testing.