Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(753)

Side by Side Diff: Source/core/rendering/shapes/Shape.cpp

Issue 103413006: Implement parsing of the new ellipse shape syntax. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase after CSSParser rename Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/css/parser/BisonCSSParser-in.cpp ('k') | Source/core/rendering/style/BasicShapes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 shape = createCircleShape(logicalCenter, radius); 152 shape = createCircleShape(logicalCenter, radius);
153 break; 153 break;
154 } 154 }
155 155
156 case BasicShape::BasicShapeCircleType: { 156 case BasicShape::BasicShapeCircleType: {
157 // FIXME implement layout. 157 // FIXME implement layout.
158 shape = createRectangleShape(FloatRect(0, 0, boxWidth, boxHeight), Float Size(0, 0)); 158 shape = createRectangleShape(FloatRect(0, 0, boxWidth, boxHeight), Float Size(0, 0));
159 break; 159 break;
160 } 160 }
161 161
162 case BasicShape::BasicShapeEllipseType: { 162 case BasicShape::DeprecatedBasicShapeEllipseType: {
163 const BasicShapeEllipse* ellipse = static_cast<const BasicShapeEllipse*> (basicShape); 163 const DeprecatedBasicShapeEllipse* ellipse = static_cast<const Deprecate dBasicShapeEllipse*>(basicShape);
164 float centerX = floatValueForLength(ellipse->centerX(), boxWidth); 164 float centerX = floatValueForLength(ellipse->centerX(), boxWidth);
165 float centerY = floatValueForLength(ellipse->centerY(), boxHeight); 165 float centerY = floatValueForLength(ellipse->centerY(), boxHeight);
166 float radiusX = floatValueForLength(ellipse->radiusX(), boxWidth); 166 float radiusX = floatValueForLength(ellipse->radiusX(), boxWidth);
167 float radiusY = floatValueForLength(ellipse->radiusY(), boxHeight); 167 float radiusY = floatValueForLength(ellipse->radiusY(), boxHeight);
168 FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, ce nterY), logicalBoxSize.height(), writingMode); 168 FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, ce nterY), logicalBoxSize.height(), writingMode);
169 FloatSize logicalRadii = physicalSizeToLogical(FloatSize(radiusX, radius Y), writingMode); 169 FloatSize logicalRadii = physicalSizeToLogical(FloatSize(radiusX, radius Y), writingMode);
170 170
171 shape = createEllipseShape(logicalCenter, logicalRadii); 171 shape = createEllipseShape(logicalCenter, logicalRadii);
172 break; 172 break;
173 } 173 }
174 174
175 case BasicShape::BasicShapeEllipseType: {
176 // FIXME implement layout.
177 shape = createRectangleShape(FloatRect(0, 0, boxWidth, boxHeight), Float Size(0, 0));
178 break;
179 }
180
175 case BasicShape::BasicShapePolygonType: { 181 case BasicShape::BasicShapePolygonType: {
176 const BasicShapePolygon* polygon = static_cast<const BasicShapePolygon*> (basicShape); 182 const BasicShapePolygon* polygon = static_cast<const BasicShapePolygon*> (basicShape);
177 const Vector<Length>& values = polygon->values(); 183 const Vector<Length>& values = polygon->values();
178 size_t valuesSize = values.size(); 184 size_t valuesSize = values.size();
179 ASSERT(!(valuesSize % 2)); 185 ASSERT(!(valuesSize % 2));
180 OwnPtr<Vector<FloatPoint> > vertices = adoptPtr(new Vector<FloatPoint>(v aluesSize / 2)); 186 OwnPtr<Vector<FloatPoint> > vertices = adoptPtr(new Vector<FloatPoint>(v aluesSize / 2));
181 for (unsigned i = 0; i < valuesSize; i += 2) { 187 for (unsigned i = 0; i < valuesSize; i += 2) {
182 FloatPoint vertex( 188 FloatPoint vertex(
183 floatValueForLength(values.at(i), boxWidth), 189 floatValueForLength(values.at(i), boxWidth),
184 floatValueForLength(values.at(i + 1), boxHeight)); 190 floatValueForLength(values.at(i + 1), boxHeight));
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 FloatRoundedRect bounds(rect, roundedRect.radii()); 270 FloatRoundedRect bounds(rect, roundedRect.radii());
265 OwnPtr<Shape> shape = createBoxShape(bounds); 271 OwnPtr<Shape> shape = createBoxShape(bounds);
266 shape->m_writingMode = writingMode; 272 shape->m_writingMode = writingMode;
267 shape->m_margin = floatValueForLength(margin, 0); 273 shape->m_margin = floatValueForLength(margin, 0);
268 shape->m_padding = floatValueForLength(padding, 0); 274 shape->m_padding = floatValueForLength(padding, 0);
269 275
270 return shape.release(); 276 return shape.release();
271 } 277 }
272 278
273 } // namespace WebCore 279 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/parser/BisonCSSParser-in.cpp ('k') | Source/core/rendering/style/BasicShapes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698