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 float centerX = floatValueForCenterCoordinate(circle->centerX(), boxWidt h); |
leviw_travelin_and_unemployed
2014/01/07 19:41:34
I don't love having these coordinates split up so
| |
160 float centerY = floatValueForCenterCoordinate(circle->centerY(), boxHeig ht); | |
161 float radius = circle->floatValueForRadiusInBox(boxWidth, boxHeight); | |
162 FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, ce nterY), logicalBoxSize.height(), writingMode); | |
163 | |
164 shape = createCircleShape(logicalCenter, radius); | |
159 break; | 165 break; |
160 } | 166 } |
161 | 167 |
162 case BasicShape::BasicShapeEllipseType: { | 168 case BasicShape::BasicShapeEllipseType: { |
163 const BasicShapeEllipse* ellipse = static_cast<const BasicShapeEllipse*> (basicShape); | 169 const BasicShapeEllipse* ellipse = static_cast<const BasicShapeEllipse*> (basicShape); |
164 float centerX = floatValueForLength(ellipse->centerX(), boxWidth); | 170 float centerX = floatValueForLength(ellipse->centerX(), boxWidth); |
165 float centerY = floatValueForLength(ellipse->centerY(), boxHeight); | 171 float centerY = floatValueForLength(ellipse->centerY(), boxHeight); |
166 float radiusX = floatValueForLength(ellipse->radiusX(), boxWidth); | 172 float radiusX = floatValueForLength(ellipse->radiusX(), boxWidth); |
167 float radiusY = floatValueForLength(ellipse->radiusY(), boxHeight); | 173 float radiusY = floatValueForLength(ellipse->radiusY(), boxHeight); |
168 FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, ce nterY), logicalBoxSize.height(), writingMode); | 174 FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, ce nterY), logicalBoxSize.height(), writingMode); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
265 FloatRoundedRect bounds(rect, radii, radii, radii, radii); | 271 FloatRoundedRect bounds(rect, radii, radii, radii, radii); |
266 OwnPtr<Shape> shape = createBoxShape(bounds); | 272 OwnPtr<Shape> shape = createBoxShape(bounds); |
267 shape->m_writingMode = writingMode; | 273 shape->m_writingMode = writingMode; |
268 shape->m_margin = floatValueForLength(margin, 0); | 274 shape->m_margin = floatValueForLength(margin, 0); |
269 shape->m_padding = floatValueForLength(padding, 0); | 275 shape->m_padding = floatValueForLength(padding, 0); |
270 | 276 |
271 return shape.release(); | 277 return shape.release(); |
272 } | 278 } |
273 | 279 |
274 } // namespace WebCore | 280 } // namespace WebCore |
OLD | NEW |