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

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: added function for comparison 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 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

Powered by Google App Engine
This is Rietveld 408576698