Chromium Code Reviews| Index: Source/core/frame/LocalFrame.cpp |
| diff --git a/Source/core/frame/LocalFrame.cpp b/Source/core/frame/LocalFrame.cpp |
| index 103113f0c0b1d79e536d728f03305d4ed9146a4c..eaeff417dc4ed58f5ebf3d8f7a6d5a56e032d0b1 100644 |
| --- a/Source/core/frame/LocalFrame.cpp |
| +++ b/Source/core/frame/LocalFrame.cpp |
| @@ -718,21 +718,21 @@ void LocalFrame::removeSpellingMarkersUnderWords(const Vector<String>& words) |
| spellChecker().removeSpellingMarkersUnderWords(words); |
| } |
| -static bool scrollAreaOnBothAxes(const FloatSize& delta, ScrollableArea& view) |
| +static ScrollResult scrollAreaOnBothAxes(const FloatSize& delta, ScrollableArea& view) |
| { |
| - bool scrolledHorizontal = view.scroll(ScrollLeft, ScrollByPrecisePixel, delta.width()); |
| - bool scrolledVertical = view.scroll(ScrollUp, ScrollByPrecisePixel, delta.height()); |
| - return scrolledHorizontal || scrolledVertical; |
| + ScrollResultOneDimensional horizontal = view.scroll(ScrollLeft, ScrollByPrecisePixel, delta.width()); |
| + ScrollResultOneDimensional vertical = view.scroll(ScrollUp, ScrollByPrecisePixel, delta.height()); |
| + return ScrollResult((horizontal.didScroll || vertical.didScroll), horizontal.unusedScrollDelta, vertical.unusedScrollDelta); |
| } |
| -// Returns true if a scroll occurred. |
| -bool LocalFrame::applyScrollDelta(const FloatSize& delta, bool isScrollBegin) |
| +// Returns ScrollResult. |
|
majidvp
2015/05/27 14:37:23
nit: this comment no longer conveys any useful inf
MuVen
2015/05/29 09:37:15
Done.
|
| +ScrollResult LocalFrame::applyScrollDelta(const FloatSize& delta, bool isScrollBegin) |
| { |
| if (isScrollBegin) |
| host()->topControls().scrollBegin(); |
| if (!view() || delta.isZero()) |
| - return false; |
| + return ScrollResult(false, delta.width(), delta.height()); |
| FloatSize remainingDelta = delta; |
| @@ -741,14 +741,15 @@ bool LocalFrame::applyScrollDelta(const FloatSize& delta, bool isScrollBegin) |
| remainingDelta = host()->topControls().scrollBy(remainingDelta); |
| if (remainingDelta.isZero()) |
| - return true; |
| + return ScrollResult(true); |
| - bool consumed = remainingDelta != delta; |
| + ScrollResult result = scrollAreaOnBothAxes(remainingDelta, *view()->scrollableArea()); |
| - if (scrollAreaOnBothAxes(remainingDelta, *view()->scrollableArea())) |
| - return true; |
| + if (result.didScroll) |
| + return result; |
| - return consumed; |
| + result.didScroll = remainingDelta != delta; |
| + return result; |
| } |
| bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const |