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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 #if ENABLE(FILTERS) | 145 #if ENABLE(FILTERS) |
146 else if (element->hasTagName(SVGNames::filterTag)) | 146 else if (element->hasTagName(SVGNames::filterTag)) |
147 target = static_cast<SVGFilterElement*>(element)->href(); | 147 target = static_cast<SVGFilterElement*>(element)->href(); |
148 #endif | 148 #endif |
149 else | 149 else |
150 ASSERT_NOT_REACHED(); | 150 ASSERT_NOT_REACHED(); |
151 | 151 |
152 return SVGURIReference::getTarget(target); | 152 return SVGURIReference::getTarget(target); |
153 } | 153 } |
154 | 154 |
155 static inline RenderSVGResourceContainer* paintingResourceFromSVGPaint(Document*
document, const SVGPaint::SVGPaintType& paintType, const String& paintUri, Atom
icString& id, bool& hasPendingResource) | 155 static inline RenderSVGResourceContainer* paintingResourceFromSVGPaint(Document*
document, SVGPaint* paint, AtomicString& id, bool& hasPendingResource) |
156 { | 156 { |
| 157 ASSERT(paint); |
| 158 |
| 159 SVGPaint::SVGPaintType paintType = paint->paintType(); |
157 if (paintType != SVGPaint::SVG_PAINTTYPE_URI && paintType != SVGPaint::SVG_P
AINTTYPE_URI_RGBCOLOR) | 160 if (paintType != SVGPaint::SVG_PAINTTYPE_URI && paintType != SVGPaint::SVG_P
AINTTYPE_URI_RGBCOLOR) |
158 return 0; | 161 return 0; |
159 | 162 |
160 id = SVGURIReference::getTarget(paintUri); | 163 id = SVGURIReference::getTarget(paint->uri()); |
161 RenderSVGResourceContainer* container = getRenderSVGResourceContainerById(do
cument, id); | 164 RenderSVGResourceContainer* container = getRenderSVGResourceContainerById(do
cument, id); |
162 if (!container) { | 165 if (!container) { |
163 hasPendingResource = true; | 166 hasPendingResource = true; |
164 return 0; | 167 return 0; |
165 } | 168 } |
166 | 169 |
167 RenderSVGResourceType resourceType = container->resourceType(); | 170 RenderSVGResourceType resourceType = container->resourceType(); |
168 if (resourceType != PatternResourceType && resourceType != LinearGradientRes
ourceType && resourceType != RadialGradientResourceType) | 171 if (resourceType != PatternResourceType && resourceType != LinearGradientRes
ourceType && resourceType != RadialGradientResourceType) |
169 return 0; | 172 return 0; |
170 | 173 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 if (setMarkerEnd(getRenderSVGResourceById<RenderSVGResourceMarker>(docum
ent, markerEndId))) | 252 if (setMarkerEnd(getRenderSVGResourceById<RenderSVGResourceMarker>(docum
ent, markerEndId))) |
250 foundResources = true; | 253 foundResources = true; |
251 else | 254 else |
252 registerPendingResource(extensions, markerEndId, element); | 255 registerPendingResource(extensions, markerEndId, element); |
253 } | 256 } |
254 | 257 |
255 if (fillAndStrokeTags().contains(tagNameImpl)) { | 258 if (fillAndStrokeTags().contains(tagNameImpl)) { |
256 if (style->hasFill()) { | 259 if (style->hasFill()) { |
257 bool hasPendingResource = false; | 260 bool hasPendingResource = false; |
258 AtomicString id; | 261 AtomicString id; |
259 if (setFill(paintingResourceFromSVGPaint(document, style->fillPaintT
ype(), style->fillPaintUri(), id, hasPendingResource))) | 262 if (setFill(paintingResourceFromSVGPaint(document, style->fillPaint(
), id, hasPendingResource))) |
260 foundResources = true; | 263 foundResources = true; |
261 else if (hasPendingResource) | 264 else if (hasPendingResource) |
262 registerPendingResource(extensions, id, element); | 265 registerPendingResource(extensions, id, element); |
263 } | 266 } |
264 | 267 |
265 if (style->hasStroke()) { | 268 if (style->hasStroke()) { |
266 bool hasPendingResource = false; | 269 bool hasPendingResource = false; |
267 AtomicString id; | 270 AtomicString id; |
268 if (setStroke(paintingResourceFromSVGPaint(document, style->strokePa
intType(), style->strokePaintUri(), id, hasPendingResource))) | 271 if (setStroke(paintingResourceFromSVGPaint(document, style->strokePa
int(), id, hasPendingResource))) |
269 foundResources = true; | 272 foundResources = true; |
270 else if (hasPendingResource) | 273 else if (hasPendingResource) |
271 registerPendingResource(extensions, id, element); | 274 registerPendingResource(extensions, id, element); |
272 } | 275 } |
273 } | 276 } |
274 | 277 |
275 if (chainableResourceTags().contains(tagNameImpl)) { | 278 if (chainableResourceTags().contains(tagNameImpl)) { |
276 AtomicString id(targetReferenceFromResource(element)); | 279 AtomicString id(targetReferenceFromResource(element)); |
277 if (setLinkedResource(getRenderSVGResourceContainerById(document, id))) | 280 if (setLinkedResource(getRenderSVGResourceContainerById(document, id))) |
278 foundResources = true; | 281 foundResources = true; |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 } | 675 } |
673 | 676 |
674 if (m_linkedResource) | 677 if (m_linkedResource) |
675 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_
linkedResource->node()); | 678 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_
linkedResource->node()); |
676 } | 679 } |
677 #endif | 680 #endif |
678 | 681 |
679 } | 682 } |
680 | 683 |
681 #endif | 684 #endif |
OLD | NEW |