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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 } | 395 } |
396 | 396 |
397 void SVGRenderSupport::fillOrStrokePath(GraphicsContext* context, unsigned short
resourceMode, const Path& path) | 397 void SVGRenderSupport::fillOrStrokePath(GraphicsContext* context, unsigned short
resourceMode, const Path& path) |
398 { | 398 { |
399 if (resourceMode & ApplyToFillMode) | 399 if (resourceMode & ApplyToFillMode) |
400 context->fillPath(path); | 400 context->fillPath(path); |
401 if (resourceMode & ApplyToStrokeMode) | 401 if (resourceMode & ApplyToStrokeMode) |
402 context->strokePath(path); | 402 context->strokePath(path); |
403 } | 403 } |
404 | 404 |
| 405 void SVGRenderSupport::updateGraphicsContext(GraphicsContext* context, const Ren
derStyle* style, const RenderObject& renderer, unsigned resourceModeFlags) |
| 406 { |
| 407 ASSERT(context); |
| 408 ASSERT(style); |
| 409 |
| 410 RenderSVGResourceMode resourceMode = static_cast<RenderSVGResourceMode>(reso
urceModeFlags & (ApplyToFillMode | ApplyToStrokeMode)); |
| 411 ASSERT(resourceMode == ApplyToFillMode || resourceMode == ApplyToStrokeMode)
; |
| 412 |
| 413 if (isRenderingClipPathAsMaskImage(renderer)) { |
| 414 // When rendering the mask for a RenderSVGResourceClipper, the stroke co
de path is never hit. |
| 415 ASSERT(resourceMode == ApplyToFillMode); |
| 416 context->setAlphaAsFloat(1); |
| 417 if (resourceModeFlags & ApplyToTextMode) |
| 418 context->setTextDrawingMode(TextModeFill); |
| 419 return; |
| 420 } |
| 421 |
| 422 const SVGRenderStyle& svgStyle = style->svgStyle(); |
| 423 |
| 424 if (resourceMode == ApplyToFillMode) { |
| 425 context->setAlphaAsFloat(svgStyle.fillOpacity()); |
| 426 context->setFillRule(svgStyle.fillRule()); |
| 427 } else { |
| 428 context->setAlphaAsFloat(svgStyle.strokeOpacity()); |
| 429 applyStrokeStyleToContext(context, style, &renderer); |
| 430 } |
| 431 |
| 432 if (resourceModeFlags & ApplyToTextMode) |
| 433 context->setTextDrawingMode(resourceMode == ApplyToFillMode ? TextModeFi
ll : TextModeStroke); |
| 434 } |
| 435 |
405 bool SVGRenderSupport::isRenderableTextNode(const RenderObject* object) | 436 bool SVGRenderSupport::isRenderableTextNode(const RenderObject* object) |
406 { | 437 { |
407 ASSERT(object->isText()); | 438 ASSERT(object->isText()); |
408 // <br> is marked as text, but is not handled by the SVG rendering code-path
. | 439 // <br> is marked as text, but is not handled by the SVG rendering code-path
. |
409 return object->isSVGInlineText() && !toRenderSVGInlineText(object)->hasEmpty
Text(); | 440 return object->isSVGInlineText() && !toRenderSVGInlineText(object)->hasEmpty
Text(); |
410 } | 441 } |
411 | 442 |
412 } | 443 } |
OLD | NEW |