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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 FloatSize cornerRadii( | 131 FloatSize cornerRadii( |
132 floatValueForLength(rectangle->cornerRadiusX(), boxWidth), | 132 floatValueForLength(rectangle->cornerRadiusX(), boxWidth), |
133 floatValueForLength(rectangle->cornerRadiusY(), boxHeight)); | 133 floatValueForLength(rectangle->cornerRadiusY(), boxHeight)); |
134 ensureRadiiDoNotOverlap(bounds, cornerRadii); | 134 ensureRadiiDoNotOverlap(bounds, cornerRadii); |
135 FloatRect logicalBounds = physicalRectToLogical(bounds, logicalBoxSize.h
eight(), writingMode); | 135 FloatRect logicalBounds = physicalRectToLogical(bounds, logicalBoxSize.h
eight(), writingMode); |
136 | 136 |
137 shape = createRectangleShape(logicalBounds, physicalSizeToLogical(corner
Radii, writingMode)); | 137 shape = createRectangleShape(logicalBounds, physicalSizeToLogical(corner
Radii, writingMode)); |
138 break; | 138 break; |
139 } | 139 } |
140 | 140 |
141 case BasicShape::BasicShapeCircleType: { | 141 case BasicShape::DeprecatedBasicShapeCircleType: { |
142 const BasicShapeCircle* circle = static_cast<const BasicShapeCircle*>(ba
sicShape); | 142 const DeprecatedBasicShapeCircle* circle = static_cast<const DeprecatedB
asicShapeCircle*>(basicShape); |
143 float centerX = floatValueForLength(circle->centerX(), boxWidth); | 143 float centerX = floatValueForLength(circle->centerX(), boxWidth); |
144 float centerY = floatValueForLength(circle->centerY(), boxHeight); | 144 float centerY = floatValueForLength(circle->centerY(), boxHeight); |
145 // This method of computing the radius is as defined in SVG | 145 // This method of computing the radius is as defined in SVG |
146 // (http://www.w3.org/TR/SVG/coords.html#Units). It bases the radius | 146 // (http://www.w3.org/TR/SVG/coords.html#Units). It bases the radius |
147 // off of the diagonal of the box and ensures that if the box is | 147 // off of the diagonal of the box and ensures that if the box is |
148 // square, the radius is equal to half the diagonal. | 148 // square, the radius is equal to half the diagonal. |
149 float radius = floatValueForLength(circle->radius(), sqrtf((boxWidth * b
oxWidth + boxHeight * boxHeight) / 2)); | 149 float radius = floatValueForLength(circle->radius(), sqrtf((boxWidth * b
oxWidth + boxHeight * boxHeight) / 2)); |
150 FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, ce
nterY), logicalBoxSize.height(), writingMode); | 150 FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, ce
nterY), logicalBoxSize.height(), writingMode); |
151 | 151 |
152 shape = createCircleShape(logicalCenter, radius); | 152 shape = createCircleShape(logicalCenter, radius); |
153 break; | 153 break; |
154 } | 154 } |
155 | 155 |
| 156 case BasicShape::BasicShapeCircleType: { |
| 157 // FIXME implement layout. |
| 158 shape = createRectangleShape(FloatRect(0, 0, boxWidth, boxHeight), Float
Size(0, 0)); |
| 159 break; |
| 160 } |
| 161 |
156 case BasicShape::BasicShapeEllipseType: { | 162 case BasicShape::BasicShapeEllipseType: { |
157 const BasicShapeEllipse* ellipse = static_cast<const BasicShapeEllipse*>
(basicShape); | 163 const BasicShapeEllipse* ellipse = static_cast<const BasicShapeEllipse*>
(basicShape); |
158 float centerX = floatValueForLength(ellipse->centerX(), boxWidth); | 164 float centerX = floatValueForLength(ellipse->centerX(), boxWidth); |
159 float centerY = floatValueForLength(ellipse->centerY(), boxHeight); | 165 float centerY = floatValueForLength(ellipse->centerY(), boxHeight); |
160 float radiusX = floatValueForLength(ellipse->radiusX(), boxWidth); | 166 float radiusX = floatValueForLength(ellipse->radiusX(), boxWidth); |
161 float radiusY = floatValueForLength(ellipse->radiusY(), boxHeight); | 167 float radiusY = floatValueForLength(ellipse->radiusY(), boxHeight); |
162 FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, ce
nterY), logicalBoxSize.height(), writingMode); | 168 FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, ce
nterY), logicalBoxSize.height(), writingMode); |
163 FloatSize logicalRadii = physicalSizeToLogical(FloatSize(radiusX, radius
Y), writingMode); | 169 FloatSize logicalRadii = physicalSizeToLogical(FloatSize(radiusX, radius
Y), writingMode); |
164 | 170 |
165 shape = createEllipseShape(logicalCenter, logicalRadii); | 171 shape = createEllipseShape(logicalCenter, logicalRadii); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 FloatRoundedRect bounds(rect, radii, radii, radii, radii); | 265 FloatRoundedRect bounds(rect, radii, radii, radii, radii); |
260 OwnPtr<Shape> shape = createBoxShape(bounds); | 266 OwnPtr<Shape> shape = createBoxShape(bounds); |
261 shape->m_writingMode = writingMode; | 267 shape->m_writingMode = writingMode; |
262 shape->m_margin = floatValueForLength(margin, 0); | 268 shape->m_margin = floatValueForLength(margin, 0); |
263 shape->m_padding = floatValueForLength(padding, 0); | 269 shape->m_padding = floatValueForLength(padding, 0); |
264 | 270 |
265 return shape.release(); | 271 return shape.release(); |
266 } | 272 } |
267 | 273 |
268 } // namespace WebCore | 274 } // namespace WebCore |
OLD | NEW |