Index: Source/WebCore/svg/SVGUseElement.cpp |
=================================================================== |
--- Source/WebCore/svg/SVGUseElement.cpp (revision 137693) |
+++ Source/WebCore/svg/SVGUseElement.cpp (working copy) |
@@ -107,8 +107,7 @@ |
SVGUseElement::~SVGUseElement() |
{ |
- if (m_cachedDocument) |
- m_cachedDocument->removeClient(this); |
+ setCachedDocument(0); |
clearResourceReferences(); |
} |
@@ -256,18 +255,14 @@ |
KURL url = document()->completeURL(href()); |
if (url.hasFragmentIdentifier()) { |
CachedResourceRequest request(ResourceRequest(url.string())); |
- m_cachedDocument = document()->cachedResourceLoader()->requestSVGDocument(request); |
- if (m_cachedDocument) |
- m_cachedDocument->addClient(this); |
+ setCachedDocument(document()->cachedResourceLoader()->requestSVGDocument(request)); |
} |
- } |
+ } else |
+ setCachedDocument(0); |
- if (m_cachedDocument && !isExternalReference) { |
- m_cachedDocument->removeClient(this); |
- m_cachedDocument = 0; |
- } |
if (!m_wasInsertedByParser) |
buildPendingResource(); |
+ |
return; |
} |
@@ -991,6 +986,19 @@ |
} |
} |
+void SVGUseElement::setCachedDocument(CachedResourceHandle<CachedSVGDocument> cachedDocument) |
+{ |
+ if (m_cachedDocument == cachedDocument) |
+ return; |
+ |
+ if (m_cachedDocument) |
+ m_cachedDocument->removeClient(this); |
+ |
+ m_cachedDocument = cachedDocument; |
+ if (m_cachedDocument) |
+ m_cachedDocument->addClient(this); |
} |
+} |
+ |
#endif // ENABLE(SVG) |