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

Side by Side Diff: Source/core/rendering/shapes/ShapeOutsideInfo.cpp

Issue 226373002: [CSS Shapes] shape-margin in percentage units always computes to 0px (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix test Created 6 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 unified diff | Download patch
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 16 matching lines...) Expand all
27 * SUCH DAMAGE. 27 * SUCH DAMAGE.
28 */ 28 */
29 29
30 #include "config.h" 30 #include "config.h"
31 #include "core/rendering/shapes/ShapeOutsideInfo.h" 31 #include "core/rendering/shapes/ShapeOutsideInfo.h"
32 32
33 #include "core/rendering/FloatingObjects.h" 33 #include "core/rendering/FloatingObjects.h"
34 #include "core/rendering/RenderBlockFlow.h" 34 #include "core/rendering/RenderBlockFlow.h"
35 #include "core/rendering/RenderBox.h" 35 #include "core/rendering/RenderBox.h"
36 #include "core/rendering/RenderImage.h" 36 #include "core/rendering/RenderImage.h"
37 37
leviw_travelin_and_unemployed 2014/04/11 21:04:17 supernit: why this empty space? I'm only used to s
38 #include "platform/LengthFunctions.h"
39
38 namespace WebCore { 40 namespace WebCore {
39 41
40 CSSBoxType referenceBox(const ShapeValue& shapeValue) 42 CSSBoxType referenceBox(const ShapeValue& shapeValue)
41 { 43 {
42 if (shapeValue.cssBox() == BoxMissing) 44 if (shapeValue.cssBox() == BoxMissing)
43 return MarginBox; 45 return MarginBox;
44 return shapeValue.cssBox(); 46 return shapeValue.cssBox();
45 } 47 }
46 48
47 void ShapeOutsideInfo::setReferenceBoxLogicalSize(LayoutSize newReferenceBoxLogi calSize) 49 void ShapeOutsideInfo::setReferenceBoxLogicalSize(LayoutSize newReferenceBoxLogi calSize)
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 const Shape& ShapeOutsideInfo::computedShape() const 118 const Shape& ShapeOutsideInfo::computedShape() const
117 { 119 {
118 if (Shape* shape = m_shape.get()) 120 if (Shape* shape = m_shape.get())
119 return *shape; 121 return *shape;
120 122
121 const RenderStyle& style = *m_renderer.style(); 123 const RenderStyle& style = *m_renderer.style();
122 ASSERT(m_renderer.containingBlock()); 124 ASSERT(m_renderer.containingBlock());
123 const RenderStyle& containingBlockStyle = *m_renderer.containingBlock()->sty le(); 125 const RenderStyle& containingBlockStyle = *m_renderer.containingBlock()->sty le();
124 126
125 WritingMode writingMode = containingBlockStyle.writingMode(); 127 WritingMode writingMode = containingBlockStyle.writingMode();
126 Length margin = style.shapeMargin(); 128 LayoutUnit maximumValue = m_renderer.containingBlock() ? m_renderer.containi ngBlock()->contentWidth() : LayoutUnit();
129 float margin = floatValueForLength(m_renderer.style()->shapeMargin(), maximu mValue.toFloat());
130
127 float shapeImageThreshold = style.shapeImageThreshold(); 131 float shapeImageThreshold = style.shapeImageThreshold();
128 ASSERT(style.shapeOutside()); 132 ASSERT(style.shapeOutside());
129 const ShapeValue& shapeValue = *style.shapeOutside(); 133 const ShapeValue& shapeValue = *style.shapeOutside();
130 134
131 switch (shapeValue.type()) { 135 switch (shapeValue.type()) {
132 case ShapeValue::Shape: 136 case ShapeValue::Shape:
133 ASSERT(shapeValue.shape()); 137 ASSERT(shapeValue.shape());
134 m_shape = Shape::createShape(shapeValue.shape(), m_referenceBoxLogicalSi ze, writingMode, margin); 138 m_shape = Shape::createShape(shapeValue.shape(), m_referenceBoxLogicalSi ze, writingMode, margin);
135 break; 139 break;
136 case ShapeValue::Image: { 140 case ShapeValue::Image: {
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 // Lines that do not overlap the shape should act as if the float 302 // Lines that do not overlap the shape should act as if the float
299 // wasn't there for layout purposes. So we set the deltas to remove the 303 // wasn't there for layout purposes. So we set the deltas to remove the
300 // entire width of the float. 304 // entire width of the float.
301 m_leftMarginBoxDelta = floatMarginBoxWidth; 305 m_leftMarginBoxDelta = floatMarginBoxWidth;
302 m_rightMarginBoxDelta = -floatMarginBoxWidth; 306 m_rightMarginBoxDelta = -floatMarginBoxWidth;
303 m_lineOverlapsShape = false; 307 m_lineOverlapsShape = false;
304 } 308 }
305 } 309 }
306 310
307 } 311 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698