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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 String target; | 144 String target; |
145 if (element->hasTagName(SVGNames::patternTag)) | 145 if (element->hasTagName(SVGNames::patternTag)) |
146 target = toSVGPatternElement(element)->hrefCurrentValue(); | 146 target = toSVGPatternElement(element)->hrefCurrentValue(); |
147 else if (element->hasTagName(SVGNames::linearGradientTag) || element->hasTag
Name(SVGNames::radialGradientTag)) | 147 else if (element->hasTagName(SVGNames::linearGradientTag) || element->hasTag
Name(SVGNames::radialGradientTag)) |
148 target = toSVGGradientElement(element)->hrefCurrentValue(); | 148 target = toSVGGradientElement(element)->hrefCurrentValue(); |
149 else if (element->hasTagName(SVGNames::filterTag)) | 149 else if (element->hasTagName(SVGNames::filterTag)) |
150 target = toSVGFilterElement(element)->hrefCurrentValue(); | 150 target = toSVGFilterElement(element)->hrefCurrentValue(); |
151 else | 151 else |
152 ASSERT_NOT_REACHED(); | 152 ASSERT_NOT_REACHED(); |
153 | 153 |
154 return SVGURIReference::fragmentIdentifierFromIRIString(target, &element->do
cument()); | 154 return SVGURIReference::fragmentIdentifierFromIRIString(target, element->doc
ument()); |
155 } | 155 } |
156 | 156 |
157 static inline RenderSVGResourceContainer* paintingResourceFromSVGPaint(Document*
document, const SVGPaint::SVGPaintType& paintType, const String& paintUri, Atom
icString& id, bool& hasPendingResource) | 157 static inline RenderSVGResourceContainer* paintingResourceFromSVGPaint(Document&
document, const SVGPaint::SVGPaintType& paintType, const String& paintUri, Atom
icString& id, bool& hasPendingResource) |
158 { | 158 { |
159 if (paintType != SVGPaint::SVG_PAINTTYPE_URI && paintType != SVGPaint::SVG_P
AINTTYPE_URI_RGBCOLOR) | 159 if (paintType != SVGPaint::SVG_PAINTTYPE_URI && paintType != SVGPaint::SVG_P
AINTTYPE_URI_RGBCOLOR) |
160 return 0; | 160 return 0; |
161 | 161 |
162 id = SVGURIReference::fragmentIdentifierFromIRIString(paintUri, document); | 162 id = SVGURIReference::fragmentIdentifierFromIRIString(paintUri, document); |
163 RenderSVGResourceContainer* container = getRenderSVGResourceContainerById(do
cument, id); | 163 RenderSVGResourceContainer* container = getRenderSVGResourceContainerById(do
cument, id); |
164 if (!container) { | 164 if (!container) { |
165 hasPendingResource = true; | 165 hasPendingResource = true; |
166 return 0; | 166 return 0; |
167 } | 167 } |
(...skipping 30 matching lines...) Expand all Loading... |
198 ASSERT(extensions); | 198 ASSERT(extensions); |
199 | 199 |
200 const AtomicString& tagName = element->localName(); | 200 const AtomicString& tagName = element->localName(); |
201 if (tagName.isNull()) | 201 if (tagName.isNull()) |
202 return false; | 202 return false; |
203 | 203 |
204 bool foundResources = false; | 204 bool foundResources = false; |
205 if (clipperFilterMaskerTags().contains(tagName)) { | 205 if (clipperFilterMaskerTags().contains(tagName)) { |
206 if (style->hasClipper()) { | 206 if (style->hasClipper()) { |
207 AtomicString id(style->clipperResource()); | 207 AtomicString id(style->clipperResource()); |
208 if (setClipper(getRenderSVGResourceById<RenderSVGResourceClipper>(&d
ocument, id))) | 208 if (setClipper(getRenderSVGResourceById<RenderSVGResourceClipper>(do
cument, id))) |
209 foundResources = true; | 209 foundResources = true; |
210 else | 210 else |
211 registerPendingResource(extensions, id, element); | 211 registerPendingResource(extensions, id, element); |
212 } | 212 } |
213 | 213 |
214 if (style->hasFilter()) { | 214 if (style->hasFilter()) { |
215 AtomicString id(style->filterResource()); | 215 AtomicString id(style->filterResource()); |
216 if (setFilter(getRenderSVGResourceById<RenderSVGResourceFilter>(&doc
ument, id))) | 216 if (setFilter(getRenderSVGResourceById<RenderSVGResourceFilter>(docu
ment, id))) |
217 foundResources = true; | 217 foundResources = true; |
218 else | 218 else |
219 registerPendingResource(extensions, id, element); | 219 registerPendingResource(extensions, id, element); |
220 } | 220 } |
221 | 221 |
222 if (style->hasMasker()) { | 222 if (style->hasMasker()) { |
223 AtomicString id(style->maskerResource()); | 223 AtomicString id(style->maskerResource()); |
224 if (setMasker(getRenderSVGResourceById<RenderSVGResourceMasker>(&doc
ument, id))) | 224 if (setMasker(getRenderSVGResourceById<RenderSVGResourceMasker>(docu
ment, id))) |
225 foundResources = true; | 225 foundResources = true; |
226 else | 226 else |
227 registerPendingResource(extensions, id, element); | 227 registerPendingResource(extensions, id, element); |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
231 if (markerTags().contains(tagName) && style->hasMarkers()) { | 231 if (markerTags().contains(tagName) && style->hasMarkers()) { |
232 AtomicString markerStartId(style->markerStartResource()); | 232 AtomicString markerStartId(style->markerStartResource()); |
233 if (setMarkerStart(getRenderSVGResourceById<RenderSVGResourceMarker>(&do
cument, markerStartId))) | 233 if (setMarkerStart(getRenderSVGResourceById<RenderSVGResourceMarker>(doc
ument, markerStartId))) |
234 foundResources = true; | 234 foundResources = true; |
235 else | 235 else |
236 registerPendingResource(extensions, markerStartId, element); | 236 registerPendingResource(extensions, markerStartId, element); |
237 | 237 |
238 AtomicString markerMidId(style->markerMidResource()); | 238 AtomicString markerMidId(style->markerMidResource()); |
239 if (setMarkerMid(getRenderSVGResourceById<RenderSVGResourceMarker>(&docu
ment, markerMidId))) | 239 if (setMarkerMid(getRenderSVGResourceById<RenderSVGResourceMarker>(docum
ent, markerMidId))) |
240 foundResources = true; | 240 foundResources = true; |
241 else | 241 else |
242 registerPendingResource(extensions, markerMidId, element); | 242 registerPendingResource(extensions, markerMidId, element); |
243 | 243 |
244 AtomicString markerEndId(style->markerEndResource()); | 244 AtomicString markerEndId(style->markerEndResource()); |
245 if (setMarkerEnd(getRenderSVGResourceById<RenderSVGResourceMarker>(&docu
ment, markerEndId))) | 245 if (setMarkerEnd(getRenderSVGResourceById<RenderSVGResourceMarker>(docum
ent, markerEndId))) |
246 foundResources = true; | 246 foundResources = true; |
247 else | 247 else |
248 registerPendingResource(extensions, markerEndId, element); | 248 registerPendingResource(extensions, markerEndId, element); |
249 } | 249 } |
250 | 250 |
251 if (fillAndStrokeTags().contains(tagName)) { | 251 if (fillAndStrokeTags().contains(tagName)) { |
252 if (style->hasFill()) { | 252 if (style->hasFill()) { |
253 bool hasPendingResource = false; | 253 bool hasPendingResource = false; |
254 AtomicString id; | 254 AtomicString id; |
255 if (setFill(paintingResourceFromSVGPaint(&document, style->fillPaint
Type(), style->fillPaintUri(), id, hasPendingResource))) | 255 if (setFill(paintingResourceFromSVGPaint(document, style->fillPaintT
ype(), style->fillPaintUri(), id, hasPendingResource))) |
256 foundResources = true; | 256 foundResources = true; |
257 else if (hasPendingResource) | 257 else if (hasPendingResource) |
258 registerPendingResource(extensions, id, element); | 258 registerPendingResource(extensions, id, element); |
259 } | 259 } |
260 | 260 |
261 if (style->hasStroke()) { | 261 if (style->hasStroke()) { |
262 bool hasPendingResource = false; | 262 bool hasPendingResource = false; |
263 AtomicString id; | 263 AtomicString id; |
264 if (setStroke(paintingResourceFromSVGPaint(&document, style->strokeP
aintType(), style->strokePaintUri(), id, hasPendingResource))) | 264 if (setStroke(paintingResourceFromSVGPaint(document, style->strokePa
intType(), style->strokePaintUri(), id, hasPendingResource))) |
265 foundResources = true; | 265 foundResources = true; |
266 else if (hasPendingResource) | 266 else if (hasPendingResource) |
267 registerPendingResource(extensions, id, element); | 267 registerPendingResource(extensions, id, element); |
268 } | 268 } |
269 } | 269 } |
270 | 270 |
271 if (chainableResourceTags().contains(tagName)) { | 271 if (chainableResourceTags().contains(tagName)) { |
272 AtomicString id(targetReferenceFromResource(element)); | 272 AtomicString id(targetReferenceFromResource(element)); |
273 if (setLinkedResource(getRenderSVGResourceContainerById(&document, id))) | 273 if (setLinkedResource(getRenderSVGResourceContainerById(document, id))) |
274 foundResources = true; | 274 foundResources = true; |
275 else | 275 else |
276 registerPendingResource(extensions, id, element); | 276 registerPendingResource(extensions, id, element); |
277 } | 277 } |
278 | 278 |
279 return foundResources; | 279 return foundResources; |
280 } | 280 } |
281 | 281 |
282 void SVGResources::removeClientFromCache(RenderObject* object, bool markForInval
idation) const | 282 void SVGResources::removeClientFromCache(RenderObject* object, bool markForInval
idation) const |
283 { | 283 { |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 if (RenderSVGResourceContainer* stroke = m_fillStrokeData->stroke) | 654 if (RenderSVGResourceContainer* stroke = m_fillStrokeData->stroke) |
655 fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke->
node()); | 655 fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke->
node()); |
656 } | 656 } |
657 | 657 |
658 if (m_linkedResource) | 658 if (m_linkedResource) |
659 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_
linkedResource->node()); | 659 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_
linkedResource->node()); |
660 } | 660 } |
661 #endif | 661 #endif |
662 | 662 |
663 } | 663 } |
OLD | NEW |