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

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

Issue 15856002: First step of HTMLImports (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index 2ea7ef9c78da0a9fa21faf7cd70009af0972b3a5..5b50323e7bda0e0d60ebf8d6fc7ab8cdaa37d966 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/HTMLImports.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,28 @@ CustomElementRegistry* Document::ensureCustomElementRegistry()
return m_registry.get();
}
+HTMLImports* Document::imports()
+{
+ if (!m_imports)
+ m_imports = HTMLImports::create(this);
+ return m_imports.get();
+}
+
+void Document::didLoadAllImports()
+{
+ executeScriptsWaitingForResourcesIfNeeded();
+}
+
+SecurityContext* Document::importsContext() OVERRIDE
+{
+ return this;
+}
+
+bool Document::haveImportsLoaded() const
+{
+ return !m_imports || m_imports->haveLoaded();
+}
+
PassRefPtr<DocumentFragment> Document::createDocumentFragment()
{
return DocumentFragment::create(document());
@@ -2625,14 +2649,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)

Powered by Google App Engine
This is Rietveld 408576698