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

Side by Side Diff: Source/core/layout/svg/SVGLayoutSupport.cpp

Issue 983103003: Use Length for the stroke-width property in SVGLayoutStyle (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: lengthSetterForProperty Created 5 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) 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 } 357 }
358 358
359 void SVGLayoutSupport::applyStrokeStyleToContext(GraphicsContext& context, const LayoutStyle& style, const LayoutObject& object) 359 void SVGLayoutSupport::applyStrokeStyleToContext(GraphicsContext& context, const LayoutStyle& style, const LayoutObject& object)
360 { 360 {
361 ASSERT(object.node()); 361 ASSERT(object.node());
362 ASSERT(object.node()->isSVGElement()); 362 ASSERT(object.node()->isSVGElement());
363 363
364 const SVGLayoutStyle& svgStyle = style.svgStyle(); 364 const SVGLayoutStyle& svgStyle = style.svgStyle();
365 365
366 SVGLengthContext lengthContext(toSVGElement(object.node())); 366 SVGLengthContext lengthContext(toSVGElement(object.node()));
367 context.setStrokeThickness(svgStyle.strokeWidth()->value(lengthContext)); 367 context.setStrokeThickness(lengthContext.valueForLength(svgStyle.strokeWidth ()));
368 context.setLineCap(svgStyle.capStyle()); 368 context.setLineCap(svgStyle.capStyle());
369 context.setLineJoin(svgStyle.joinStyle()); 369 context.setLineJoin(svgStyle.joinStyle());
370 context.setMiterLimit(svgStyle.strokeMiterLimit()); 370 context.setMiterLimit(svgStyle.strokeMiterLimit());
371 371
372 DashArray dashArray = resolveSVGDashArray(*svgStyle.strokeDashArray(), style , lengthContext); 372 DashArray dashArray = resolveSVGDashArray(*svgStyle.strokeDashArray(), style , lengthContext);
373 context.setLineDash(dashArray, lengthContext.valueForLength(svgStyle.strokeD ashOffset(), style)); 373 context.setLineDash(dashArray, lengthContext.valueForLength(svgStyle.strokeD ashOffset(), style));
374 } 374 }
375 375
376 void SVGLayoutSupport::applyStrokeStyleToStrokeData(StrokeData& strokeData, cons t LayoutStyle& style, const LayoutObject& object) 376 void SVGLayoutSupport::applyStrokeStyleToStrokeData(StrokeData& strokeData, cons t LayoutStyle& style, const LayoutObject& object)
377 { 377 {
378 ASSERT(object.node()); 378 ASSERT(object.node());
379 ASSERT(object.node()->isSVGElement()); 379 ASSERT(object.node()->isSVGElement());
380 380
381 const SVGLayoutStyle& svgStyle = style.svgStyle(); 381 const SVGLayoutStyle& svgStyle = style.svgStyle();
382 382
383 SVGLengthContext lengthContext(toSVGElement(object.node())); 383 SVGLengthContext lengthContext(toSVGElement(object.node()));
384 strokeData.setThickness(svgStyle.strokeWidth()->value(lengthContext)); 384 strokeData.setThickness(lengthContext.valueForLength(svgStyle.strokeWidth()) );
385 strokeData.setLineCap(svgStyle.capStyle()); 385 strokeData.setLineCap(svgStyle.capStyle());
386 strokeData.setLineJoin(svgStyle.joinStyle()); 386 strokeData.setLineJoin(svgStyle.joinStyle());
387 strokeData.setMiterLimit(svgStyle.strokeMiterLimit()); 387 strokeData.setMiterLimit(svgStyle.strokeMiterLimit());
388 388
389 DashArray dashArray = resolveSVGDashArray(*svgStyle.strokeDashArray(), style , lengthContext); 389 DashArray dashArray = resolveSVGDashArray(*svgStyle.strokeDashArray(), style , lengthContext);
390 strokeData.setLineDash(dashArray, lengthContext.valueForLength(svgStyle.stro keDashOffset(), style)); 390 strokeData.setLineDash(dashArray, lengthContext.valueForLength(svgStyle.stro keDashOffset(), style));
391 } 391 }
392 392
393 bool SVGLayoutSupport::updateGraphicsContext(const PaintInfo& paintInfo, Graphic sContextStateSaver& stateSaver, const LayoutStyle& style, LayoutObject& renderer , LayoutSVGResourceMode resourceMode, const AffineTransform* additionalPaintServ erTransform) 393 bool SVGLayoutSupport::updateGraphicsContext(const PaintInfo& paintInfo, Graphic sContextStateSaver& stateSaver, const LayoutStyle& style, LayoutObject& renderer , LayoutSVGResourceMode resourceMode, const AffineTransform* additionalPaintServ erTransform)
394 { 394 {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 504
505 layer = layer->parent(); 505 layer = layer->parent();
506 } 506 }
507 507
508 ctm.scale(deviceScaleFactor); 508 ctm.scale(deviceScaleFactor);
509 509
510 return narrowPrecisionToFloat(sqrt((pow(ctm.xScale(), 2) + pow(ctm.yScale(), 2)) / 2)); 510 return narrowPrecisionToFloat(sqrt((pow(ctm.xScale(), 2) + pow(ctm.yScale(), 2)) / 2));
511 } 511 }
512 512
513 } 513 }
OLDNEW
« no previous file with comments | « Source/core/layout/svg/LayoutSVGText.cpp ('k') | Source/core/layout/svg/SVGLayoutTreeAsText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698