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

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

Issue 2189583004: [not for review - epic CL] Adding Elastic+Momentum+Layered scrolling to views::ScrollView Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 2 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 | « 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 68ee68fee3eaa8561e097be266a8ec202f448155..fdabd1026e2b46d322c3639bdceb95d0da4afe6a 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"
@@ -461,9 +462,13 @@ void ScrollView::OnMouseExited(const ui::MouseEvent& event) {
void ScrollView::OnScrollEvent(ui::ScrollEvent* event) {
#if defined(OS_MACOSX)
- // 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)) {
+ event->SetHandled();
+ event->StopPropagation();
+ }
#endif
}
@@ -538,6 +543,19 @@ int ScrollView::GetScrollIncrement(ScrollBar* source, bool is_page,
contents_viewport_->height() / 5;
}
+void ScrollView::OnScrollEventFromScrollBar(ui::ScrollEvent* event) {
+ // If the scroll event is passed to the cc::InputHandler as-is, then 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. For now, cheat a little and pretend
+ // events are coming from the point (0, 0) on the viewport.
+ gfx::Point location;
+ ConvertPointToWidget(contents_viewport_, &location);
+ event->set_location(location);
+ 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