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

Side by Side 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, 7 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 if (Shape* shape = m_shape.get()) 146 if (Shape* shape = m_shape.get())
147 return *shape; 147 return *shape;
148 148
149 TemporaryChange<bool> isInComputingShape(m_isComputingShape, true); 149 TemporaryChange<bool> isInComputingShape(m_isComputingShape, true);
150 150
151 const ComputedStyle& style = *m_layoutBox.style(); 151 const ComputedStyle& style = *m_layoutBox.style();
152 ASSERT(m_layoutBox.containingBlock()); 152 ASSERT(m_layoutBox.containingBlock());
153 const ComputedStyle& containingBlockStyle = *m_layoutBox.containingBlock()-> style(); 153 const ComputedStyle& containingBlockStyle = *m_layoutBox.containingBlock()-> style();
154 154
155 WritingMode writingMode = containingBlockStyle.writingMode(); 155 WritingMode writingMode = containingBlockStyle.writingMode();
156 LayoutUnit maximumValue = m_layoutBox.containingBlock() ? m_layoutBox.contai ningBlock()->contentWidth() : LayoutUnit(); 156 // Make sure contentWidth is not negative. This can happen when containing b lock has a vertical scrollbar and
157 // its content is smaller than the scrollbar width.
158 LayoutUnit maximumValue = m_layoutBox.containingBlock() ? std::max(LayoutUni t(), m_layoutBox.containingBlock()->contentWidth()) : LayoutUnit();
157 float margin = floatValueForLength(m_layoutBox.style()->shapeMargin(), maxim umValue.toFloat()); 159 float margin = floatValueForLength(m_layoutBox.style()->shapeMargin(), maxim umValue.toFloat());
158 160
159 float shapeImageThreshold = style.shapeImageThreshold(); 161 float shapeImageThreshold = style.shapeImageThreshold();
160 ASSERT(style.shapeOutside()); 162 ASSERT(style.shapeOutside());
161 const ShapeValue& shapeValue = *style.shapeOutside(); 163 const ShapeValue& shapeValue = *style.shapeOutside();
162 164
163 switch (shapeValue.type()) { 165 switch (shapeValue.type()) {
164 case ShapeValue::Shape: 166 case ShapeValue::Shape:
165 ASSERT(shapeValue.shape()); 167 ASSERT(shapeValue.shape());
166 m_shape = Shape::createShape(shapeValue.shape(), m_referenceBoxLogicalSi ze, writingMode, margin); 168 m_shape = Shape::createShape(shapeValue.shape(), m_referenceBoxLogicalSi ze, writingMode, margin);
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 } 347 }
346 348
347 FloatSize ShapeOutsideInfo::shapeToLayoutObjectSize(FloatSize size) const 349 FloatSize ShapeOutsideInfo::shapeToLayoutObjectSize(FloatSize size) const
348 { 350 {
349 if (!m_layoutBox.style()->isHorizontalWritingMode()) 351 if (!m_layoutBox.style()->isHorizontalWritingMode())
350 return size.transposedSize(); 352 return size.transposedSize();
351 return size; 353 return size;
352 } 354 }
353 355
354 } // namespace blink 356 } // namespace blink
OLDNEW
« 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