Index: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
index 12f489202c52d6b429840b7777bd6fb20455b4a5..06d8fea21ad6e59ffb86fbca2ff2044ae4c4a6e4 100644 |
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp |
@@ -587,14 +587,49 @@ int PaintLayerScrollableArea::pixelSnappedScrollHeight() const |
return snapSizeToPixel(scrollHeight(), box().clientTop() + box().location().y()); |
} |
+IntSize PaintLayerScrollableArea::originAdjustmentForScrollbars() const |
leviw_travelin_and_unemployed
2016/04/28 22:12:12
This deserves a big description about why it exist
|
+{ |
+ IntSize size; |
+ int verticalScrollbarWidth = box().verticalScrollbarWidth(); |
+ int horizontalScrollbarHeight = box().horizontalScrollbarHeight(); |
+ |
+ if (box().hasFlippedBlocksWritingMode()) { |
+ if (box().isFlexibleBox()) { |
leviw_travelin_and_unemployed
2016/04/28 22:12:12
It seems like it may be easier/clearer to handle t
|
+ EFlexDirection flexDirection = box().style()->flexDirection(); |
+ if (flexDirection != FlowColumnReverse) |
+ size.expand(verticalScrollbarWidth, 0); |
+ if (flexDirection == FlowRowReverse) |
+ size.expand(0, horizontalScrollbarHeight); |
+ } else { |
+ size.expand(verticalScrollbarWidth, 0); |
+ } |
+ } else if (box().isHorizontalWritingMode()) { |
+ if (box().isFlexibleBox()) { |
+ EFlexDirection flexDirection = box().style()->flexDirection(); |
+ if (flexDirection == FlowRowReverse) |
+ size.expand(verticalScrollbarWidth, 0); |
+ else if (flexDirection == FlowColumnReverse) |
+ size.expand(0, horizontalScrollbarHeight); |
+ } else if (box().shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) { |
+ size.expand(verticalScrollbarWidth, 0); |
+ } |
+ } else if (box().isFlexibleBox()) { |
+ EFlexDirection flexDirection = box().style()->flexDirection(); |
+ if (flexDirection == FlowColumnReverse) |
+ size.expand(verticalScrollbarWidth, 0); |
+ else if (flexDirection == FlowRowReverse) |
+ size.expand(0, horizontalScrollbarHeight); |
+ } |
+ return size; |
+} |
+ |
void PaintLayerScrollableArea::computeScrollDimensions() |
{ |
m_overflowRect = box().layoutOverflowRect(); |
box().flipForWritingMode(m_overflowRect); |
- int scrollableLeftOverflow = m_overflowRect.x() - box().borderLeft() - (box().shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? box().verticalScrollbarWidth() : 0); |
- int scrollableTopOverflow = m_overflowRect.y() - box().borderTop(); |
- setScrollOrigin(IntPoint(-scrollableLeftOverflow, -scrollableTopOverflow)); |
+ LayoutPoint scrollableOverflow = m_overflowRect.location() - LayoutSize(box().borderLeft(), box().borderTop()); |
+ setScrollOrigin(flooredIntPoint(-scrollableOverflow) + originAdjustmentForScrollbars()); |
} |
void PaintLayerScrollableArea::scrollToPosition(const DoublePoint& scrollPosition, ScrollOffsetClamping clamp, ScrollBehavior scrollBehavior, ScrollType scrollType) |