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

Unified Diff: ui/views/controls/scroll_view.cc

Issue 2197503002: Route Scroll events through a cc::InputHandler Base URL: https://chromium.googlesource.com/chromium/src.git@20160728-MacViews-ScrollWheelAsScrollEvent
Patch Set: Abandon DeliverInputForBeginFrame: will not help fix the header row Created 4 years 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 | « ui/views/controls/scroll_view.h ('k') | ui/views/controls/scrollbar/base_scroll_bar.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/scroll_view.cc
diff --git a/ui/views/controls/scroll_view.cc b/ui/views/controls/scroll_view.cc
index cf212b7c8bd3c99d10b268ab234d9acf05508a54..d619021166c2cfbdb153ee1878527df60f4000b0 100644
--- a/ui/views/controls/scroll_view.cc
+++ b/ui/views/controls/scroll_view.cc
@@ -7,6 +7,7 @@
#include "base/feature_list.h"
#include "base/logging.h"
#include "base/macros.h"
+#include "ui/compositor/overscroll/ui_scroll_input_manager.h"
#include "ui/events/event.h"
#include "ui/gfx/canvas.h"
#include "ui/native_theme/native_theme.h"
@@ -460,9 +461,13 @@ void ScrollView::OnScrollEvent(ui::ScrollEvent* event) {
if (!contents_)
return;
- // TODO(tapted): Send |event| to a cc::InputHandler. For now, there's nothing
- // to do because Widget::OnScrollEvent() will automatically process an
- // unhandled ScrollEvent as a MouseWheelEvent.
+ ui::UIScrollInputManager* compositor_scroller =
+ GetWidget()->GetCompositor()->scroll_input_manager();
+ DCHECK(compositor_scroller);
+ if (compositor_scroller->OnScrollEvent(*event, contents_->layer())) {
+ event->SetHandled();
+ event->StopPropagation();
+ }
// A direction might not be known when the event stream starts, notify both
// scrollbars that they may be about scroll, or that they may need to cancel
@@ -545,6 +550,16 @@ int ScrollView::GetScrollIncrement(ScrollBar* source, bool is_page,
contents_viewport_->height() / 5;
}
+void ScrollView::OnScrollEventFromScrollBar(ui::ScrollEvent* event) {
+ // Note that |event| can't be used for hit-testing in the cc::InputHandler
+ // as-is, since it will hit a scroll bar Layer. Layer scrolling supports that,
+ // but only if the scroll bar track and thumb Layers implement
+ // cc::ScrollbarLayerInterface. Creating one of those requires a cc::ScrollBar
+ // instance which is more than views:: really needs to care about. The
+ // following works because ScrollView explicitly passes the Layer to scroll.
+ OnScrollEvent(event);
+}
+
void ScrollView::SetHeaderOrContents(View* parent,
View* new_view,
View** member) {
« no previous file with comments | « ui/views/controls/scroll_view.h ('k') | ui/views/controls/scrollbar/base_scroll_bar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698