Index: Source/core/layout/shapes/ShapeOutsideInfo.cpp |
diff --git a/Source/core/layout/shapes/ShapeOutsideInfo.cpp b/Source/core/layout/shapes/ShapeOutsideInfo.cpp |
index 1b5fb3b75c91be3dba5d4284f50aef63b1b0d0c7..7e92b12f8647f014b27546ba02b61631909857ed 100644 |
--- a/Source/core/layout/shapes/ShapeOutsideInfo.cpp |
+++ b/Source/core/layout/shapes/ShapeOutsideInfo.cpp |
@@ -153,7 +153,9 @@ const Shape& ShapeOutsideInfo::computedShape() const |
const ComputedStyle& containingBlockStyle = *m_layoutBox.containingBlock()->style(); |
WritingMode writingMode = containingBlockStyle.writingMode(); |
- LayoutUnit maximumValue = m_layoutBox.containingBlock() ? m_layoutBox.containingBlock()->contentWidth() : LayoutUnit(); |
+ // Make sure contentWidth is not negative. This can happen when containing block has a vertical scrollbar and |
+ // its content is smaller than the scrollbar width. |
+ LayoutUnit maximumValue = m_layoutBox.containingBlock() ? std::max(LayoutUnit(), m_layoutBox.containingBlock()->contentWidth()) : LayoutUnit(); |
float margin = floatValueForLength(m_layoutBox.style()->shapeMargin(), maximumValue.toFloat()); |
float shapeImageThreshold = style.shapeImageThreshold(); |