Index: Source/core/rendering/RenderBox.cpp |
diff --git a/Source/core/rendering/RenderBox.cpp b/Source/core/rendering/RenderBox.cpp |
index 35035113b22169ca6da9343b3450e1707a4362d2..1931441bcc395bee8795f04b6582c3ee219755a0 100644 |
--- a/Source/core/rendering/RenderBox.cpp |
+++ b/Source/core/rendering/RenderBox.cpp |
@@ -4142,7 +4142,7 @@ void RenderBox::addOverflowFromChild(RenderBox* child, const LayoutSize& delta) |
void RenderBox::addLayoutOverflow(const LayoutRect& rect) |
{ |
- LayoutRect clientBox = clientBoxRect(); |
+ LayoutRect clientBox = noOverflowRect(); |
if (clientBox.contains(rect) || rect.isEmpty()) |
return; |
@@ -4197,7 +4197,7 @@ void RenderBox::addVisualOverflow(const LayoutRect& rect) |
return; |
if (!m_overflow) |
- m_overflow = adoptPtr(new RenderOverflow(clientBoxRect(), borderBox)); |
+ m_overflow = adoptPtr(new RenderOverflow(noOverflowRect(), borderBox)); |
m_overflow->addVisualOverflow(rect); |
} |
@@ -4391,6 +4391,26 @@ LayoutRect RenderBox::layoutOverflowRectForPropagation(RenderStyle* parentStyle) |
return rect; |
} |
+LayoutRect RenderBox::noOverflowRect() const |
+{ |
+ // Because of the special coodinate system used for overflow rectangles (not quite logical, not |
+ // quite physical), we need to flip the block progression coordinate in vertical-rl and |
+ // horizontal-bt writing modes. Apart from that, this method does the same as clientBoxRect(). |
+ |
+ LayoutUnit left = borderLeft(); |
+ LayoutUnit top = borderTop(); |
+ LayoutUnit right = borderRight(); |
+ LayoutUnit bottom = borderBottom(); |
+ // Calculate physical padding box. |
+ LayoutRect rect(left, top, width() - left - right, height() - top - bottom); |
+ // Flip block progression axis if writing mode is vertical-rl or horizontal-bt. |
+ flipForWritingMode(rect); |
+ // Subtract space occupied by scrollbars. They are at their physical edge in this coordinate |
+ // system, so order is important here: first flip, then subtract scrollbars. |
+ rect.contract(verticalScrollbarWidth(), horizontalScrollbarHeight()); |
+ return rect; |
+} |
+ |
LayoutRect RenderBox::overflowRectForPaintRejection() const |
{ |
LayoutRect overflowRect = visualOverflowRect(); |