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

Unified Diff: third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp

Issue 1496693005: Update RootFrameViewport::userScroll to distribute scrolls between viewports. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: override scrollAnimatorEnabled in VisualViewport Created 5 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
Index: third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp b/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
index 85016be74b5a15c2f326a65e4254a439ceac12f6..115084d24b88cc75ec3e03bf84f8def21bf542fb 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
@@ -131,19 +131,18 @@ GraphicsLayer* ScrollableArea::layerForContainer() const
return layerForScrolling() ? layerForScrolling()->parent() : 0;
}
-ScrollResultOneDimensional ScrollableArea::userScroll(ScrollDirectionPhysical direction, ScrollGranularity granularity, float delta)
+ScrollbarOrientation ScrollableArea::scrollbarOrientationFromDirection(ScrollDirectionPhysical direction)
{
ScrollbarOrientation orientation;
if (direction == ScrollUp || direction == ScrollDown)
orientation = VerticalScrollbar;
bokan 2015/12/04 20:42:52 No need for the temp, just return VerticalScrollba
ymalik 2015/12/07 17:53:14 Done.
else
orientation = HorizontalScrollbar;
+ return orientation;
+}
- if (!userInputScrollable(orientation))
- return ScrollResultOneDimensional(false, delta);
-
- cancelProgrammaticScrollAnimation();
-
+float ScrollableArea::scrollStep(ScrollGranularity granularity, ScrollbarOrientation orientation) const
+{
float step = 0;
switch (granularity) {
case ScrollByLine:
@@ -160,6 +159,18 @@ ScrollResultOneDimensional ScrollableArea::userScroll(ScrollDirectionPhysical di
step = pixelStep(orientation);
break;
}
+ return step;
+}
+
+ScrollResultOneDimensional ScrollableArea::userScroll(ScrollDirectionPhysical direction, ScrollGranularity granularity, float delta)
+{
+ ScrollbarOrientation orientation = scrollbarOrientationFromDirection(direction);
+ if (!userInputScrollable(orientation))
+ return ScrollResultOneDimensional(false, delta);
+
+ cancelProgrammaticScrollAnimation();
+
+ float step = scrollStep(granularity, orientation);
if (direction == ScrollUp || direction == ScrollLeft)
delta = -delta;

Powered by Google App Engine
This is Rietveld 408576698