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

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: 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
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/ScrollableArea.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9768a4e66bc8573ec6f2f0f31419c83faa4ed4ae..71d380fbc75cdcf76b60798dbd9d051a52158c36 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
@@ -130,35 +130,38 @@ GraphicsLayer* ScrollableArea::layerForContainer() const
return layerForScrolling() ? layerForScrolling()->parent() : 0;
}
-ScrollResultOneDimensional ScrollableArea::userScroll(ScrollDirectionPhysical direction, ScrollGranularity granularity, float delta)
+ScrollbarOrientation ScrollableArea::scrollbarOrientationFromDirection(ScrollDirectionPhysical direction) const
{
- ScrollbarOrientation orientation;
- if (direction == ScrollUp || direction == ScrollDown)
- orientation = VerticalScrollbar;
- else
- orientation = HorizontalScrollbar;
-
- if (!userInputScrollable(orientation))
- return ScrollResultOneDimensional(false, delta);
-
- cancelProgrammaticScrollAnimation();
+ return (direction == ScrollUp || direction == ScrollDown) ? VerticalScrollbar : HorizontalScrollbar;
+}
- float step = 0;
+float ScrollableArea::scrollStep(ScrollGranularity granularity, ScrollbarOrientation orientation) const
+{
switch (granularity) {
case ScrollByLine:
- step = lineStep(orientation);
- break;
+ return lineStep(orientation);
case ScrollByPage:
- step = pageStep(orientation);
- break;
+ return pageStep(orientation);
case ScrollByDocument:
- step = documentStep(orientation);
- break;
+ return documentStep(orientation);
case ScrollByPixel:
case ScrollByPrecisePixel:
- step = pixelStep(orientation);
- break;
+ return pixelStep(orientation);
+ default:
+ ASSERT_NOT_REACHED();
+ return 0.0f;
}
+}
+
+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;
« no previous file with comments | « third_party/WebKit/Source/platform/scroll/ScrollableArea.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698