Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(729)

Unified Diff: ui/views/widget/root_view.cc

Issue 11761005: views: Target the synthetic wheel events to the view under the mouse cursor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: aura-test Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/native_widget_aura.cc ('k') | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/root_view.cc
diff --git a/ui/views/widget/root_view.cc b/ui/views/widget/root_view.cc
index 5b0de0bc65ef63f85f4f593c24587890e4543990..12c2d12cbb37feb7b0a530af2899544f72ae886e 100644
--- a/ui/views/widget/root_view.cc
+++ b/ui/views/widget/root_view.cc
@@ -139,6 +139,30 @@ void RootView::DispatchScrollEvent(ui::ScrollEvent* event) {
v && v != this && !event->stopped_propagation(); v = v->parent()) {
v->OnScrollEvent(event);
}
+
+ if (event->handled() || event->type() != ui::ET_SCROLL)
+ return;
+
+ // Convert unprocessed scroll events into mouse-wheel events. Note that
+ // wheel events are normally sent to the focused view. However, if the focused
+ // view does not process these wheel events, then dispatch them to the view
+ // under the cursor.
+ ui::MouseWheelEvent wheel(*event);
+ if (OnMouseWheel(wheel)) {
+ event->SetHandled();
+ } else {
+ View* focused_view =
+ GetFocusManager() ? GetFocusManager()->GetFocusedView() : NULL;
+ View* v = GetEventHandlerForPoint(wheel.location());
+ if (v != focused_view) {
+ for (; v && v != this; v = v->parent()) {
+ if (v->OnMouseWheel(wheel)) {
+ event->SetHandled();
+ break;
+ }
+ }
+ }
+ }
}
void RootView::DispatchTouchEvent(ui::TouchEvent* event) {
« no previous file with comments | « ui/views/widget/native_widget_aura.cc ('k') | ui/views/widget/widget_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698