Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(870)

Unified Diff: Source/core/layout/shapes/ShapeOutsideInfo.cpp

Issue 1036653002: Clamp shape-margin to zero (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address review comments Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/shapes/shape-outside-floats/shape-outside-negative-height-crash-width-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « LayoutTests/fast/shapes/shape-outside-floats/shape-outside-negative-height-crash-width-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698