Move early return out of RootView::DispatchGestureEvent()

In preparation for the eventual removal of
RootView::DispatchGestureEvent(), move an early return
out of this function and into RootView::OnEventFromSource().
This condition ignores any gesture-scroll events which were
not preceded by a ui::ET_GESTURE_SCROLL_BEGIN event.

BUG=353641
TEST=Tested by WidgetTest.GestureScrollEventDispatching

Review URL: https://codereview.chromium.org/406683002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284446 0039d316-1c4b-4281-b951-d872f2087c98
parent afb34685
...@@ -255,18 +255,32 @@ ui::EventDispatchDetails RootView::OnEventFromSource(ui::Event* event) { ...@@ -255,18 +255,32 @@ ui::EventDispatchDetails RootView::OnEventFromSource(ui::Event* event) {
// that event type has been refactored, and then // that event type has been refactored, and then
// eventually remove this function altogether. See // eventually remove this function altogether. See
// crbug.com/348083. // crbug.com/348083.
if (event->IsKeyEvent()) if (event->IsKeyEvent())
return EventProcessor::OnEventFromSource(event); return EventProcessor::OnEventFromSource(event);
else if (event->IsScrollEvent())
if (event->IsScrollEvent())
return EventProcessor::OnEventFromSource(event); return EventProcessor::OnEventFromSource(event);
else if (event->IsTouchEvent())
NOTREACHED() << "Touch events should not be sent to RootView."; 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()); 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."; NOTREACHED() << "Should not be called with a MouseEvent.";
else
NOTREACHED() << "Invalid event type.";
return DispatchDetails(); return DispatchDetails();
} }
...@@ -682,17 +696,6 @@ void RootView::DispatchGestureEvent(ui::GestureEvent* event) { ...@@ -682,17 +696,6 @@ void RootView::DispatchGestureEvent(ui::GestureEvent* event) {
return; 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; View* gesture_handler = NULL;
if (views::switches::IsRectBasedTargetingEnabled() && if (views::switches::IsRectBasedTargetingEnabled() &&
!event->details().bounding_box().IsEmpty()) { !event->details().bounding_box().IsEmpty()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment