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

Side by Side Diff: Source/core/rendering/svg/SVGRenderSupport.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) 2007, 2008 Rob Buis <buis@kde.org> 2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org>
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Google, Inc. All rights reserved. 5 * Copyright (C) 2009 Google, Inc. All rights reserved.
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 ASSERT(context); 350 ASSERT(context);
351 ASSERT(style); 351 ASSERT(style);
352 ASSERT(object); 352 ASSERT(object);
353 ASSERT(object->node()); 353 ASSERT(object->node());
354 ASSERT(object->node()->isSVGElement()); 354 ASSERT(object->node()->isSVGElement());
355 355
356 const SVGRenderStyle* svgStyle = style->svgStyle(); 356 const SVGRenderStyle* svgStyle = style->svgStyle();
357 ASSERT(svgStyle); 357 ASSERT(svgStyle);
358 358
359 SVGLengthContext lengthContext(toSVGElement(object->node())); 359 SVGLengthContext lengthContext(toSVGElement(object->node()));
360 context->setStrokeThickness(svgStyle->strokeWidth().value(lengthContext)); 360 context->setStrokeThickness(svgStyle->strokeWidth()->value(lengthContext));
361 context->setLineCap(svgStyle->capStyle()); 361 context->setLineCap(svgStyle->capStyle());
362 context->setLineJoin(svgStyle->joinStyle()); 362 context->setLineJoin(svgStyle->joinStyle());
363 context->setMiterLimit(svgStyle->strokeMiterLimit()); 363 context->setMiterLimit(svgStyle->strokeMiterLimit());
364 364
365 const Vector<SVGLength>& dashes = svgStyle->strokeDashArray(); 365 RefPtr<SVGLengthList> dashes = svgStyle->strokeDashArray();
366 if (dashes.isEmpty()) 366 if (dashes->isEmpty())
367 return; 367 return;
368 368
369 DashArray dashArray; 369 DashArray dashArray;
370 const Vector<SVGLength>::const_iterator end = dashes.end(); 370 SVGLengthList::ConstIterator it = dashes->begin();
371 for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it) 371 SVGLengthList::ConstIterator itEnd = dashes->end();
372 dashArray.append((*it).value(lengthContext)); 372 for (; it != itEnd; ++it)
373 dashArray.append(it->value(lengthContext));
373 374
374 context->setLineDash(dashArray, svgStyle->strokeDashOffset().value(lengthCon text)); 375 context->setLineDash(dashArray, svgStyle->strokeDashOffset()->value(lengthCo ntext));
375 } 376 }
376 377
377 void SVGRenderSupport::applyStrokeStyleToStrokeData(StrokeData* strokeData, cons t RenderStyle* style, const RenderObject* object) 378 void SVGRenderSupport::applyStrokeStyleToStrokeData(StrokeData* strokeData, cons t RenderStyle* style, const RenderObject* object)
378 { 379 {
379 ASSERT(strokeData); 380 ASSERT(strokeData);
380 ASSERT(style); 381 ASSERT(style);
381 ASSERT(object); 382 ASSERT(object);
382 ASSERT(object->node()); 383 ASSERT(object->node());
383 ASSERT(object->node()->isSVGElement()); 384 ASSERT(object->node()->isSVGElement());
384 385
385 const SVGRenderStyle* svgStyle = style->svgStyle(); 386 const SVGRenderStyle* svgStyle = style->svgStyle();
386 ASSERT(svgStyle); 387 ASSERT(svgStyle);
387 388
388 SVGLengthContext lengthContext(toSVGElement(object->node())); 389 SVGLengthContext lengthContext(toSVGElement(object->node()));
389 strokeData->setThickness(svgStyle->strokeWidth().value(lengthContext)); 390 strokeData->setThickness(svgStyle->strokeWidth()->value(lengthContext));
390 strokeData->setLineCap(svgStyle->capStyle()); 391 strokeData->setLineCap(svgStyle->capStyle());
391 strokeData->setLineJoin(svgStyle->joinStyle()); 392 strokeData->setLineJoin(svgStyle->joinStyle());
392 strokeData->setMiterLimit(svgStyle->strokeMiterLimit()); 393 strokeData->setMiterLimit(svgStyle->strokeMiterLimit());
393 394
394 const Vector<SVGLength>& dashes = svgStyle->strokeDashArray(); 395 RefPtr<SVGLengthList> dashes = svgStyle->strokeDashArray();
395 if (dashes.isEmpty()) 396 if (dashes->isEmpty())
396 return; 397 return;
397 398
398 DashArray dashArray; 399 DashArray dashArray;
399 const Vector<SVGLength>::const_iterator end = dashes.end(); 400 size_t length = dashes->numberOfItems();
400 for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it) 401 for (size_t i = 0; i < length; ++i)
401 dashArray.append((*it).value(lengthContext)); 402 dashArray.append(dashes->at(i)->value(lengthContext));
402 403
403 strokeData->setLineDash(dashArray, svgStyle->strokeDashOffset().value(length Context)); 404 strokeData->setLineDash(dashArray, svgStyle->strokeDashOffset()->value(lengt hContext));
404 } 405 }
405 406
406 bool SVGRenderSupport::isEmptySVGInlineText(const RenderObject* object) 407 bool SVGRenderSupport::isEmptySVGInlineText(const RenderObject* object)
407 { 408 {
408 // RenderSVGInlineText performs whitespace filtering in order to support xml :space 409 // RenderSVGInlineText performs whitespace filtering in order to support xml :space
409 // (http://www.w3.org/TR/SVG/struct.html#LangSpaceAttrs), and can end up wit h an empty string 410 // (http://www.w3.org/TR/SVG/struct.html#LangSpaceAttrs), and can end up wit h an empty string
410 // even when its original constructor argument is non-empty. 411 // even when its original constructor argument is non-empty.
411 return object->isSVGInlineText() && toRenderSVGInlineText(object)->hasEmptyT ext(); 412 return object->isSVGInlineText() && toRenderSVGInlineText(object)->hasEmptyT ext();
412 } 413 }
413 414
414 } 415 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/SVGPathData.cpp ('k') | Source/core/rendering/svg/SVGRenderTreeAsText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698