OLD | NEW |
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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 event->SetHandled(); | 281 event->SetHandled(); |
282 return; | 282 return; |
283 } | 283 } |
284 } | 284 } |
285 scroll_gesture_handler_ = NULL; | 285 scroll_gesture_handler_ = NULL; |
286 } | 286 } |
287 | 287 |
288 return; | 288 return; |
289 } | 289 } |
290 | 290 |
| 291 // If there was no handler for a SCROLL_BEGIN event, then subsequent scroll |
| 292 // events are not dispatched to any views. |
| 293 switch (event->type()) { |
| 294 case ui::ET_GESTURE_SCROLL_UPDATE: |
| 295 case ui::ET_GESTURE_SCROLL_END: |
| 296 case ui::ET_SCROLL_FLING_START: |
| 297 return; |
| 298 default: |
| 299 break; |
| 300 } |
| 301 |
291 // Walk up the tree until we find a view that wants the gesture event. | 302 // Walk up the tree until we find a view that wants the gesture event. |
292 for (gesture_handler_ = GetEventHandlerForPoint(event->location()); | 303 for (gesture_handler_ = GetEventHandlerForPoint(event->location()); |
293 gesture_handler_ && (gesture_handler_ != this); | 304 gesture_handler_ && (gesture_handler_ != this); |
294 gesture_handler_ = gesture_handler_->parent()) { | 305 gesture_handler_ = gesture_handler_->parent()) { |
295 if (!gesture_handler_->enabled()) { | 306 if (!gesture_handler_->enabled()) { |
296 // Disabled views eat events but are treated as not handled. | 307 // Disabled views eat events but are treated as not handled. |
297 return; | 308 return; |
298 } | 309 } |
299 | 310 |
300 // See if this view wants to handle the Gesture. | 311 // See if this view wants to handle the Gesture. |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 } | 662 } |
652 | 663 |
653 void RootView::SetMouseLocationAndFlags(const ui::MouseEvent& event) { | 664 void RootView::SetMouseLocationAndFlags(const ui::MouseEvent& event) { |
654 last_mouse_event_flags_ = event.flags(); | 665 last_mouse_event_flags_ = event.flags(); |
655 last_mouse_event_x_ = event.x(); | 666 last_mouse_event_x_ = event.x(); |
656 last_mouse_event_y_ = event.y(); | 667 last_mouse_event_y_ = event.y(); |
657 } | 668 } |
658 | 669 |
659 } // namespace internal | 670 } // namespace internal |
660 } // namespace views | 671 } // namespace views |
OLD | NEW |