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

Unified Diff: Source/core/layout/LayoutBox.cpp

Issue 1056983004: OverscrollGlow for mainThread-{BLINK CHANGES} (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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/layout/LayoutBox.cpp
diff --git a/Source/core/layout/LayoutBox.cpp b/Source/core/layout/LayoutBox.cpp
index 4d91b4bd9785c37212fafd5e1afd160030a4e709..70a83d173130355aeb3717bd4cee3498de80d346 100644
--- a/Source/core/layout/LayoutBox.cpp
+++ b/Source/core/layout/LayoutBox.cpp
@@ -100,6 +100,7 @@ static bool skipBodyBackground(const LayoutBox* bodyElementRenderer)
LayoutBox::LayoutBox(ContainerNode* node)
: LayoutBoxModelObject(node)
+ , m_unusedDelta(IntPoint())
, m_intrinsicContentLogicalHeight(-1)
, m_minPreferredLogicalWidth(-1)
, m_maxPreferredLogicalWidth(-1)
@@ -746,7 +747,15 @@ bool LayoutBox::scroll(ScrollDirection direction, ScrollGranularity granularity,
if (!layer() || !layer()->scrollableArea())
return false;
- return layer()->scrollableArea()->scroll(direction, granularity, delta);
+ Scrollbar* scrollbar = (direction == ScrollUp || direction == ScrollDown) ? layer()->scrollableArea()->verticalScrollbar() : layer()->scrollableArea()->horizontalScrollbar();
+ IntPoint initialPoint = scrollbar ? layer()->scrollableArea()->convertFromScrollbarToContainingView(scrollbar, layer()->scrollableArea()->scrollPosition()) : IntPoint();
+ bool didScroll = layer()->scrollableArea()->scroll(direction, granularity, delta);
+ IntPoint afterScrollPoint = scrollbar ? layer()->scrollableArea()->convertFromScrollbarToContainingView(scrollbar, layer()->scrollableArea()->scrollPosition()) : IntPoint();
+ if (direction == ScrollUp || direction == ScrollDown)
+ m_unusedDelta.setY(((afterScrollPoint.y() - initialPoint.y()) + delta) * -1);
+ else if (direction == ScrollLeft || direction == ScrollRight)
+ m_unusedDelta.setX(((afterScrollPoint.x() - initialPoint.x()) + delta) * -1);
+ return didScroll;
}
majidvp 2015/04/23 18:25:08 unused scroll delta is already being calculated in
MuVen 2015/04/27 12:53:46 Done.
bool LayoutBox::canBeScrolledAndHasScrollableArea() const

Powered by Google App Engine
This is Rietveld 408576698