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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 if (s_tagList.isEmpty()) { | 130 if (s_tagList.isEmpty()) { |
131 s_tagList.add(SVGNames::linearGradientTag.localName()); | 131 s_tagList.add(SVGNames::linearGradientTag.localName()); |
132 s_tagList.add(SVGNames::filterTag.localName()); | 132 s_tagList.add(SVGNames::filterTag.localName()); |
133 s_tagList.add(SVGNames::patternTag.localName()); | 133 s_tagList.add(SVGNames::patternTag.localName()); |
134 s_tagList.add(SVGNames::radialGradientTag.localName()); | 134 s_tagList.add(SVGNames::radialGradientTag.localName()); |
135 } | 135 } |
136 | 136 |
137 return s_tagList; | 137 return s_tagList; |
138 } | 138 } |
139 | 139 |
140 static inline String targetReferenceFromResource(SVGElement* element) | 140 static inline AtomicString targetReferenceFromResource(SVGElement* element) |
141 { | 141 { |
142 String target; | 142 String target; |
143 if (element->hasTagName(SVGNames::patternTag)) | 143 if (element->hasTagName(SVGNames::patternTag)) |
144 target = toSVGPatternElement(element)->hrefCurrentValue(); | 144 target = toSVGPatternElement(element)->hrefCurrentValue(); |
145 else if (element->hasTagName(SVGNames::linearGradientTag) || element->hasTag
Name(SVGNames::radialGradientTag)) | 145 else if (element->hasTagName(SVGNames::linearGradientTag) || element->hasTag
Name(SVGNames::radialGradientTag)) |
146 target = toSVGGradientElement(element)->hrefCurrentValue(); | 146 target = toSVGGradientElement(element)->hrefCurrentValue(); |
147 else if (element->hasTagName(SVGNames::filterTag)) | 147 else if (element->hasTagName(SVGNames::filterTag)) |
148 target = toSVGFilterElement(element)->hrefCurrentValue(); | 148 target = toSVGFilterElement(element)->hrefCurrentValue(); |
149 else | 149 else |
150 ASSERT_NOT_REACHED(); | 150 ASSERT_NOT_REACHED(); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 SVGDocumentExtensions* extensions = document.accessSVGExtensions(); | 226 SVGDocumentExtensions* extensions = document.accessSVGExtensions(); |
227 ASSERT(extensions); | 227 ASSERT(extensions); |
228 | 228 |
229 const AtomicString& tagName = element->localName(); | 229 const AtomicString& tagName = element->localName(); |
230 if (tagName.isNull()) | 230 if (tagName.isNull()) |
231 return nullptr; | 231 return nullptr; |
232 | 232 |
233 OwnPtr<SVGResources> resources; | 233 OwnPtr<SVGResources> resources; |
234 if (clipperFilterMaskerTags().contains(tagName)) { | 234 if (clipperFilterMaskerTags().contains(tagName)) { |
235 if (style->hasClipper()) { | 235 if (style->hasClipper()) { |
236 AtomicString id(style->clipperResource()); | 236 AtomicString id = style->clipperResource(); |
237 if (!ensureResources(resources)->setClipper(getRenderSVGResourceById
<RenderSVGResourceClipper>(document, id))) | 237 if (!ensureResources(resources)->setClipper(getRenderSVGResourceById
<RenderSVGResourceClipper>(document, id))) |
238 registerPendingResource(extensions, id, element); | 238 registerPendingResource(extensions, id, element); |
239 } | 239 } |
240 | 240 |
241 if (style->hasFilter()) { | 241 if (style->hasFilter()) { |
242 AtomicString id(style->filterResource()); | 242 AtomicString id = style->filterResource(); |
243 if (!ensureResources(resources)->setFilter(getRenderSVGResourceById<
RenderSVGResourceFilter>(document, id))) | 243 if (!ensureResources(resources)->setFilter(getRenderSVGResourceById<
RenderSVGResourceFilter>(document, id))) |
244 registerPendingResource(extensions, id, element); | 244 registerPendingResource(extensions, id, element); |
245 } | 245 } |
246 | 246 |
247 if (style->hasMasker()) { | 247 if (style->hasMasker()) { |
248 AtomicString id(style->maskerResource()); | 248 AtomicString id = style->maskerResource(); |
249 if (!ensureResources(resources)->setMasker(getRenderSVGResourceById<
RenderSVGResourceMasker>(document, id))) | 249 if (!ensureResources(resources)->setMasker(getRenderSVGResourceById<
RenderSVGResourceMasker>(document, id))) |
250 registerPendingResource(extensions, id, element); | 250 registerPendingResource(extensions, id, element); |
251 } | 251 } |
252 } | 252 } |
253 | 253 |
254 if (markerTags().contains(tagName) && style->hasMarkers()) { | 254 if (markerTags().contains(tagName) && style->hasMarkers()) { |
255 AtomicString markerStartId(style->markerStartResource()); | 255 AtomicString markerStartId(style->markerStartResource()); |
256 if (!ensureResources(resources)->setMarkerStart(getRenderSVGResourceById
<RenderSVGResourceMarker>(document, markerStartId))) | 256 if (!ensureResources(resources)->setMarkerStart(getRenderSVGResourceById
<RenderSVGResourceMarker>(document, markerStartId))) |
257 registerPendingResource(extensions, markerStartId, element); | 257 registerPendingResource(extensions, markerStartId, element); |
258 | 258 |
(...skipping 20 matching lines...) Expand all Loading... |
279 bool hasPendingResource = false; | 279 bool hasPendingResource = false; |
280 AtomicString id; | 280 AtomicString id; |
281 RenderSVGResourceContainer* resource = paintingResourceFromSVGPaint(
document, style->strokePaintType(), style->strokePaintUri(), id, hasPendingResou
rce); | 281 RenderSVGResourceContainer* resource = paintingResourceFromSVGPaint(
document, style->strokePaintType(), style->strokePaintUri(), id, hasPendingResou
rce); |
282 if (!ensureResources(resources)->setStroke(resource) && hasPendingRe
source) { | 282 if (!ensureResources(resources)->setStroke(resource) && hasPendingRe
source) { |
283 registerPendingResource(extensions, id, element); | 283 registerPendingResource(extensions, id, element); |
284 } | 284 } |
285 } | 285 } |
286 } | 286 } |
287 | 287 |
288 if (chainableResourceTags().contains(tagName)) { | 288 if (chainableResourceTags().contains(tagName)) { |
289 AtomicString id(targetReferenceFromResource(element)); | 289 AtomicString id = targetReferenceFromResource(element); |
290 if (!ensureResources(resources)->setLinkedResource(getRenderSVGResourceC
ontainerById(document, id))) | 290 if (!ensureResources(resources)->setLinkedResource(getRenderSVGResourceC
ontainerById(document, id))) |
291 registerPendingResource(extensions, id, element); | 291 registerPendingResource(extensions, id, element); |
292 } | 292 } |
293 | 293 |
294 return (!resources || resources->hasResourceData()) ? nullptr : resources.re
lease(); | 294 return (!resources || resources->hasResourceData()) ? nullptr : resources.re
lease(); |
295 } | 295 } |
296 | 296 |
297 void SVGResources::layoutIfNeeded() | 297 void SVGResources::layoutIfNeeded() |
298 { | 298 { |
299 if (m_clipperFilterMaskerData) { | 299 if (m_clipperFilterMaskerData) { |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 if (RenderSVGResourceContainer* stroke = m_fillStrokeData->stroke) | 700 if (RenderSVGResourceContainer* stroke = m_fillStrokeData->stroke) |
701 fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke->
element()); | 701 fprintf(stderr, " |-> Stroke : %p (node=%p)\n", stroke, stroke->
element()); |
702 } | 702 } |
703 | 703 |
704 if (m_linkedResource) | 704 if (m_linkedResource) |
705 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_
linkedResource->element()); | 705 fprintf(stderr, " |-> xlink:href : %p (node=%p)\n", m_linkedResource, m_
linkedResource->element()); |
706 } | 706 } |
707 #endif | 707 #endif |
708 | 708 |
709 } | 709 } |
OLD | NEW |