Chromium Code Reviews| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 FloatSize cornerRadii( | 123 FloatSize cornerRadii( |
| 124 floatValueForLength(rectangle->cornerRadiusX(), boxWidth), | 124 floatValueForLength(rectangle->cornerRadiusX(), boxWidth), |
| 125 floatValueForLength(rectangle->cornerRadiusY(), boxHeight)); | 125 floatValueForLength(rectangle->cornerRadiusY(), boxHeight)); |
| 126 ensureRadiiDoNotOverlap(bounds, cornerRadii); | 126 ensureRadiiDoNotOverlap(bounds, cornerRadii); |
| 127 FloatRect logicalBounds = physicalRectToLogical(bounds, logicalBoxSize.h eight(), writingMode); | 127 FloatRect logicalBounds = physicalRectToLogical(bounds, logicalBoxSize.h eight(), writingMode); |
| 128 | 128 |
| 129 shape = createRectangleShape(logicalBounds, physicalSizeToLogical(corner Radii, writingMode)); | 129 shape = createRectangleShape(logicalBounds, physicalSizeToLogical(corner Radii, writingMode)); |
| 130 break; | 130 break; |
| 131 } | 131 } |
| 132 | 132 |
| 133 case BasicShape::BasicShapeCircleType: { | 133 case BasicShape::DeprecatedBasicShapeCircleType: { |
| 134 const BasicShapeCircle* circle = static_cast<const BasicShapeCircle*>(ba sicShape); | 134 const DeprecatedBasicShapeCircle* circle = static_cast<const DeprecatedB asicShapeCircle*>(basicShape); |
| 135 float centerX = floatValueForLength(circle->centerX(), boxWidth); | 135 float centerX = floatValueForLength(circle->centerX(), boxWidth); |
| 136 float centerY = floatValueForLength(circle->centerY(), boxHeight); | 136 float centerY = floatValueForLength(circle->centerY(), boxHeight); |
| 137 // This method of computing the radius is as defined in SVG | 137 // This method of computing the radius is as defined in SVG |
| 138 // (http://www.w3.org/TR/SVG/coords.html#Units). It bases the radius | 138 // (http://www.w3.org/TR/SVG/coords.html#Units). It bases the radius |
| 139 // off of the diagonal of the box and ensures that if the box is | 139 // off of the diagonal of the box and ensures that if the box is |
| 140 // square, the radius is equal to half the diagonal. | 140 // square, the radius is equal to half the diagonal. |
| 141 float radius = floatValueForLength(circle->radius(), sqrtf((boxWidth * b oxWidth + boxHeight * boxHeight) / 2)); | 141 float radius = floatValueForLength(circle->radius(), sqrtf((boxWidth * b oxWidth + boxHeight * boxHeight) / 2)); |
| 142 FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, ce nterY), logicalBoxSize.height(), writingMode); | 142 FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, ce nterY), logicalBoxSize.height(), writingMode); |
| 143 | 143 |
| 144 shape = createCircleShape(logicalCenter, radius); | 144 shape = createCircleShape(logicalCenter, radius); |
| 145 break; | 145 break; |
| 146 } | 146 } |
| 147 | 147 |
| 148 case BasicShape::BasicShapeEllipseType: { | 148 case BasicShape::BasicShapeCircleType: { |
| 149 const BasicShapeEllipse* ellipse = static_cast<const BasicShapeEllipse*> (basicShape); | 149 // FIXME implement layout. bug 124619 |
|
bemjb
2013/12/07 00:05:32
This is the webkit bug number, Either remove the n
| |
| 150 shape = createRectangleShape(FloatRect(0, 0, boxWidth, boxHeight), Float Size(0, 0)); | |
| 151 break; | |
| 152 } | |
| 153 | |
| 154 case BasicShape::DeprecatedBasicShapeEllipseType: { | |
| 155 const DeprecatedBasicShapeEllipse* ellipse = static_cast<const Deprecate dBasicShapeEllipse*>(basicShape); | |
| 150 float centerX = floatValueForLength(ellipse->centerX(), boxWidth); | 156 float centerX = floatValueForLength(ellipse->centerX(), boxWidth); |
| 151 float centerY = floatValueForLength(ellipse->centerY(), boxHeight); | 157 float centerY = floatValueForLength(ellipse->centerY(), boxHeight); |
| 152 float radiusX = floatValueForLength(ellipse->radiusX(), boxWidth); | 158 float radiusX = floatValueForLength(ellipse->radiusX(), boxWidth); |
| 153 float radiusY = floatValueForLength(ellipse->radiusY(), boxHeight); | 159 float radiusY = floatValueForLength(ellipse->radiusY(), boxHeight); |
| 154 FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, ce nterY), logicalBoxSize.height(), writingMode); | 160 FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, ce nterY), logicalBoxSize.height(), writingMode); |
| 155 FloatSize logicalRadii = physicalSizeToLogical(FloatSize(radiusX, radius Y), writingMode); | 161 FloatSize logicalRadii = physicalSizeToLogical(FloatSize(radiusX, radius Y), writingMode); |
| 156 | 162 |
| 157 shape = createEllipseShape(logicalCenter, logicalRadii); | 163 shape = createEllipseShape(logicalCenter, logicalRadii); |
| 158 break; | 164 break; |
| 159 } | 165 } |
| 160 | 166 |
| 167 case BasicShape::BasicShapeEllipseType: { | |
| 168 // FIXME implement layout. bug 124619 | |
|
bemjb
2013/12/07 00:05:32
Ditto.
| |
| 169 shape = createRectangleShape(FloatRect(0, 0, boxWidth, boxHeight), Float Size(0, 0)); | |
| 170 break; | |
| 171 } | |
| 172 | |
| 161 case BasicShape::BasicShapePolygonType: { | 173 case BasicShape::BasicShapePolygonType: { |
| 162 const BasicShapePolygon* polygon = static_cast<const BasicShapePolygon*> (basicShape); | 174 const BasicShapePolygon* polygon = static_cast<const BasicShapePolygon*> (basicShape); |
| 163 const Vector<Length>& values = polygon->values(); | 175 const Vector<Length>& values = polygon->values(); |
| 164 size_t valuesSize = values.size(); | 176 size_t valuesSize = values.size(); |
| 165 ASSERT(!(valuesSize % 2)); | 177 ASSERT(!(valuesSize % 2)); |
| 166 OwnPtr<Vector<FloatPoint> > vertices = adoptPtr(new Vector<FloatPoint>(v aluesSize / 2)); | 178 OwnPtr<Vector<FloatPoint> > vertices = adoptPtr(new Vector<FloatPoint>(v aluesSize / 2)); |
| 167 for (unsigned i = 0; i < valuesSize; i += 2) { | 179 for (unsigned i = 0; i < valuesSize; i += 2) { |
| 168 FloatPoint vertex( | 180 FloatPoint vertex( |
| 169 floatValueForLength(values.at(i), boxWidth), | 181 floatValueForLength(values.at(i), boxWidth), |
| 170 floatValueForLength(values.at(i + 1), boxHeight)); | 182 floatValueForLength(values.at(i + 1), boxHeight)); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 253 | 265 |
| 254 OwnPtr<Shape> shape = createRectangleShape(bounds, radii); | 266 OwnPtr<Shape> shape = createRectangleShape(bounds, radii); |
| 255 shape->m_writingMode = writingMode; | 267 shape->m_writingMode = writingMode; |
| 256 shape->m_margin = floatValueForLength(margin, 0); | 268 shape->m_margin = floatValueForLength(margin, 0); |
| 257 shape->m_padding = floatValueForLength(padding, 0); | 269 shape->m_padding = floatValueForLength(padding, 0); |
| 258 | 270 |
| 259 return shape.release(); | 271 return shape.release(); |
| 260 } | 272 } |
| 261 | 273 |
| 262 } // namespace WebCore | 274 } // namespace WebCore |
| OLD | NEW |