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

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: modified logic/tests 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..42a8bd732f62eac0ffdaf40dbfee444ee70a5a49 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.
majidvp 2015/05/14 21:08:39 Please update the comment to reflect change.
MuVen 2015/05/26 09:58:35 Done.
-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;
@@ -741,14 +741,16 @@ 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;
+ remainingDelta.setWidth(result.unusedScrollDeltaX);
+ remainingDelta.setHeight(result.unusedScrollDeltaY);
+ return ScrollResult(remainingDelta != delta, remainingDelta.width(), remainingDelta.height());
majidvp 2015/05/14 21:08:39 This is more readable and avoids an extra construc
MuVen 2015/05/26 09:58:35 Done.
}
bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const

Powered by Google App Engine
This is Rietveld 408576698