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

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

Issue 406683002: Move early return out of RootView::DispatchGestureEvent() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments addressed Created 6 years, 5 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 | « no previous file | no next file » | 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 5d52e8d62c2b18d1e170a1fb4a45e0f2b5b56018..4fdd553af643dd8e5b386f4240774bb76cabd29f 100644
--- a/ui/views/widget/root_view.cc
+++ b/ui/views/widget/root_view.cc
@@ -255,18 +255,32 @@ 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())
return EventProcessor::OnEventFromSource(event);
- else if (event->IsScrollEvent())
+
+ if (event->IsScrollEvent())
return EventProcessor::OnEventFromSource(event);
- else if (event->IsTouchEvent())
- NOTREACHED() << "Touch events should not be sent to RootView.";
- else if (event->IsGestureEvent())
+
+ 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())
+ return DispatchDetails();
+ }
+
+ if (event->IsTouchEvent())
+ NOTREACHED() << "Touch events should not be sent to RootView.";
+
+ if (event->IsMouseEvent())
NOTREACHED() << "Should not be called with a MouseEvent.";
- else
- NOTREACHED() << "Invalid event type.";
return DispatchDetails();
}
@@ -682,17 +696,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()) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698