Index: Source/core/dom/Document.cpp |
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
index 0620531f3449e3f1339a7051bcd1b19214ebf09d..aa963040e045666856a984ffbd983b151c2749d9 100644 |
--- a/Source/core/dom/Document.cpp |
+++ b/Source/core/dom/Document.cpp |
@@ -123,6 +123,7 @@ |
#include "core/html/HTMLFrameOwnerElement.h" |
#include "core/html/HTMLHeadElement.h" |
#include "core/html/HTMLIFrameElement.h" |
+#include "core/html/HTMLImportsController.h" |
#include "core/html/HTMLLinkElement.h" |
#include "core/html/HTMLMapElement.h" |
#include "core/html/HTMLNameCollection.h" |
@@ -638,6 +639,7 @@ void Document::dispose() |
detachParser(); |
m_registry.clear(); |
+ m_imports.clear(); |
// removeDetachedChildren() doesn't always unregister IDs, |
// so tear down scope information upfront to avoid having stale references in the map. |
@@ -863,6 +865,23 @@ CustomElementRegistry* Document::ensureCustomElementRegistry() |
return m_registry.get(); |
} |
+HTMLImportsController* Document::ensureImports() |
+{ |
+ if (!m_imports) |
+ m_imports = HTMLImportsController::create(this); |
+ return m_imports.get(); |
+} |
+ |
+void Document::didLoadAllImports() |
+{ |
+ executeScriptsWaitingForResourcesIfNeeded(); |
+} |
+ |
+bool Document::haveImportsLoaded() const |
+{ |
+ return !m_imports || m_imports->haveLoaded(); |
+} |
+ |
PassRefPtr<DocumentFragment> Document::createDocumentFragment() |
{ |
return DocumentFragment::create(document()); |
@@ -2625,14 +2644,21 @@ void Document::didRemoveAllPendingStylesheet() |
m_needsNotifyRemoveAllPendingStylesheet = false; |
styleResolverChanged(RecalcStyleIfNeeded); |
- |
- if (ScriptableDocumentParser* parser = scriptableDocumentParser()) |
- parser->executeScriptsWaitingForStylesheets(); |
+ executeScriptsWaitingForResourcesIfNeeded(); |
if (m_gotoAnchorNeededAfterStylesheetsLoad && view()) |
view()->scrollToFragment(m_url); |
} |
+void Document::executeScriptsWaitingForResourcesIfNeeded() |
+{ |
+ if (!haveStylesheetsAndImportsLoaded()) |
+ return; |
+ if (ScriptableDocumentParser* parser = scriptableDocumentParser()) |
+ parser->executeScriptsWaitingForResources(); |
+} |
+ |
+ |
CSSStyleSheet* Document::elementSheet() |
{ |
if (!m_elemSheet) |