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

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

Issue 124303002: Layout support for new ellipse shape syntax (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase against ToT 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
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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 float radiusX = floatValueForLength(ellipse->radiusX(), boxWidth); 171 float radiusX = floatValueForLength(ellipse->radiusX(), boxWidth);
172 float radiusY = floatValueForLength(ellipse->radiusY(), boxHeight); 172 float radiusY = floatValueForLength(ellipse->radiusY(), boxHeight);
173 FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, ce nterY), logicalBoxSize.height(), writingMode); 173 FloatPoint logicalCenter = physicalPointToLogical(FloatPoint(centerX, ce nterY), logicalBoxSize.height(), writingMode);
174 FloatSize logicalRadii = physicalSizeToLogical(FloatSize(radiusX, radius Y), writingMode); 174 FloatSize logicalRadii = physicalSizeToLogical(FloatSize(radiusX, radius Y), writingMode);
175 175
176 shape = createEllipseShape(logicalCenter, logicalRadii); 176 shape = createEllipseShape(logicalCenter, logicalRadii);
177 break; 177 break;
178 } 178 }
179 179
180 case BasicShape::BasicShapeEllipseType: { 180 case BasicShape::BasicShapeEllipseType: {
181 // FIXME implement layout. 181 const BasicShapeEllipse* ellipse = static_cast<const BasicShapeEllipse*> (basicShape);
182 shape = createRectangleShape(FloatRect(0, 0, boxWidth, boxHeight), Float Size(0, 0)); 182 FloatPoint center = floatPointForCenterCoordinate(ellipse->centerX(), el lipse->centerY(), FloatSize(boxWidth, boxHeight));
183 float radiusX = ellipse->floatValueForRadiusInBox(ellipse->radiusX(), ce nter.x(), boxWidth);
184 float radiusY = ellipse->floatValueForRadiusInBox(ellipse->radiusY(), ce nter.y(), boxHeight);
185 FloatPoint logicalCenter = physicalPointToLogical(center, logicalBoxSize .height(), writingMode);
186
187 shape = createEllipseShape(logicalCenter, FloatSize(radiusX, radiusY));
183 break; 188 break;
184 } 189 }
185 190
186 case BasicShape::BasicShapePolygonType: { 191 case BasicShape::BasicShapePolygonType: {
187 const BasicShapePolygon* polygon = static_cast<const BasicShapePolygon*> (basicShape); 192 const BasicShapePolygon* polygon = static_cast<const BasicShapePolygon*> (basicShape);
188 const Vector<Length>& values = polygon->values(); 193 const Vector<Length>& values = polygon->values();
189 size_t valuesSize = values.size(); 194 size_t valuesSize = values.size();
190 ASSERT(!(valuesSize % 2)); 195 ASSERT(!(valuesSize % 2));
191 OwnPtr<Vector<FloatPoint> > vertices = adoptPtr(new Vector<FloatPoint>(v aluesSize / 2)); 196 OwnPtr<Vector<FloatPoint> > vertices = adoptPtr(new Vector<FloatPoint>(v aluesSize / 2));
192 for (unsigned i = 0; i < valuesSize; i += 2) { 197 for (unsigned i = 0; i < valuesSize; i += 2) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 FloatRoundedRect bounds(rect, roundedRect.radii()); 280 FloatRoundedRect bounds(rect, roundedRect.radii());
276 OwnPtr<Shape> shape = createBoxShape(bounds); 281 OwnPtr<Shape> shape = createBoxShape(bounds);
277 shape->m_writingMode = writingMode; 282 shape->m_writingMode = writingMode;
278 shape->m_margin = floatValueForLength(margin, 0); 283 shape->m_margin = floatValueForLength(margin, 0);
279 shape->m_padding = floatValueForLength(padding, 0); 284 shape->m_padding = floatValueForLength(padding, 0);
280 285
281 return shape.release(); 286 return shape.release();
282 } 287 }
283 288
284 } // namespace WebCore 289 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698