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

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: update test expectation 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 14086dc9317f532ec5a0990aaaec68201984456a..0c606f8677f83dc20e4d44b6a7b86a7a64340c80 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
@@ -130,19 +130,13 @@ 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 ScrollableArea::scrollStep(ScrollGranularity granularity, ScrollbarOrientation orientation) const
+{
float step = 0;
switch (granularity) {
case ScrollByLine:
@@ -159,6 +153,18 @@ ScrollResultOneDimensional ScrollableArea::userScroll(ScrollDirectionPhysical di
step = pixelStep(orientation);
jbroman 2015/12/09 15:29:35 nit: This line is unreachable; please remove dupli
jbroman 2015/12/09 15:31:22 If this line isn't duplicated in your code, please
ymalik 2015/12/09 15:59:42 Yes. Not duplicated. Moved to using return. Thanks
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;
« 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