Chromium Code Reviews| Index: ui/views/widget/root_view.cc |
| diff --git a/ui/views/widget/root_view.cc b/ui/views/widget/root_view.cc |
| index 5d52e8d62c2b18d1e170a1fb4a45e0f2b5b56018..c55792aed4c6d42845b0a413acf73f3c60c6ece3 100644 |
| --- a/ui/views/widget/root_view.cc |
| +++ b/ui/views/widget/root_view.cc |
| @@ -255,18 +255,28 @@ ui::EventDispatchDetails RootView::OnEventFromSource(ui::Event* event) { |
| // that event type has been refactored, and then |
| // eventually remove this function altogether. See |
| // crbug.com/348083. |
| - if (event->IsKeyEvent()) |
| + if (event->IsKeyEvent()) { |
| return EventProcessor::OnEventFromSource(event); |
| - else if (event->IsScrollEvent()) |
| + } else if (event->IsScrollEvent()) { |
| return EventProcessor::OnEventFromSource(event); |
| - else if (event->IsTouchEvent()) |
| + } else if (event->IsTouchEvent()) { |
| NOTREACHED() << "Touch events should not be sent to RootView."; |
| - else if (event->IsGestureEvent()) |
| + } else if (event->IsGestureEvent()) { |
| + // Ignore subsequent gesture scroll events if no handler was set for a |
| + // ui::ET_GESTURE_SCROLL_BEGIN event. |
| + if (!gesture_handler_ && |
| + (event->type() == ui::ET_GESTURE_SCROLL_UPDATE || |
| + event->type() == ui::ET_GESTURE_SCROLL_END || |
| + event->type() == ui::ET_SCROLL_FLING_START)) { |
| + return DispatchDetails(); |
| + } |
| + |
| DispatchGestureEvent(event->AsGestureEvent()); |
| - else if (event->IsMouseEvent()) |
| + } else if (event->IsMouseEvent()) { |
| NOTREACHED() << "Should not be called with a MouseEvent."; |
| - else |
| + } else { |
| NOTREACHED() << "Invalid event type."; |
| + } |
|
sadrul
2014/07/21 06:40:30
Let's get rid of the elses in this block:
if (ke
tdanderson
2014/07/21 14:27:40
Done.
|
| return DispatchDetails(); |
| } |
| @@ -682,17 +692,6 @@ void RootView::DispatchGestureEvent(ui::GestureEvent* event) { |
| return; |
| } |
| - // If there was no handler for a SCROLL_BEGIN event, then subsequent scroll |
| - // events are not dispatched to any views. |
| - switch (event->type()) { |
| - case ui::ET_GESTURE_SCROLL_UPDATE: |
| - case ui::ET_GESTURE_SCROLL_END: |
| - case ui::ET_SCROLL_FLING_START: |
| - return; |
| - default: |
| - break; |
| - } |
| - |
| View* gesture_handler = NULL; |
| if (views::switches::IsRectBasedTargetingEnabled() && |
| !event->details().bounding_box().IsEmpty()) { |