OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 { | 47 { |
48 // We are NOT allowed to ASSERT(object) here, unlike all other resources. | 48 // We are NOT allowed to ASSERT(object) here, unlike all other resources. |
49 // RenderSVGResourceSolidColor is the only resource which may be used from H
TML, when rendering | 49 // RenderSVGResourceSolidColor is the only resource which may be used from H
TML, when rendering |
50 // SVG Fonts for a HTML document. This will be indicated by a null RenderObj
ect pointer. | 50 // SVG Fonts for a HTML document. This will be indicated by a null RenderObj
ect pointer. |
51 ASSERT(context); | 51 ASSERT(context); |
52 ASSERT(resourceMode != ApplyToDefaultMode); | 52 ASSERT(resourceMode != ApplyToDefaultMode); |
53 | 53 |
54 const SVGRenderStyle* svgStyle = style ? style->svgStyle() : 0; | 54 const SVGRenderStyle* svgStyle = style ? style->svgStyle() : 0; |
55 ColorSpace colorSpace = style ? style->colorSpace() : ColorSpaceDeviceRGB; | 55 ColorSpace colorSpace = style ? style->colorSpace() : ColorSpaceDeviceRGB; |
56 | 56 |
| 57 bool isRenderingMask = false; |
| 58 if (object->frame() && object->frame()->view()) |
| 59 isRenderingMask = object->frame()->view()->paintBehavior() & PaintBehavi
orRenderingSVGMask; |
| 60 |
57 if (resourceMode & ApplyToFillMode) { | 61 if (resourceMode & ApplyToFillMode) { |
58 context->setAlpha(svgStyle ? svgStyle->fillOpacity() : 1.0f); | 62 if (!isRenderingMask && svgStyle) |
| 63 context->setAlpha(svgStyle->fillOpacity()); |
| 64 else |
| 65 context->setAlpha(1); |
59 context->setFillColor(m_color, colorSpace); | 66 context->setFillColor(m_color, colorSpace); |
60 context->setFillRule(svgStyle ? svgStyle->fillRule() : RULE_NONZERO); | 67 if (!isRenderingMask) |
| 68 context->setFillRule(svgStyle ? svgStyle->fillRule() : RULE_NONZERO)
; |
61 | 69 |
62 if (resourceMode & ApplyToTextMode) | 70 if (resourceMode & ApplyToTextMode) |
63 context->setTextDrawingMode(TextModeFill); | 71 context->setTextDrawingMode(TextModeFill); |
64 } else if (resourceMode & ApplyToStrokeMode) { | 72 } else if (resourceMode & ApplyToStrokeMode) { |
65 context->setAlpha(svgStyle ? svgStyle->strokeOpacity() : 1.0f); | 73 // When rendering the mask for a RenderSVGResourceClipper, the stroke co
de path is never hit. |
| 74 ASSERT(!isRenderingMask); |
| 75 context->setAlpha(svgStyle ? svgStyle->strokeOpacity() : 1); |
66 context->setStrokeColor(m_color, colorSpace); | 76 context->setStrokeColor(m_color, colorSpace); |
67 | 77 |
68 if (style) | 78 if (style) |
69 SVGRenderSupport::applyStrokeStyleToContext(context, style, object); | 79 SVGRenderSupport::applyStrokeStyleToContext(context, style, object); |
70 | 80 |
71 if (resourceMode & ApplyToTextMode) | 81 if (resourceMode & ApplyToTextMode) |
72 context->setTextDrawingMode(TextModeStroke); | 82 context->setTextDrawingMode(TextModeStroke); |
73 } | 83 } |
74 | 84 |
75 return true; | 85 return true; |
(...skipping 14 matching lines...) Expand all Loading... |
90 if (path) | 100 if (path) |
91 context->strokePath(*path); | 101 context->strokePath(*path); |
92 else if (shape) | 102 else if (shape) |
93 shape->strokeShape(context); | 103 shape->strokeShape(context); |
94 } | 104 } |
95 } | 105 } |
96 | 106 |
97 } | 107 } |
98 | 108 |
99 #endif | 109 #endif |
OLD | NEW |