Index: Source/core/rendering/RenderOverflow.h |
diff --git a/Source/core/rendering/RenderOverflow.h b/Source/core/rendering/RenderOverflow.h |
index d01d3bae59190896538aa3546b2442e393dd8fde..81d7f40f2d96e96e7628038dc07fade28aef5366 100644 |
--- a/Source/core/rendering/RenderOverflow.h |
+++ b/Source/core/rendering/RenderOverflow.h |
@@ -87,10 +87,13 @@ inline void RenderOverflow::addLayoutOverflow(const LayoutRect& rect) |
{ |
LayoutUnit maxX = std::max(rect.maxX(), m_layoutOverflow.maxX()); |
LayoutUnit maxY = std::max(rect.maxY(), m_layoutOverflow.maxY()); |
- m_layoutOverflow.setX(std::min(rect.x(), m_layoutOverflow.x())); |
- m_layoutOverflow.setY(std::min(rect.y(), m_layoutOverflow.y())); |
- m_layoutOverflow.setWidth(maxX - m_layoutOverflow.x()); |
- m_layoutOverflow.setHeight(maxY - m_layoutOverflow.y()); |
+ LayoutUnit minX = std::min(rect.x(), m_layoutOverflow.x()); |
+ LayoutUnit minY = std::min(rect.y(), m_layoutOverflow.y()); |
+ // In case the width/height is larger than LayoutUnit can represent, fix the right/bottom edge and shift the top/left ones |
+ m_layoutOverflow.setWidth(maxX - minX); |
+ m_layoutOverflow.setHeight(maxY - minY); |
+ m_layoutOverflow.setX(maxX - m_layoutOverflow.width()); |
+ m_layoutOverflow.setY(maxY - m_layoutOverflow.height()); |
} |
inline void RenderOverflow::addVisualOverflow(const LayoutRect& rect) |