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

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: No Overscroll on non-scrollable axes 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
« no previous file with comments | « Source/core/frame/LocalFrame.h ('k') | Source/core/frame/RootFrameViewport.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/LocalFrame.cpp
diff --git a/Source/core/frame/LocalFrame.cpp b/Source/core/frame/LocalFrame.cpp
index 5b711fc47e11e041234ce5b1493ea2468f11f840..938814d49ae4884e0ab629fe66a985fb47f16c79 100644
--- a/Source/core/frame/LocalFrame.cpp
+++ b/Source/core/frame/LocalFrame.cpp
@@ -713,21 +713,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, view.scrollSize(HorizontalScrollbar) ? horizontal.unusedScrollDelta : 0.0f, view.scrollSize(VerticalScrollbar) ? vertical.unusedScrollDelta : 0.0f);
MuVen 2015/06/03 09:32:18 If scroll size is "0" unusedDelta is set to "0" so
}
-// 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;
@@ -736,14 +735,12 @@ bool LocalFrame::applyScrollDelta(const FloatSize& delta, bool isScrollBegin)
remainingDelta = host()->topControls().scrollBy(remainingDelta);
if (remainingDelta.isZero())
- return true;
-
- bool consumed = remainingDelta != delta;
-
- if (scrollAreaOnBothAxes(remainingDelta, *view()->scrollableArea()))
- return true;
+ return ScrollResult(delta.width(), delta.height(), 0.0f, 0.0f);
- return consumed;
+ ScrollResult result = scrollAreaOnBothAxes(remainingDelta, *view()->scrollableArea());
+ result.didScrollX = result.didScrollX || (remainingDelta.width() != delta.width());
+ result.didScrollY = result.didScrollY || (remainingDelta.height() != delta.height());
+ return result;
}
bool LocalFrame::shouldScrollTopControls(const FloatSize& delta) const
« no previous file with comments | « Source/core/frame/LocalFrame.h ('k') | Source/core/frame/RootFrameViewport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698