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

Side by Side Diff: Source/core/rendering/svg/SVGRenderTreeAsText.cpp

Issue 112003003: [SVG] SVGLength{,List} migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebaselined Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2007, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2007, 2009 Apple Inc. All rights reserved.
3 * (C) 2005 Rob Buis <buis@kde.org> 3 * (C) 2005 Rob Buis <buis@kde.org>
4 * (C) 2006 Alexander Kellett <lypanov@kde.org> 4 * (C) 2006 Alexander Kellett <lypanov@kde.org>
5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 const RenderSVGShape& shape = static_cast<const RenderSVGShape&>(object) ; 260 const RenderSVGShape& shape = static_cast<const RenderSVGShape&>(object) ;
261 ASSERT(shape.element()); 261 ASSERT(shape.element());
262 262
263 Color fallbackColor; 263 Color fallbackColor;
264 if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strok ePaintingResource(const_cast<RenderSVGShape*>(&shape), shape.style(), fallbackCo lor)) { 264 if (RenderSVGResource* strokePaintingResource = RenderSVGResource::strok ePaintingResource(const_cast<RenderSVGShape*>(&shape), shape.style(), fallbackCo lor)) {
265 TextStreamSeparator s(" "); 265 TextStreamSeparator s(" ");
266 ts << " [stroke={" << s; 266 ts << " [stroke={" << s;
267 writeSVGPaintingResource(ts, strokePaintingResource); 267 writeSVGPaintingResource(ts, strokePaintingResource);
268 268
269 SVGLengthContext lengthContext(shape.element()); 269 SVGLengthContext lengthContext(shape.element());
270 double dashOffset = svgStyle->strokeDashOffset().value(lengthContext ); 270 double dashOffset = svgStyle->strokeDashOffset()->value(lengthContex t);
271 double strokeWidth = svgStyle->strokeWidth().value(lengthContext); 271 double strokeWidth = svgStyle->strokeWidth()->value(lengthContext);
272 const Vector<SVGLength>& dashes = svgStyle->strokeDashArray(); 272 RefPtr<SVGLengthList> dashes = svgStyle->strokeDashArray();
273 273
274 DashArray dashArray; 274 DashArray dashArray;
275 const Vector<SVGLength>::const_iterator end = dashes.end(); 275 size_t length = dashes->numberOfItems();
276 for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != en d; ++it) 276 for (size_t i = 0; i < length; ++i)
277 dashArray.append((*it).value(lengthContext)); 277 dashArray.append(dashes->at(i)->value(lengthContext));
278 278
279 writeIfNotDefault(ts, "opacity", svgStyle->strokeOpacity(), 1.0f); 279 writeIfNotDefault(ts, "opacity", svgStyle->strokeOpacity(), 1.0f);
280 writeIfNotDefault(ts, "stroke width", strokeWidth, 1.0); 280 writeIfNotDefault(ts, "stroke width", strokeWidth, 1.0);
281 writeIfNotDefault(ts, "miter limit", svgStyle->strokeMiterLimit(), 4 .0f); 281 writeIfNotDefault(ts, "miter limit", svgStyle->strokeMiterLimit(), 4 .0f);
282 writeIfNotDefault(ts, "line cap", svgStyle->capStyle(), ButtCap); 282 writeIfNotDefault(ts, "line cap", svgStyle->capStyle(), ButtCap);
283 writeIfNotDefault(ts, "line join", svgStyle->joinStyle(), MiterJoin) ; 283 writeIfNotDefault(ts, "line join", svgStyle->joinStyle(), MiterJoin) ;
284 writeIfNotDefault(ts, "dash offset", dashOffset, 0.0); 284 writeIfNotDefault(ts, "dash offset", dashOffset, 0.0);
285 if (!dashArray.isEmpty()) 285 if (!dashArray.isEmpty())
286 writeNameValuePair(ts, "dash array", dashArray); 286 writeNameValuePair(ts, "dash array", dashArray);
287 287
(...skipping 26 matching lines...) Expand all
314 314
315 static TextStream& operator<<(TextStream& ts, const RenderSVGShape& shape) 315 static TextStream& operator<<(TextStream& ts, const RenderSVGShape& shape)
316 { 316 {
317 writePositionAndStyle(ts, shape); 317 writePositionAndStyle(ts, shape);
318 318
319 SVGElement* svgElement = shape.element(); 319 SVGElement* svgElement = shape.element();
320 SVGLengthContext lengthContext(svgElement); 320 SVGLengthContext lengthContext(svgElement);
321 321
322 if (svgElement->hasTagName(SVGNames::rectTag)) { 322 if (svgElement->hasTagName(SVGNames::rectTag)) {
323 SVGRectElement* element = toSVGRectElement(svgElement); 323 SVGRectElement* element = toSVGRectElement(svgElement);
324 writeNameValuePair(ts, "x", element->xCurrentValue().value(lengthContext )); 324 writeNameValuePair(ts, "x", element->x()->currentValue()->value(lengthCo ntext));
325 writeNameValuePair(ts, "y", element->yCurrentValue().value(lengthContext )); 325 writeNameValuePair(ts, "y", element->y()->currentValue()->value(lengthCo ntext));
326 writeNameValuePair(ts, "width", element->widthCurrentValue().value(lengt hContext)); 326 writeNameValuePair(ts, "width", element->width()->currentValue()->value( lengthContext));
327 writeNameValuePair(ts, "height", element->heightCurrentValue().value(len gthContext)); 327 writeNameValuePair(ts, "height", element->height()->currentValue()->valu e(lengthContext));
328 } else if (svgElement->hasTagName(SVGNames::lineTag)) { 328 } else if (svgElement->hasTagName(SVGNames::lineTag)) {
329 SVGLineElement* element = toSVGLineElement(svgElement); 329 SVGLineElement* element = toSVGLineElement(svgElement);
330 writeNameValuePair(ts, "x1", element->x1CurrentValue().value(lengthConte xt)); 330 writeNameValuePair(ts, "x1", element->x1()->currentValue()->value(length Context));
331 writeNameValuePair(ts, "y1", element->y1CurrentValue().value(lengthConte xt)); 331 writeNameValuePair(ts, "y1", element->y1()->currentValue()->value(length Context));
332 writeNameValuePair(ts, "x2", element->x2CurrentValue().value(lengthConte xt)); 332 writeNameValuePair(ts, "x2", element->x2()->currentValue()->value(length Context));
333 writeNameValuePair(ts, "y2", element->y2CurrentValue().value(lengthConte xt)); 333 writeNameValuePair(ts, "y2", element->y2()->currentValue()->value(length Context));
334 } else if (svgElement->hasTagName(SVGNames::ellipseTag)) { 334 } else if (svgElement->hasTagName(SVGNames::ellipseTag)) {
335 SVGEllipseElement* element = toSVGEllipseElement(svgElement); 335 SVGEllipseElement* element = toSVGEllipseElement(svgElement);
336 writeNameValuePair(ts, "cx", element->cxCurrentValue().value(lengthConte xt)); 336 writeNameValuePair(ts, "cx", element->cx()->currentValue()->value(length Context));
337 writeNameValuePair(ts, "cy", element->cyCurrentValue().value(lengthConte xt)); 337 writeNameValuePair(ts, "cy", element->cy()->currentValue()->value(length Context));
338 writeNameValuePair(ts, "rx", element->rxCurrentValue().value(lengthConte xt)); 338 writeNameValuePair(ts, "rx", element->rx()->currentValue()->value(length Context));
339 writeNameValuePair(ts, "ry", element->ryCurrentValue().value(lengthConte xt)); 339 writeNameValuePair(ts, "ry", element->ry()->currentValue()->value(length Context));
340 } else if (svgElement->hasTagName(SVGNames::circleTag)) { 340 } else if (svgElement->hasTagName(SVGNames::circleTag)) {
341 SVGCircleElement* element = toSVGCircleElement(svgElement); 341 SVGCircleElement* element = toSVGCircleElement(svgElement);
342 writeNameValuePair(ts, "cx", element->cxCurrentValue().value(lengthConte xt)); 342 writeNameValuePair(ts, "cx", element->cx()->currentValue()->value(length Context));
343 writeNameValuePair(ts, "cy", element->cyCurrentValue().value(lengthConte xt)); 343 writeNameValuePair(ts, "cy", element->cy()->currentValue()->value(length Context));
344 writeNameValuePair(ts, "r", element->rCurrentValue().value(lengthContext )); 344 writeNameValuePair(ts, "r", element->r()->currentValue()->value(lengthCo ntext));
345 } else if (svgElement->hasTagName(SVGNames::polygonTag) || svgElement->hasTa gName(SVGNames::polylineTag)) { 345 } else if (svgElement->hasTagName(SVGNames::polygonTag) || svgElement->hasTa gName(SVGNames::polylineTag)) {
346 writeNameAndQuotedValue(ts, "points", toSVGPolyElement(svgElement)->poin tsCurrentValue().valueAsString()); 346 writeNameAndQuotedValue(ts, "points", toSVGPolyElement(svgElement)->poin tsCurrentValue().valueAsString());
347 } else if (svgElement->hasTagName(SVGNames::pathTag)) { 347 } else if (svgElement->hasTagName(SVGNames::pathTag)) {
348 String pathString; 348 String pathString;
349 // FIXME: We should switch to UnalteredParsing here - this will affect t he path dumping output of dozens of tests. 349 // FIXME: We should switch to UnalteredParsing here - this will affect t he path dumping output of dozens of tests.
350 buildStringFromByteStream(toSVGPathElement(svgElement)->pathByteStream() , pathString, NormalizedParsing); 350 buildStringFromByteStream(toSVGPathElement(svgElement)->pathByteStream() , pathString, NormalizedParsing);
351 writeNameAndQuotedValue(ts, "data", pathString); 351 writeNameAndQuotedValue(ts, "data", pathString);
352 } else 352 } else
353 ASSERT_NOT_REACHED(); 353 ASSERT_NOT_REACHED();
354 return ts; 354 return ts;
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 ts << " "; 651 ts << " ";
652 writeNameAndQuotedValue(ts, "filter", svgStyle->filterResource()); 652 writeNameAndQuotedValue(ts, "filter", svgStyle->filterResource());
653 ts << " "; 653 ts << " ";
654 writeStandardPrefix(ts, *filter, 0); 654 writeStandardPrefix(ts, *filter, 0);
655 ts << " " << filter->resourceBoundingBox(&renderer) << "\n"; 655 ts << " " << filter->resourceBoundingBox(&renderer) << "\n";
656 } 656 }
657 } 657 }
658 } 658 }
659 659
660 } // namespace WebCore 660 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698