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

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: Fix compile Created 5 years, 9 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-block-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 LayoutStyle& style = *m_renderer.style(); 151 const LayoutStyle& style = *m_renderer.style();
152 ASSERT(m_renderer.containingBlock()); 152 ASSERT(m_renderer.containingBlock());
153 const LayoutStyle& containingBlockStyle = *m_renderer.containingBlock()->sty le(); 153 const LayoutStyle& containingBlockStyle = *m_renderer.containingBlock()->sty le();
154 154
155 WritingMode writingMode = containingBlockStyle.writingMode(); 155 WritingMode writingMode = containingBlockStyle.writingMode();
156 LayoutUnit maximumValue = m_renderer.containingBlock() ? m_renderer.containi ngBlock()->contentWidth() : LayoutUnit(); 156 LayoutUnit maximumValue = m_renderer.containingBlock() ? std::max(m_renderer .containingBlock()->contentWidth(), LayoutUnit()) : LayoutUnit();
Zoltan 2015/04/13 20:33:08 I think it would be more readable if you just do s
157 float margin = floatValueForLength(m_renderer.style()->shapeMargin(), maximu mValue.toFloat()); 157 float margin = floatValueForLength(m_renderer.style()->shapeMargin(), maximu mValue.toFloat());
158 158
159 float shapeImageThreshold = style.shapeImageThreshold(); 159 float shapeImageThreshold = style.shapeImageThreshold();
160 ASSERT(style.shapeOutside()); 160 ASSERT(style.shapeOutside());
161 const ShapeValue& shapeValue = *style.shapeOutside(); 161 const ShapeValue& shapeValue = *style.shapeOutside();
162 162
163 switch (shapeValue.type()) { 163 switch (shapeValue.type()) {
164 case ShapeValue::Shape: 164 case ShapeValue::Shape:
165 ASSERT(shapeValue.shape()); 165 ASSERT(shapeValue.shape());
166 m_shape = Shape::createShape(shapeValue.shape(), m_referenceBoxLogicalSi ze, writingMode, margin); 166 m_shape = Shape::createShape(shapeValue.shape(), m_referenceBoxLogicalSi ze, writingMode, margin);
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 } 345 }
346 346
347 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const 347 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const
348 { 348 {
349 if (!m_renderer.style()->isHorizontalWritingMode()) 349 if (!m_renderer.style()->isHorizontalWritingMode())
350 return size.transposedSize(); 350 return size.transposedSize();
351 return size; 351 return size;
352 } 352 }
353 353
354 } // namespace blink 354 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/shapes/shape-outside-floats/shape-outside-negative-block-width-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698