Chromium Code Reviews| Index: Source/core/frame/LocalFrame.cpp |
| diff --git a/Source/core/frame/LocalFrame.cpp b/Source/core/frame/LocalFrame.cpp |
| index f5a0e0366599c39e4b4a3ddcb51b16f1987cdc8a..42272dc4f302ee88057fe67eb549dd30b365d281 100644 |
| --- a/Source/core/frame/LocalFrame.cpp |
| +++ b/Source/core/frame/LocalFrame.cpp |
| @@ -714,21 +714,20 @@ 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) |
| +ScrollResult LocalFrame::applyScrollDelta(const FloatSize& delta, bool isScrollBegin) |
| { |
| if (isScrollBegin) |
| host()->topControls().scrollBegin(); |
| if (!view() || delta.isZero()) |
| - return false; |
| + return ScrollResult(false, false, delta.width(), delta.height()); |
| FloatSize remainingDelta = delta; |
| @@ -737,14 +736,16 @@ bool LocalFrame::applyScrollDelta(const FloatSize& delta, bool isScrollBegin) |
| remainingDelta = host()->topControls().scrollBy(remainingDelta); |
| if (remainingDelta.isZero()) |
| - return true; |
| + return ScrollResult(delta.width(), delta.height(), 0.0f, 0.0f); |
|
MuVen
2015/06/02 09:04:00
Even this returns didScrollX, didScrollY. ple let
majidvp
2015/06/02 17:00:31
This looks reasonable.
MuVen
2015/06/03 09:32:18
Done.
|
| - bool consumed = remainingDelta != delta; |
| + ScrollResult result = scrollAreaOnBothAxes(remainingDelta, *view()->scrollableArea()); |
| - if (scrollAreaOnBothAxes(remainingDelta, *view()->scrollableArea())) |
| - return true; |
| + if (result.didScroll()) |
| + return result; |
|
majidvp
2015/06/02 17:00:31
I believe this is no longer correct. Consider this
MuVen
2015/06/03 09:32:18
Done.
|
| - return consumed; |
| + result.didScrollX = remainingDelta.width() != delta.width(); |
| + result.didScrollY = remainingDelta.height() != delta.height(); |
|
majidvp
2015/06/02 17:00:31
If you get rid of the conditional above and replac
MuVen
2015/06/03 09:32:18
Done.
|
| + return result; |
| } |
| bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const |