| 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;
|
|
|