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

Unified Diff: Source/core/html/imports/HTMLImportLoader.cpp

Issue 238923009: HTML Imports: No more BlockingDocumentCreation. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased to ToT. Created 6 years, 8 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/html/imports/HTMLImportLoader.h ('k') | Source/core/html/imports/HTMLImportState.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/imports/HTMLImportLoader.cpp
diff --git a/Source/core/html/imports/HTMLImportLoader.cpp b/Source/core/html/imports/HTMLImportLoader.cpp
index 0459452e604c909c3bf1c9a3a4df68c38fe18d24..7bf0a30622794c5a9973efe77303ca3b74ecd7dc 100644
--- a/Source/core/html/imports/HTMLImportLoader.cpp
+++ b/Source/core/html/imports/HTMLImportLoader.cpp
@@ -33,6 +33,7 @@
#include "core/dom/Document.h"
#include "core/dom/StyleEngine.h"
+#include "core/dom/custom/CustomElementMicrotaskQueue.h"
#include "core/html/HTMLDocument.h"
#include "core/html/imports/HTMLImportChild.h"
#include "core/html/imports/HTMLImportsController.h"
@@ -45,6 +46,7 @@ namespace WebCore {
HTMLImportLoader::HTMLImportLoader(HTMLImportsController* controller)
: m_controller(controller)
, m_state(StateLoading)
+ , m_microtaskQueue(CustomElementMicrotaskQueue::create())
{
}
@@ -180,12 +182,24 @@ void HTMLImportLoader::didFinishLoading()
ASSERT(!m_importedDocument || !m_importedDocument->parsing());
}
-void HTMLImportLoader::addImport(HTMLImportChild* client)
+void HTMLImportLoader::addImport(HTMLImportChild* import)
{
- ASSERT(kNotFound == m_imports.find(client));
- m_imports.append(client);
+ ASSERT(kNotFound == m_imports.find(import));
+
+ // Ensuring firstImport() manages all children that is loaded by the document.
+ //
+ // FIXME:
+ // This is a design flaw.
+ // Import children should be managed by HTMLImportLoader, not by HTMLImport.
+ if (!m_imports.isEmpty() && import->precedes(firstImport())) {
+ import->takeChildrenFrom(firstImport());
+ m_imports.insert(0, import);
+ } else {
+ m_imports.append(import);
+ }
+
if (isDone())
- client->didFinishLoading();
+ import->didFinishLoading();
}
void HTMLImportLoader::removeImport(HTMLImportChild* client)
@@ -194,4 +208,19 @@ void HTMLImportLoader::removeImport(HTMLImportChild* client)
m_imports.remove(m_imports.find(client));
}
+bool HTMLImportLoader::shouldBlockScriptExecution() const
+{
+ for (size_t i = 0; i < m_imports.size(); ++i) {
+ if (!m_imports[i]->state().shouldBlockScriptExecution())
+ return false;
+ }
+
+ return true;
+}
+
+PassRefPtr<CustomElementMicrotaskQueue> HTMLImportLoader::microtaskQueue() const
+{
+ return m_microtaskQueue;
+}
+
} // namespace WebCore
« no previous file with comments | « Source/core/html/imports/HTMLImportLoader.h ('k') | Source/core/html/imports/HTMLImportState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698