Commit c00a606f authored by xiyuan's avatar xiyuan Committed by Commit bot

arc: Fix mouse scroll on notification

Forward ScrollEvent/MouseWheelEvent to the hosting widget so that
it is processed and reaches the containing ScrollView.

Also not forward touch events to ArcCustomNotificationView since
a View is not supposed to receive touch events. This gets rid of
the NOTREACHED() warning in chrome log.

BUG=b/31115616
BUG=642501

Review-Url: https://codereview.chromium.org/2291193003
Cr-Commit-Position: refs/heads/master@{#415708}
parent 7e3bccf3
...@@ -40,8 +40,34 @@ class ArcCustomNotificationView::EventForwarder : public ui::EventHandler { ...@@ -40,8 +40,34 @@ class ArcCustomNotificationView::EventForwarder : public ui::EventHandler {
return; return;
} }
if (event->IsScrollEvent()) {
ForwardScrollEvent(event->AsScrollEvent());
} else if (event->IsMouseWheelEvent()) {
ForwardMouseWheelEvent(event->AsMouseWheelEvent());
} else if (!event->IsTouchEvent()) {
// Forward the rest events to |owner_| except touches because View
// should no longer receive touch events. See View::OnTouchEvent.
owner_->OnEvent(event); owner_->OnEvent(event);
} }
}
void ForwardScrollEvent(ui::ScrollEvent* event) {
views::Widget* widget = owner_->GetWidget();
if (!widget)
return;
event->target()->ConvertEventToTarget(widget->GetNativeWindow(), event);
widget->OnScrollEvent(event);
}
void ForwardMouseWheelEvent(ui::MouseWheelEvent* event) {
views::Widget* widget = owner_->GetWidget();
if (!widget)
return;
event->target()->ConvertEventToTarget(widget->GetNativeWindow(), event);
widget->OnMouseEvent(event);
}
ArcCustomNotificationView* const owner_; ArcCustomNotificationView* const owner_;
......
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