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

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: 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..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()) {
« 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