Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 size_t length = dashes->numberOfItems(); |
|
pdr.
2014/01/07 06:42:53
This may introduce a perf regression due to bounds
kouhei (in TOK)
2014/01/08 08:12:07
Done. Added NewSVGListPropertyHelper<>::ConstItera
| |
| 371 for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it) | 371 for (size_t i = 0; i < length; ++i) |
| 372 dashArray.append((*it).value(lengthContext)); | 372 dashArray.append(dashes->at(i)->value(lengthContext)); |
| 373 | 373 |
| 374 context->setLineDash(dashArray, svgStyle->strokeDashOffset().value(lengthCon text)); | 374 context->setLineDash(dashArray, svgStyle->strokeDashOffset()->value(lengthCo ntext)); |
| 375 } | 375 } |
| 376 | 376 |
| 377 void SVGRenderSupport::applyStrokeStyleToStrokeData(StrokeData* strokeData, cons t RenderStyle* style, const RenderObject* object) | 377 void SVGRenderSupport::applyStrokeStyleToStrokeData(StrokeData* strokeData, cons t RenderStyle* style, const RenderObject* object) |
| 378 { | 378 { |
| 379 ASSERT(strokeData); | 379 ASSERT(strokeData); |
| 380 ASSERT(style); | 380 ASSERT(style); |
| 381 ASSERT(object); | 381 ASSERT(object); |
| 382 ASSERT(object->node()); | 382 ASSERT(object->node()); |
| 383 ASSERT(object->node()->isSVGElement()); | 383 ASSERT(object->node()->isSVGElement()); |
| 384 | 384 |
| 385 const SVGRenderStyle* svgStyle = style->svgStyle(); | 385 const SVGRenderStyle* svgStyle = style->svgStyle(); |
| 386 ASSERT(svgStyle); | 386 ASSERT(svgStyle); |
| 387 | 387 |
| 388 SVGLengthContext lengthContext(toSVGElement(object->node())); | 388 SVGLengthContext lengthContext(toSVGElement(object->node())); |
| 389 strokeData->setThickness(svgStyle->strokeWidth().value(lengthContext)); | 389 strokeData->setThickness(svgStyle->strokeWidth()->value(lengthContext)); |
| 390 strokeData->setLineCap(svgStyle->capStyle()); | 390 strokeData->setLineCap(svgStyle->capStyle()); |
| 391 strokeData->setLineJoin(svgStyle->joinStyle()); | 391 strokeData->setLineJoin(svgStyle->joinStyle()); |
| 392 strokeData->setMiterLimit(svgStyle->strokeMiterLimit()); | 392 strokeData->setMiterLimit(svgStyle->strokeMiterLimit()); |
| 393 | 393 |
| 394 const Vector<SVGLength>& dashes = svgStyle->strokeDashArray(); | 394 RefPtr<SVGLengthList> dashes = svgStyle->strokeDashArray(); |
| 395 if (dashes.isEmpty()) | 395 if (dashes->isEmpty()) |
| 396 return; | 396 return; |
| 397 | 397 |
| 398 DashArray dashArray; | 398 DashArray dashArray; |
| 399 const Vector<SVGLength>::const_iterator end = dashes.end(); | 399 size_t length = dashes->numberOfItems(); |
| 400 for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; ++it) | 400 for (size_t i = 0; i < length; ++i) |
| 401 dashArray.append((*it).value(lengthContext)); | 401 dashArray.append(dashes->at(i)->value(lengthContext)); |
| 402 | 402 |
| 403 strokeData->setLineDash(dashArray, svgStyle->strokeDashOffset().value(length Context)); | 403 strokeData->setLineDash(dashArray, svgStyle->strokeDashOffset()->value(lengt hContext)); |
| 404 } | 404 } |
| 405 | 405 |
| 406 bool SVGRenderSupport::isEmptySVGInlineText(const RenderObject* object) | 406 bool SVGRenderSupport::isEmptySVGInlineText(const RenderObject* object) |
| 407 { | 407 { |
| 408 // RenderSVGInlineText performs whitespace filtering in order to support xml :space | 408 // 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 | 409 // (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. | 410 // even when its original constructor argument is non-empty. |
| 411 return object->isSVGInlineText() && toRenderSVGInlineText(object)->hasEmptyT ext(); | 411 return object->isSVGInlineText() && toRenderSVGInlineText(object)->hasEmptyT ext(); |
| 412 } | 412 } |
| 413 | 413 |
| 414 } | 414 } |
| OLD | NEW |