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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/widget/root_view.h" 5 #include "ui/views/widget/root_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 if (consumed) 133 if (consumed)
134 event->StopPropagation(); 134 event->StopPropagation();
135 } 135 }
136 136
137 void RootView::DispatchScrollEvent(ui::ScrollEvent* event) { 137 void RootView::DispatchScrollEvent(ui::ScrollEvent* event) {
138 for (View* v = GetEventHandlerForPoint(event->location()); 138 for (View* v = GetEventHandlerForPoint(event->location());
139 v && v != this && !event->stopped_propagation(); v = v->parent()) { 139 v && v != this && !event->stopped_propagation(); v = v->parent()) {
140 v->OnScrollEvent(event); 140 v->OnScrollEvent(event);
141 } 141 }
142
143 if (event->handled() || event->type() != ui::ET_SCROLL)
144 return;
145
146 // Convert unprocessed scroll events into mouse-wheel events. Note that
147 // wheel events are normally sent to the focused view. However, if the focused
148 // view does not process these wheel events, then dispatch them to the view
149 // under the cursor.
150 ui::MouseWheelEvent wheel(*event);
151 if (OnMouseWheel(wheel)) {
152 event->SetHandled();
153 } else {
154 View* focused_view =
155 GetFocusManager() ? GetFocusManager()->GetFocusedView() : NULL;
156 View* v = GetEventHandlerForPoint(wheel.location());
157 if (v != focused_view) {
158 for (; v && v != this; v = v->parent()) {
159 if (v->OnMouseWheel(wheel)) {
160 event->SetHandled();
161 break;
162 }
163 }
164 }
165 }
142 } 166 }
143 167
144 void RootView::DispatchTouchEvent(ui::TouchEvent* event) { 168 void RootView::DispatchTouchEvent(ui::TouchEvent* event) {
145 // TODO: this looks all wrong. On a TOUCH_PRESSED we should figure out the 169 // TODO: this looks all wrong. On a TOUCH_PRESSED we should figure out the
146 // view and target that view with all touches with the same id until the 170 // view and target that view with all touches with the same id until the
147 // release (or keep it if captured). 171 // release (or keep it if captured).
148 172
149 // If touch_pressed_handler_ is non null, we are currently processing 173 // If touch_pressed_handler_ is non null, we are currently processing
150 // a touch down on the screen situation. In that case we send the 174 // a touch down on the screen situation. In that case we send the
151 // event to touch_pressed_handler_ 175 // event to touch_pressed_handler_
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 } 651 }
628 652
629 void RootView::SetMouseLocationAndFlags(const ui::MouseEvent& event) { 653 void RootView::SetMouseLocationAndFlags(const ui::MouseEvent& event) {
630 last_mouse_event_flags_ = event.flags(); 654 last_mouse_event_flags_ = event.flags();
631 last_mouse_event_x_ = event.x(); 655 last_mouse_event_x_ = event.x();
632 last_mouse_event_y_ = event.y(); 656 last_mouse_event_y_ = event.y();
633 } 657 }
634 658
635 } // namespace internal 659 } // namespace internal
636 } // namespace views 660 } // namespace views
OLDNEW
« 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