Make SVGUseElement respect & support externalResourcesRequired
[WebKit.git] / Source / WebCore / svg / SVGUseElement.h
old mode 100644 (file)
new mode 100755 (executable)
index 953b7e2..dd6533c
@@ -22,6 +22,7 @@
 #define SVGUseElement_h
 
 #if ENABLE(SVG)
+#include "CachedSVGDocument.h"
 #include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedLength.h"
 #include "SVGExternalResourcesRequired.h"
 
 namespace WebCore {
 
+class CachedSVGDocument;
 class SVGElementInstance;
 
 class SVGUseElement : public SVGStyledTransformableElement,
                       public SVGTests,
                       public SVGLangSpace,
                       public SVGExternalResourcesRequired,
-                      public SVGURIReference {
+                      public SVGURIReference,
+                      public CachedSVGDocumentClient {
 public:
-    static PassRefPtr<SVGUseElement> create(const QualifiedName&, Document*);
+    static PassRefPtr<SVGUseElement> create(const QualifiedName&, Document*, bool wasInsertedByParser);
+    virtual ~SVGUseElement();
 
     SVGElementInstance* instanceRoot();
     SVGElementInstance* animatedInstanceRoot() const;
@@ -50,7 +54,7 @@ public:
     RenderObject* rendererClipChild() const;
 
 private:
-    SVGUseElement(const QualifiedName&, Document*);
+    SVGUseElement(const QualifiedName&, Document*, bool wasInsertedByParser);
 
     virtual bool isValid() const { return SVGTests::isValid(); }
     virtual bool supportsFocus() const { return true; }
@@ -72,6 +76,9 @@ private:
     void buildShadowAndInstanceTree(SVGElement* target);
     void detachInstance();
 
+    virtual bool haveLoadedRequiredResources() { return SVGExternalResourcesRequired::haveLoadedRequiredResources(); }
+
+    virtual void finishParsingChildren();
     virtual bool selfHasRelativeLengths() const;
 
     // Instance tree handling
@@ -100,13 +107,27 @@ private:
         DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired)
     END_DECLARE_ANIMATED_PROPERTIES
 
+    bool cachedDocumentIsStillLoading();
+    Document* externalDocument() const;
+    bool instanceTreeIsLoading(SVGElementInstance*);
+    virtual void notifyFinished(CachedResource*);
+    Document* referencedDocument() const;
+
     // SVGTests
     virtual void synchronizeRequiredFeatures() { SVGTests::synchronizeRequiredFeatures(this); }
     virtual void synchronizeRequiredExtensions() { SVGTests::synchronizeRequiredExtensions(this); }
     virtual void synchronizeSystemLanguage() { SVGTests::synchronizeSystemLanguage(this); }
 
+    // SVGExternalResourcesRequired
+    virtual void setHaveFiredLoadEvent(bool haveFiredLoadEvent) { m_haveFiredLoadEvent = haveFiredLoadEvent; }
+    virtual bool isParserInserted() const { return m_wasInsertedByParser; }
+    virtual bool haveFiredLoadEvent() const { return m_haveFiredLoadEvent; }
+
+    bool m_wasInsertedByParser;
+    bool m_haveFiredLoadEvent;
     bool m_needsShadowTreeRecreation;
     RefPtr<SVGElementInstance> m_targetElementInstance;
+    CachedResourceHandle<CachedSVGDocument> m_cachedDocument;
 };
 
 }