OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde
.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
6 * Copyright (C) 2012 University of Szeged | 6 * Copyright (C) 2012 University of Szeged |
7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> | 7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> |
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 PassRefPtr<SVGUseElement> SVGUseElement::create(const QualifiedName& tagName, Do
cument* document, bool wasInsertedByParser) | 100 PassRefPtr<SVGUseElement> SVGUseElement::create(const QualifiedName& tagName, Do
cument* document, bool wasInsertedByParser) |
101 { | 101 { |
102 // Always build a #shadow-root for SVGUseElement. | 102 // Always build a #shadow-root for SVGUseElement. |
103 RefPtr<SVGUseElement> use = adoptRef(new SVGUseElement(tagName, document, wa
sInsertedByParser)); | 103 RefPtr<SVGUseElement> use = adoptRef(new SVGUseElement(tagName, document, wa
sInsertedByParser)); |
104 use->createShadowSubtree(); | 104 use->createShadowSubtree(); |
105 return use.release(); | 105 return use.release(); |
106 } | 106 } |
107 | 107 |
108 SVGUseElement::~SVGUseElement() | 108 SVGUseElement::~SVGUseElement() |
109 { | 109 { |
110 if (m_cachedDocument) | 110 setCachedDocument(0); |
111 m_cachedDocument->removeClient(this); | |
112 | 111 |
113 clearResourceReferences(); | 112 clearResourceReferences(); |
114 } | 113 } |
115 | 114 |
116 void SVGUseElement::createShadowSubtree() | 115 void SVGUseElement::createShadowSubtree() |
117 { | 116 { |
118 ASSERT(!shadow()); | 117 ASSERT(!shadow()); |
119 ShadowRoot::create(this, ShadowRoot::UserAgentShadowRoot); | 118 ShadowRoot::create(this, ShadowRoot::UserAgentShadowRoot); |
120 } | 119 } |
121 | 120 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 248 |
250 if (SVGExternalResourcesRequired::handleAttributeChange(this, attrName)) | 249 if (SVGExternalResourcesRequired::handleAttributeChange(this, attrName)) |
251 return; | 250 return; |
252 | 251 |
253 if (SVGURIReference::isKnownAttribute(attrName)) { | 252 if (SVGURIReference::isKnownAttribute(attrName)) { |
254 bool isExternalReference = isExternalURIReference(href(), document()); | 253 bool isExternalReference = isExternalURIReference(href(), document()); |
255 if (isExternalReference) { | 254 if (isExternalReference) { |
256 KURL url = document()->completeURL(href()); | 255 KURL url = document()->completeURL(href()); |
257 if (url.hasFragmentIdentifier()) { | 256 if (url.hasFragmentIdentifier()) { |
258 CachedResourceRequest request(ResourceRequest(url.string())); | 257 CachedResourceRequest request(ResourceRequest(url.string())); |
259 m_cachedDocument = document()->cachedResourceLoader()->requestSV
GDocument(request); | 258 setCachedDocument(document()->cachedResourceLoader()->requestSVG
Document(request)); |
260 if (m_cachedDocument) | |
261 m_cachedDocument->addClient(this); | |
262 } | 259 } |
263 } | 260 } else |
| 261 setCachedDocument(0); |
264 | 262 |
265 if (m_cachedDocument && !isExternalReference) { | |
266 m_cachedDocument->removeClient(this); | |
267 m_cachedDocument = 0; | |
268 } | |
269 if (!m_wasInsertedByParser) | 263 if (!m_wasInsertedByParser) |
270 buildPendingResource(); | 264 buildPendingResource(); |
| 265 |
271 return; | 266 return; |
272 } | 267 } |
273 | 268 |
274 if (!renderer) | 269 if (!renderer) |
275 return; | 270 return; |
276 | 271 |
277 if (SVGLangSpace::isKnownAttribute(attrName) | 272 if (SVGLangSpace::isKnownAttribute(attrName) |
278 || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { | 273 || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { |
279 invalidateShadowTree(); | 274 invalidateShadowTree(); |
280 return; | 275 return; |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 void SVGUseElement::finishParsingChildren() | 979 void SVGUseElement::finishParsingChildren() |
985 { | 980 { |
986 SVGStyledTransformableElement::finishParsingChildren(); | 981 SVGStyledTransformableElement::finishParsingChildren(); |
987 SVGExternalResourcesRequired::finishParsingChildren(); | 982 SVGExternalResourcesRequired::finishParsingChildren(); |
988 if (m_wasInsertedByParser) { | 983 if (m_wasInsertedByParser) { |
989 buildPendingResource(); | 984 buildPendingResource(); |
990 m_wasInsertedByParser = false; | 985 m_wasInsertedByParser = false; |
991 } | 986 } |
992 } | 987 } |
993 | 988 |
| 989 void SVGUseElement::setCachedDocument(CachedResourceHandle<CachedSVGDocument> ca
chedDocument) |
| 990 { |
| 991 if (m_cachedDocument == cachedDocument) |
| 992 return; |
| 993 |
| 994 if (m_cachedDocument) |
| 995 m_cachedDocument->removeClient(this); |
| 996 |
| 997 m_cachedDocument = cachedDocument; |
| 998 if (m_cachedDocument) |
| 999 m_cachedDocument->addClient(this); |
| 1000 } |
| 1001 |
994 } | 1002 } |
995 | 1003 |
996 #endif // ENABLE(SVG) | 1004 #endif // ENABLE(SVG) |
OLD | NEW |