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

Unified Diff: Source/core/frame/LocalFrame.cpp

Issue 1056983004: OverscrollGlow for mainThread-{BLINK CHANGES} (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 months 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
Index: Source/core/frame/LocalFrame.cpp
diff --git a/Source/core/frame/LocalFrame.cpp b/Source/core/frame/LocalFrame.cpp
index f5a0e0366599c39e4b4a3ddcb51b16f1987cdc8a..a654381bc9f47ac646da5a0888829a297b09626a 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, delta.width(), delta.height());
FloatSize remainingDelta = delta;
@@ -737,14 +736,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

Powered by Google App Engine
This is Rietveld 408576698