OLD | NEW |
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 Loading... |
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 #include "platform/LengthFunctions.h" |
37 | 38 |
38 namespace WebCore { | 39 namespace WebCore { |
39 | 40 |
40 CSSBoxType referenceBox(const ShapeValue& shapeValue) | 41 CSSBoxType referenceBox(const ShapeValue& shapeValue) |
41 { | 42 { |
42 if (shapeValue.cssBox() == BoxMissing) | 43 if (shapeValue.cssBox() == BoxMissing) |
43 return MarginBox; | 44 return MarginBox; |
44 return shapeValue.cssBox(); | 45 return shapeValue.cssBox(); |
45 } | 46 } |
46 | 47 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 const Shape& ShapeOutsideInfo::computedShape() const | 117 const Shape& ShapeOutsideInfo::computedShape() const |
117 { | 118 { |
118 if (Shape* shape = m_shape.get()) | 119 if (Shape* shape = m_shape.get()) |
119 return *shape; | 120 return *shape; |
120 | 121 |
121 const RenderStyle& style = *m_renderer.style(); | 122 const RenderStyle& style = *m_renderer.style(); |
122 ASSERT(m_renderer.containingBlock()); | 123 ASSERT(m_renderer.containingBlock()); |
123 const RenderStyle& containingBlockStyle = *m_renderer.containingBlock()->sty
le(); | 124 const RenderStyle& containingBlockStyle = *m_renderer.containingBlock()->sty
le(); |
124 | 125 |
125 WritingMode writingMode = containingBlockStyle.writingMode(); | 126 WritingMode writingMode = containingBlockStyle.writingMode(); |
126 Length margin = style.shapeMargin(); | 127 LayoutUnit maximumValue = m_renderer.containingBlock() ? m_renderer.containi
ngBlock()->contentWidth() : LayoutUnit(); |
| 128 float margin = floatValueForLength(m_renderer.style()->shapeMargin(), maximu
mValue.toFloat()); |
| 129 |
127 float shapeImageThreshold = style.shapeImageThreshold(); | 130 float shapeImageThreshold = style.shapeImageThreshold(); |
128 ASSERT(style.shapeOutside()); | 131 ASSERT(style.shapeOutside()); |
129 const ShapeValue& shapeValue = *style.shapeOutside(); | 132 const ShapeValue& shapeValue = *style.shapeOutside(); |
130 | 133 |
131 switch (shapeValue.type()) { | 134 switch (shapeValue.type()) { |
132 case ShapeValue::Shape: | 135 case ShapeValue::Shape: |
133 ASSERT(shapeValue.shape()); | 136 ASSERT(shapeValue.shape()); |
134 m_shape = Shape::createShape(shapeValue.shape(), m_referenceBoxLogicalSi
ze, writingMode, margin); | 137 m_shape = Shape::createShape(shapeValue.shape(), m_referenceBoxLogicalSi
ze, writingMode, margin); |
135 break; | 138 break; |
136 case ShapeValue::Image: { | 139 case ShapeValue::Image: { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 // Lines that do not overlap the shape should act as if the float | 301 // 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 | 302 // wasn't there for layout purposes. So we set the deltas to remove the |
300 // entire width of the float. | 303 // entire width of the float. |
301 m_leftMarginBoxDelta = floatMarginBoxWidth; | 304 m_leftMarginBoxDelta = floatMarginBoxWidth; |
302 m_rightMarginBoxDelta = -floatMarginBoxWidth; | 305 m_rightMarginBoxDelta = -floatMarginBoxWidth; |
303 m_lineOverlapsShape = false; | 306 m_lineOverlapsShape = false; |
304 } | 307 } |
305 } | 308 } |
306 | 309 |
307 } | 310 } |
OLD | NEW |