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 12 matching lines...) Expand all Loading... |
23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
27 * OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * OF THE POSSIBILITY OF SUCH DAMAGE. |
28 */ | 28 */ |
29 | 29 |
30 #include "config.h" | 30 #include "config.h" |
31 #include "core/rendering/shapes/Shape.h" | 31 #include "core/rendering/shapes/Shape.h" |
32 | 32 |
| 33 #include "core/css/BasicShapeFunctions.h" |
33 #include "core/fetch/ImageResource.h" | 34 #include "core/fetch/ImageResource.h" |
34 #include "core/rendering/shapes/BoxShape.h" | 35 #include "core/rendering/shapes/BoxShape.h" |
35 #include "core/rendering/shapes/PolygonShape.h" | 36 #include "core/rendering/shapes/PolygonShape.h" |
36 #include "core/rendering/shapes/RasterShape.h" | 37 #include "core/rendering/shapes/RasterShape.h" |
37 #include "core/rendering/shapes/RectangleShape.h" | 38 #include "core/rendering/shapes/RectangleShape.h" |
38 #include "platform/LengthFunctions.h" | 39 #include "platform/LengthFunctions.h" |
39 #include "platform/geometry/FloatRoundedRect.h" | 40 #include "platform/geometry/FloatRoundedRect.h" |
40 #include "platform/geometry/FloatSize.h" | 41 #include "platform/geometry/FloatSize.h" |
41 #include "platform/graphics/ImageBuffer.h" | 42 #include "platform/graphics/ImageBuffer.h" |
42 #include "platform/graphics/WindRule.h" | 43 #include "platform/graphics/WindRule.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // off of the diagonal of the box and ensures that if the box is | 148 // off of the diagonal of the box and ensures that if the box is |
148 // square, the radius is equal to half the diagonal. | 149 // square, the radius is equal to half the diagonal. |
149 float radius = floatValueForLength(circle->radius(), sqrtf((boxWidth * b
oxWidth + boxHeight * boxHeight) / 2)); | 150 float radius = floatValueForLength(circle->radius(), sqrtf((boxWidth * b
oxWidth + boxHeight * boxHeight) / 2)); |
150 FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, ce
nterY), logicalBoxSize.height(), writingMode); | 151 FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, ce
nterY), logicalBoxSize.height(), writingMode); |
151 | 152 |
152 shape = createCircleShape(logicalCenter, radius); | 153 shape = createCircleShape(logicalCenter, radius); |
153 break; | 154 break; |
154 } | 155 } |
155 | 156 |
156 case BasicShape::BasicShapeCircleType: { | 157 case BasicShape::BasicShapeCircleType: { |
157 // FIXME implement layout. | 158 const BasicShapeCircle* circle = static_cast<const BasicShapeCircle*>(ba
sicShape); |
158 shape = createRectangleShape(FloatRect(0, 0, boxWidth, boxHeight), Float
Size(0, 0)); | 159 FloatPoint center = floatPointForCenterCoordinate(circle->centerX(), cir
cle->centerY(), FloatSize(boxWidth, boxHeight)); |
| 160 float radius = circle->floatValueForRadiusInBox(FloatSize(boxWidth, boxH
eight)); |
| 161 FloatPoint logicalCenter = physicalPointToLogical(center, logicalBoxSize
.height(), writingMode); |
| 162 |
| 163 shape = createCircleShape(logicalCenter, radius); |
159 break; | 164 break; |
160 } | 165 } |
161 | 166 |
162 case BasicShape::DeprecatedBasicShapeEllipseType: { | 167 case BasicShape::DeprecatedBasicShapeEllipseType: { |
163 const DeprecatedBasicShapeEllipse* ellipse = static_cast<const Deprecate
dBasicShapeEllipse*>(basicShape); | 168 const DeprecatedBasicShapeEllipse* ellipse = static_cast<const Deprecate
dBasicShapeEllipse*>(basicShape); |
164 float centerX = floatValueForLength(ellipse->centerX(), boxWidth); | 169 float centerX = floatValueForLength(ellipse->centerX(), boxWidth); |
165 float centerY = floatValueForLength(ellipse->centerY(), boxHeight); | 170 float centerY = floatValueForLength(ellipse->centerY(), boxHeight); |
166 float radiusX = floatValueForLength(ellipse->radiusX(), boxWidth); | 171 float radiusX = floatValueForLength(ellipse->radiusX(), boxWidth); |
167 float radiusY = floatValueForLength(ellipse->radiusY(), boxHeight); | 172 float radiusY = floatValueForLength(ellipse->radiusY(), boxHeight); |
168 FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, ce
nterY), logicalBoxSize.height(), writingMode); | 173 FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, ce
nterY), logicalBoxSize.height(), writingMode); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 FloatRoundedRect bounds(rect, roundedRect.radii()); | 275 FloatRoundedRect bounds(rect, roundedRect.radii()); |
271 OwnPtr<Shape> shape = createBoxShape(bounds); | 276 OwnPtr<Shape> shape = createBoxShape(bounds); |
272 shape->m_writingMode = writingMode; | 277 shape->m_writingMode = writingMode; |
273 shape->m_margin = floatValueForLength(margin, 0); | 278 shape->m_margin = floatValueForLength(margin, 0); |
274 shape->m_padding = floatValueForLength(padding, 0); | 279 shape->m_padding = floatValueForLength(padding, 0); |
275 | 280 |
276 return shape.release(); | 281 return shape.release(); |
277 } | 282 } |
278 | 283 |
279 } // namespace WebCore | 284 } // namespace WebCore |
OLD | NEW |