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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 bool SVGRenderSupport::prepareToRenderSVGContent(RenderObject* object, PaintInfo
& paintInfo) | 80 bool SVGRenderSupport::prepareToRenderSVGContent(RenderObject* object, PaintInfo
& paintInfo) |
81 { | 81 { |
82 ASSERT(object); | 82 ASSERT(object); |
83 | 83 |
84 RenderStyle* style = object->style(); | 84 RenderStyle* style = object->style(); |
85 ASSERT(style); | 85 ASSERT(style); |
86 | 86 |
87 const SVGRenderStyle* svgStyle = style->svgStyle(); | 87 const SVGRenderStyle* svgStyle = style->svgStyle(); |
88 ASSERT(svgStyle); | 88 ASSERT(svgStyle); |
89 | 89 |
| 90 bool isRenderingMask = false; |
| 91 if (object->frame() && object->frame()->view()) |
| 92 isRenderingMask = object->frame()->view()->paintBehavior() & PaintBehavi
orRenderingSVGMask; |
| 93 |
90 // Setup transparency layers before setting up SVG resources! | 94 // Setup transparency layers before setting up SVG resources! |
91 float opacity = style->opacity(); | 95 float opacity = isRenderingMask ? 1 : style->opacity(); |
92 const ShadowData* shadow = svgStyle->shadow(); | 96 const ShadowData* shadow = svgStyle->shadow(); |
93 if (opacity < 1 || shadow) { | 97 if (opacity < 1 || shadow) { |
94 FloatRect repaintRect = object->repaintRectInLocalCoordinates(); | 98 FloatRect repaintRect = object->repaintRectInLocalCoordinates(); |
95 | 99 |
96 if (opacity < 1) { | 100 if (opacity < 1) { |
97 paintInfo.context->clip(repaintRect); | 101 paintInfo.context->clip(repaintRect); |
98 paintInfo.context->beginTransparencyLayer(opacity); | 102 paintInfo.context->beginTransparencyLayer(opacity); |
99 } | 103 } |
100 | 104 |
101 if (shadow) { | 105 if (shadow) { |
102 paintInfo.context->clip(repaintRect); | 106 paintInfo.context->clip(repaintRect); |
103 paintInfo.context->setShadow(IntSize(shadow->x(), shadow->y()), shad
ow->blur(), shadow->color(), style->colorSpace()); | 107 paintInfo.context->setShadow(IntSize(shadow->x(), shadow->y()), shad
ow->blur(), shadow->color(), style->colorSpace()); |
104 paintInfo.context->beginTransparencyLayer(1); | 108 paintInfo.context->beginTransparencyLayer(1); |
105 } | 109 } |
106 } | 110 } |
107 | 111 |
108 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(
object); | 112 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(
object); |
109 if (!resources) { | 113 if (!resources) { |
110 #if ENABLE(FILTERS) | 114 #if ENABLE(FILTERS) |
111 if (svgStyle->hasFilter()) | 115 if (svgStyle->hasFilter()) |
112 return false; | 116 return false; |
113 #endif | 117 #endif |
114 return true; | 118 return true; |
115 } | 119 } |
116 | 120 |
117 if (RenderSVGResourceMasker* masker = resources->masker()) { | 121 if (!isRenderingMask) { |
118 if (!masker->applyResource(object, style, paintInfo.context, ApplyToDefa
ultMode)) | 122 if (RenderSVGResourceMasker* masker = resources->masker()) { |
119 return false; | 123 if (!masker->applyResource(object, style, paintInfo.context, ApplyTo
DefaultMode)) |
| 124 return false; |
| 125 } |
120 } | 126 } |
121 | 127 |
122 if (RenderSVGResourceClipper* clipper = resources->clipper()) { | 128 if (RenderSVGResourceClipper* clipper = resources->clipper()) { |
123 if (!clipper->applyResource(object, style, paintInfo.context, ApplyToDef
aultMode)) | 129 if (!clipper->applyResource(object, style, paintInfo.context, ApplyToDef
aultMode)) |
124 return false; | 130 return false; |
125 } | 131 } |
126 | 132 |
127 #if ENABLE(FILTERS) | 133 #if ENABLE(FILTERS) |
128 if (RenderSVGResourceFilter* filter = resources->filter()) { | 134 if (!isRenderingMask) { |
129 if (!filter->applyResource(object, style, paintInfo.context, ApplyToDefa
ultMode)) | 135 if (RenderSVGResourceFilter* filter = resources->filter()) { |
130 return false; | 136 if (!filter->applyResource(object, style, paintInfo.context, ApplyTo
DefaultMode)) |
| 137 return false; |
| 138 } |
131 } | 139 } |
132 #endif | 140 #endif |
133 | 141 |
134 return true; | 142 return true; |
135 } | 143 } |
136 | 144 |
137 void SVGRenderSupport::finishRenderSVGContent(RenderObject* object, PaintInfo& p
aintInfo, GraphicsContext* savedContext) | 145 void SVGRenderSupport::finishRenderSVGContent(RenderObject* object, PaintInfo& p
aintInfo, GraphicsContext* savedContext) |
138 { | 146 { |
139 #if !ENABLE(FILTERS) | 147 #if !ENABLE(FILTERS) |
140 UNUSED_PARAM(savedContext); | 148 UNUSED_PARAM(savedContext); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; +
+it) | 369 for (Vector<SVGLength>::const_iterator it = dashes.begin(); it != end; +
+it) |
362 dashArray.append((*it).value(lengthContext)); | 370 dashArray.append((*it).value(lengthContext)); |
363 | 371 |
364 context->setLineDash(dashArray, svgStyle->strokeDashOffset().value(lengt
hContext)); | 372 context->setLineDash(dashArray, svgStyle->strokeDashOffset().value(lengt
hContext)); |
365 } | 373 } |
366 } | 374 } |
367 | 375 |
368 } | 376 } |
369 | 377 |
370 #endif | 378 #endif |
OLD | NEW |