Chromium Code Reviews| 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 |