OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> | 4 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> |
5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 29 matching lines...) Expand all Loading... |
40 if (!object->parent() || !object->parent()->style()) | 40 if (!object->parent() || !object->parent()->style()) |
41 return false; | 41 return false; |
42 const SVGRenderStyle& parentSVGStyle = object->parent()->style()->svgStyle()
; | 42 const SVGRenderStyle& parentSVGStyle = object->parent()->style()->svgStyle()
; |
43 SVGPaintType paintType = applyToFill ? parentSVGStyle.fillPaintType() : pare
ntSVGStyle.strokePaintType(); | 43 SVGPaintType paintType = applyToFill ? parentSVGStyle.fillPaintType() : pare
ntSVGStyle.strokePaintType(); |
44 if (paintType != SVG_PAINTTYPE_RGBCOLOR && paintType != SVG_PAINTTYPE_RGBCOL
OR_ICCCOLOR) | 44 if (paintType != SVG_PAINTTYPE_RGBCOLOR && paintType != SVG_PAINTTYPE_RGBCOL
OR_ICCCOLOR) |
45 return false; | 45 return false; |
46 color = applyToFill ? parentSVGStyle.fillPaintColor() : parentSVGStyle.strok
ePaintColor(); | 46 color = applyToFill ? parentSVGStyle.fillPaintColor() : parentSVGStyle.strok
ePaintColor(); |
47 return true; | 47 return true; |
48 } | 48 } |
49 | 49 |
50 static inline RenderSVGResource* requestPaintingResource(RenderSVGResourceMode m
ode, RenderObject* object, const RenderStyle* style, bool& hasFallback) | 50 RenderSVGResource* RenderSVGResource::requestPaintingResource(RenderSVGResourceM
ode mode, RenderObject* object, const RenderStyle* style, bool& hasFallback) |
51 { | 51 { |
52 ASSERT(object); | 52 ASSERT(object); |
53 ASSERT(style); | 53 ASSERT(style); |
54 | 54 |
55 hasFallback = false; | 55 hasFallback = false; |
56 | 56 |
57 // If we have no style at all, ignore it. | 57 // If we have no style at all, ignore it. |
58 const SVGRenderStyle& svgStyle = style->svgStyle(); | 58 const SVGRenderStyle& svgStyle = style->svgStyle(); |
59 | 59 |
60 bool isRenderingMask = false; | 60 bool isRenderingMask = false; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
141 // The paint server resource exists, though it may be invalid (pattern with
width/height=0). Pass the fallback color to our caller | 141 // The paint server resource exists, though it may be invalid (pattern with
width/height=0). Pass the fallback color to our caller |
142 // via sharedSolidPaintingResource so it can use the solid color painting re
source, if applyResource() on the URI resource failed. | 142 // via sharedSolidPaintingResource so it can use the solid color painting re
source, if applyResource() on the URI resource failed. |
143 if (hasColor) { | 143 if (hasColor) { |
144 colorResource->setColor(color); | 144 colorResource->setColor(color); |
145 hasFallback = true; | 145 hasFallback = true; |
146 } | 146 } |
147 return uriResource; | 147 return uriResource; |
148 } | 148 } |
149 | 149 |
150 RenderSVGResource* RenderSVGResource::fillPaintingResource(RenderObject* object,
const RenderStyle* style, bool& hasFallback) | |
151 { | |
152 return requestPaintingResource(ApplyToFillMode, object, style, hasFallback); | |
153 } | |
154 | |
155 RenderSVGResource* RenderSVGResource::strokePaintingResource(RenderObject* objec
t, const RenderStyle* style, bool& hasFallback) | |
156 { | |
157 return requestPaintingResource(ApplyToStrokeMode, object, style, hasFallback
); | |
158 } | |
159 | |
160 RenderSVGResourceSolidColor* RenderSVGResource::sharedSolidPaintingResource() | 150 RenderSVGResourceSolidColor* RenderSVGResource::sharedSolidPaintingResource() |
161 { | 151 { |
162 static RenderSVGResourceSolidColor* s_sharedSolidPaintingResource = 0; | 152 static RenderSVGResourceSolidColor* s_sharedSolidPaintingResource = 0; |
163 if (!s_sharedSolidPaintingResource) | 153 if (!s_sharedSolidPaintingResource) |
164 s_sharedSolidPaintingResource = new RenderSVGResourceSolidColor; | 154 s_sharedSolidPaintingResource = new RenderSVGResourceSolidColor; |
165 return s_sharedSolidPaintingResource; | 155 return s_sharedSolidPaintingResource; |
166 } | 156 } |
167 | 157 |
168 static inline void removeFromCacheAndInvalidateDependencies(RenderObject* object
, bool needsLayout) | 158 static inline void removeFromCacheAndInvalidateDependencies(RenderObject* object
, bool needsLayout) |
169 { | 159 { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 // This will process the rest of the ancestors. | 215 // This will process the rest of the ancestors. |
226 toRenderSVGResourceContainer(current)->removeAllClientsFromCache(); | 216 toRenderSVGResourceContainer(current)->removeAllClientsFromCache(); |
227 break; | 217 break; |
228 } | 218 } |
229 | 219 |
230 current = current->parent(); | 220 current = current->parent(); |
231 } | 221 } |
232 } | 222 } |
233 | 223 |
234 } | 224 } |
OLD | NEW |