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

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: revert aggressive svgAttributeChanged, add NeedsRebaseline 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 | 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 SVGLengthList::ConstIterator it = dashes->begin();
276 for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != en d; ++it) 276 SVGLengthList::ConstIterator itEnd = dashes->end();
277 dashArray.append((*it).value(lengthContext)); 277 for (; it != itEnd; ++it)
278 dashArray.append(it->value(lengthContext));
278 279
279 writeIfNotDefault(ts, "opacity", svgStyle->strokeOpacity(), 1.0f); 280 writeIfNotDefault(ts, "opacity", svgStyle->strokeOpacity(), 1.0f);
280 writeIfNotDefault(ts, "stroke width", strokeWidth, 1.0); 281 writeIfNotDefault(ts, "stroke width", strokeWidth, 1.0);
281 writeIfNotDefault(ts, "miter limit", svgStyle->strokeMiterLimit(), 4 .0f); 282 writeIfNotDefault(ts, "miter limit", svgStyle->strokeMiterLimit(), 4 .0f);
282 writeIfNotDefault(ts, "line cap", svgStyle->capStyle(), ButtCap); 283 writeIfNotDefault(ts, "line cap", svgStyle->capStyle(), ButtCap);
283 writeIfNotDefault(ts, "line join", svgStyle->joinStyle(), MiterJoin) ; 284 writeIfNotDefault(ts, "line join", svgStyle->joinStyle(), MiterJoin) ;
284 writeIfNotDefault(ts, "dash offset", dashOffset, 0.0); 285 writeIfNotDefault(ts, "dash offset", dashOffset, 0.0);
285 if (!dashArray.isEmpty()) 286 if (!dashArray.isEmpty())
286 writeNameValuePair(ts, "dash array", dashArray); 287 writeNameValuePair(ts, "dash array", dashArray);
287 288
(...skipping 26 matching lines...) Expand all
314 315
315 static TextStream& operator<<(TextStream& ts, const RenderSVGShape& shape) 316 static TextStream& operator<<(TextStream& ts, const RenderSVGShape& shape)
316 { 317 {
317 writePositionAndStyle(ts, shape); 318 writePositionAndStyle(ts, shape);
318 319
319 SVGElement* svgElement = shape.element(); 320 SVGElement* svgElement = shape.element();
320 SVGLengthContext lengthContext(svgElement); 321 SVGLengthContext lengthContext(svgElement);
321 322
322 if (svgElement->hasTagName(SVGNames::rectTag)) { 323 if (svgElement->hasTagName(SVGNames::rectTag)) {
323 SVGRectElement* element = toSVGRectElement(svgElement); 324 SVGRectElement* element = toSVGRectElement(svgElement);
324 writeNameValuePair(ts, "x", element->xCurrentValue().value(lengthContext )); 325 writeNameValuePair(ts, "x", element->x()->currentValue()->value(lengthCo ntext));
325 writeNameValuePair(ts, "y", element->yCurrentValue().value(lengthContext )); 326 writeNameValuePair(ts, "y", element->y()->currentValue()->value(lengthCo ntext));
326 writeNameValuePair(ts, "width", element->widthCurrentValue().value(lengt hContext)); 327 writeNameValuePair(ts, "width", element->width()->currentValue()->value( lengthContext));
327 writeNameValuePair(ts, "height", element->heightCurrentValue().value(len gthContext)); 328 writeNameValuePair(ts, "height", element->height()->currentValue()->valu e(lengthContext));
328 } else if (svgElement->hasTagName(SVGNames::lineTag)) { 329 } else if (svgElement->hasTagName(SVGNames::lineTag)) {
329 SVGLineElement* element = toSVGLineElement(svgElement); 330 SVGLineElement* element = toSVGLineElement(svgElement);
330 writeNameValuePair(ts, "x1", element->x1CurrentValue().value(lengthConte xt)); 331 writeNameValuePair(ts, "x1", element->x1()->currentValue()->value(length Context));
331 writeNameValuePair(ts, "y1", element->y1CurrentValue().value(lengthConte xt)); 332 writeNameValuePair(ts, "y1", element->y1()->currentValue()->value(length Context));
332 writeNameValuePair(ts, "x2", element->x2CurrentValue().value(lengthConte xt)); 333 writeNameValuePair(ts, "x2", element->x2()->currentValue()->value(length Context));
333 writeNameValuePair(ts, "y2", element->y2CurrentValue().value(lengthConte xt)); 334 writeNameValuePair(ts, "y2", element->y2()->currentValue()->value(length Context));
334 } else if (svgElement->hasTagName(SVGNames::ellipseTag)) { 335 } else if (svgElement->hasTagName(SVGNames::ellipseTag)) {
335 SVGEllipseElement* element = toSVGEllipseElement(svgElement); 336 SVGEllipseElement* element = toSVGEllipseElement(svgElement);
336 writeNameValuePair(ts, "cx", element->cxCurrentValue().value(lengthConte xt)); 337 writeNameValuePair(ts, "cx", element->cx()->currentValue()->value(length Context));
337 writeNameValuePair(ts, "cy", element->cyCurrentValue().value(lengthConte xt)); 338 writeNameValuePair(ts, "cy", element->cy()->currentValue()->value(length Context));
338 writeNameValuePair(ts, "rx", element->rxCurrentValue().value(lengthConte xt)); 339 writeNameValuePair(ts, "rx", element->rx()->currentValue()->value(length Context));
339 writeNameValuePair(ts, "ry", element->ryCurrentValue().value(lengthConte xt)); 340 writeNameValuePair(ts, "ry", element->ry()->currentValue()->value(length Context));
340 } else if (svgElement->hasTagName(SVGNames::circleTag)) { 341 } else if (svgElement->hasTagName(SVGNames::circleTag)) {
341 SVGCircleElement* element = toSVGCircleElement(svgElement); 342 SVGCircleElement* element = toSVGCircleElement(svgElement);
342 writeNameValuePair(ts, "cx", element->cxCurrentValue().value(lengthConte xt)); 343 writeNameValuePair(ts, "cx", element->cx()->currentValue()->value(length Context));
343 writeNameValuePair(ts, "cy", element->cyCurrentValue().value(lengthConte xt)); 344 writeNameValuePair(ts, "cy", element->cy()->currentValue()->value(length Context));
344 writeNameValuePair(ts, "r", element->rCurrentValue().value(lengthContext )); 345 writeNameValuePair(ts, "r", element->r()->currentValue()->value(lengthCo ntext));
345 } else if (svgElement->hasTagName(SVGNames::polygonTag) || svgElement->hasTa gName(SVGNames::polylineTag)) { 346 } else if (svgElement->hasTagName(SVGNames::polygonTag) || svgElement->hasTa gName(SVGNames::polylineTag)) {
346 writeNameAndQuotedValue(ts, "points", toSVGPolyElement(svgElement)->poin tsCurrentValue().valueAsString()); 347 writeNameAndQuotedValue(ts, "points", toSVGPolyElement(svgElement)->poin tsCurrentValue().valueAsString());
347 } else if (svgElement->hasTagName(SVGNames::pathTag)) { 348 } else if (svgElement->hasTagName(SVGNames::pathTag)) {
348 String pathString; 349 String pathString;
349 // FIXME: We should switch to UnalteredParsing here - this will affect t he path dumping output of dozens of tests. 350 // 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); 351 buildStringFromByteStream(toSVGPathElement(svgElement)->pathByteStream() , pathString, NormalizedParsing);
351 writeNameAndQuotedValue(ts, "data", pathString); 352 writeNameAndQuotedValue(ts, "data", pathString);
352 } else 353 } else
353 ASSERT_NOT_REACHED(); 354 ASSERT_NOT_REACHED();
354 return ts; 355 return ts;
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 ts << " "; 652 ts << " ";
652 writeNameAndQuotedValue(ts, "filter", svgStyle->filterResource()); 653 writeNameAndQuotedValue(ts, "filter", svgStyle->filterResource());
653 ts << " "; 654 ts << " ";
654 writeStandardPrefix(ts, *filter, 0); 655 writeStandardPrefix(ts, *filter, 0);
655 ts << " " << filter->resourceBoundingBox(&renderer) << "\n"; 656 ts << " " << filter->resourceBoundingBox(&renderer) << "\n";
656 } 657 }
657 } 658 }
658 } 659 }
659 660
660 } // namespace WebCore 661 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/SVGRenderSupport.cpp ('k') | Source/core/rendering/svg/SVGTextChunkBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698