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

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

Issue 191003007: Use isSVG*Element() helpers more in SVG code (Part 3) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 ts << " " << enclosingIntRect(const_cast<RenderObject&>(object).absoluteClip pedOverflowRect()); 331 ts << " " << enclosingIntRect(const_cast<RenderObject&>(object).absoluteClip pedOverflowRect());
332 writeStyle(ts, object); 332 writeStyle(ts, object);
333 return ts; 333 return ts;
334 } 334 }
335 335
336 static TextStream& operator<<(TextStream& ts, const RenderSVGShape& shape) 336 static TextStream& operator<<(TextStream& ts, const RenderSVGShape& shape)
337 { 337 {
338 writePositionAndStyle(ts, shape); 338 writePositionAndStyle(ts, shape);
339 339
340 SVGElement* svgElement = shape.element(); 340 SVGElement* svgElement = shape.element();
341 ASSERT(svgElement);
341 SVGLengthContext lengthContext(svgElement); 342 SVGLengthContext lengthContext(svgElement);
342 343
343 if (svgElement->hasTagName(SVGNames::rectTag)) { 344 if (isSVGRectElement(*svgElement)) {
344 SVGRectElement* element = toSVGRectElement(svgElement); 345 SVGRectElement& element = toSVGRectElement(*svgElement);
345 writeNameValuePair(ts, "x", element->x()->currentValue()->value(lengthCo ntext)); 346 writeNameValuePair(ts, "x", element.x()->currentValue()->value(lengthCon text));
346 writeNameValuePair(ts, "y", element->y()->currentValue()->value(lengthCo ntext)); 347 writeNameValuePair(ts, "y", element.y()->currentValue()->value(lengthCon text));
347 writeNameValuePair(ts, "width", element->width()->currentValue()->value( lengthContext)); 348 writeNameValuePair(ts, "width", element.width()->currentValue()->value(l engthContext));
348 writeNameValuePair(ts, "height", element->height()->currentValue()->valu e(lengthContext)); 349 writeNameValuePair(ts, "height", element.height()->currentValue()->value (lengthContext));
349 } else if (svgElement->hasTagName(SVGNames::lineTag)) { 350 } else if (isSVGLineElement(*svgElement)) {
350 SVGLineElement* element = toSVGLineElement(svgElement); 351 SVGLineElement& element = toSVGLineElement(*svgElement);
351 writeNameValuePair(ts, "x1", element->x1()->currentValue()->value(length Context)); 352 writeNameValuePair(ts, "x1", element.x1()->currentValue()->value(lengthC ontext));
352 writeNameValuePair(ts, "y1", element->y1()->currentValue()->value(length Context)); 353 writeNameValuePair(ts, "y1", element.y1()->currentValue()->value(lengthC ontext));
353 writeNameValuePair(ts, "x2", element->x2()->currentValue()->value(length Context)); 354 writeNameValuePair(ts, "x2", element.x2()->currentValue()->value(lengthC ontext));
354 writeNameValuePair(ts, "y2", element->y2()->currentValue()->value(length Context)); 355 writeNameValuePair(ts, "y2", element.y2()->currentValue()->value(lengthC ontext));
355 } else if (svgElement->hasTagName(SVGNames::ellipseTag)) { 356 } else if (isSVGEllipseElement(*svgElement)) {
356 SVGEllipseElement* element = toSVGEllipseElement(svgElement); 357 SVGEllipseElement& element = toSVGEllipseElement(*svgElement);
357 writeNameValuePair(ts, "cx", element->cx()->currentValue()->value(length Context)); 358 writeNameValuePair(ts, "cx", element.cx()->currentValue()->value(lengthC ontext));
358 writeNameValuePair(ts, "cy", element->cy()->currentValue()->value(length Context)); 359 writeNameValuePair(ts, "cy", element.cy()->currentValue()->value(lengthC ontext));
359 writeNameValuePair(ts, "rx", element->rx()->currentValue()->value(length Context)); 360 writeNameValuePair(ts, "rx", element.rx()->currentValue()->value(lengthC ontext));
360 writeNameValuePair(ts, "ry", element->ry()->currentValue()->value(length Context)); 361 writeNameValuePair(ts, "ry", element.ry()->currentValue()->value(lengthC ontext));
361 } else if (svgElement->hasTagName(SVGNames::circleTag)) { 362 } else if (isSVGCircleElement(*svgElement)) {
362 SVGCircleElement* element = toSVGCircleElement(svgElement); 363 SVGCircleElement& element = toSVGCircleElement(*svgElement);
363 writeNameValuePair(ts, "cx", element->cx()->currentValue()->value(length Context)); 364 writeNameValuePair(ts, "cx", element.cx()->currentValue()->value(lengthC ontext));
364 writeNameValuePair(ts, "cy", element->cy()->currentValue()->value(length Context)); 365 writeNameValuePair(ts, "cy", element.cy()->currentValue()->value(lengthC ontext));
365 writeNameValuePair(ts, "r", element->r()->currentValue()->value(lengthCo ntext)); 366 writeNameValuePair(ts, "r", element.r()->currentValue()->value(lengthCon text));
366 } else if (svgElement->hasTagName(SVGNames::polygonTag) || svgElement->hasTa gName(SVGNames::polylineTag)) { 367 } else if (isSVGPolyElement(*svgElement)) {
367 writeNameAndQuotedValue(ts, "points", toSVGPolyElement(svgElement)->poin ts()->currentValue()->valueAsString()); 368 writeNameAndQuotedValue(ts, "points", toSVGPolyElement(*svgElement).poin ts()->currentValue()->valueAsString());
368 } else if (svgElement->hasTagName(SVGNames::pathTag)) { 369 } else if (isSVGPathElement(*svgElement)) {
369 String pathString; 370 String pathString;
370 // FIXME: We should switch to UnalteredParsing here - this will affect t he path dumping output of dozens of tests. 371 // FIXME: We should switch to UnalteredParsing here - this will affect t he path dumping output of dozens of tests.
371 buildStringFromByteStream(toSVGPathElement(svgElement)->pathByteStream() , pathString, NormalizedParsing); 372 buildStringFromByteStream(toSVGPathElement(*svgElement).pathByteStream() , pathString, NormalizedParsing);
372 writeNameAndQuotedValue(ts, "data", pathString); 373 writeNameAndQuotedValue(ts, "data", pathString);
373 } else 374 } else
374 ASSERT_NOT_REACHED(); 375 ASSERT_NOT_REACHED();
375 return ts; 376 return ts;
376 } 377 }
377 378
378 static TextStream& operator<<(TextStream& ts, const RenderSVGRoot& root) 379 static TextStream& operator<<(TextStream& ts, const RenderSVGRoot& root)
379 { 380 {
380 return writePositionAndStyle(ts, root); 381 return writePositionAndStyle(ts, root);
381 } 382 }
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 ts << " "; 673 ts << " ";
673 writeNameAndQuotedValue(ts, "filter", svgStyle->filterResource()); 674 writeNameAndQuotedValue(ts, "filter", svgStyle->filterResource());
674 ts << " "; 675 ts << " ";
675 writeStandardPrefix(ts, *filter, 0); 676 writeStandardPrefix(ts, *filter, 0);
676 ts << " " << filter->resourceBoundingBox(&renderer) << "\n"; 677 ts << " " << filter->resourceBoundingBox(&renderer) << "\n";
677 } 678 }
678 } 679 }
679 } 680 }
680 681
681 } // namespace WebCore 682 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGViewportContainer.cpp ('k') | Source/core/rendering/svg/SVGResources.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698