Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(646)

Unified Diff: Source/core/dom/Document.cpp

Issue 15856002: First step of HTMLImports (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed Mac build Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/ScriptElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/ScriptElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698