Chromium Code Reviews| Index: Source/core/dom/Document.cpp |
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
| index 0620531f3449e3f1339a7051bcd1b19214ebf09d..26a70071dc2da3469fad2fc2bc2e7b9fc1dd4dfb 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,33 @@ CustomElementRegistry* Document::ensureCustomElementRegistry() |
| return m_registry.get(); |
| } |
| +HTMLImports* Document::imports() |
|
dglazkov
2013/05/28 17:12:47
Don't we usually use ensure* pattern for RIIA acce
Hajime Morrita
2013/05/29 01:36:00
Done.
|
| +{ |
| + if (!m_imports) |
| + m_imports = HTMLImports::create(this); |
| + return m_imports.get(); |
| +} |
| + |
| +void Document::didLoadAllImports() |
| +{ |
| + executeScriptsWaitingForResourcesIfNeeded(); |
| +} |
| + |
| +SecurityContext* Document::importsContext() OVERRIDE |
| +{ |
| + return this; |
| +} |
| + |
| +void Document::showSecurityErrorMessage(const String& message) OVERRIDE |
| +{ |
| + addConsoleMessage(JSMessageSource, ErrorMessageLevel, message); |
| +} |
| + |
| +bool Document::haveImportsLoaded() const |
| +{ |
| + return !m_imports || m_imports->haveLoaded(); |
| +} |
| + |
| PassRefPtr<DocumentFragment> Document::createDocumentFragment() |
| { |
| return DocumentFragment::create(document()); |
| @@ -2625,14 +2654,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()) |
|
dglazkov
2013/05/28 17:12:47
Why is this check here now, but not in the old cod
|
| + return; |
| + if (ScriptableDocumentParser* parser = scriptableDocumentParser()) |
| + parser->executeScriptsWaitingForResources(); |
| +} |
| + |
| + |
| CSSStyleSheet* Document::elementSheet() |
| { |
| if (!m_elemSheet) |