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

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

Issue 274213003: HTML Imports: Make sure new imports being added to the "first child" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Ready to review Created 6 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/html/imports/HTMLImportChild.h ('k') | Source/core/html/imports/HTMLImportLoader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/imports/HTMLImportChild.cpp
diff --git a/Source/core/html/imports/HTMLImportChild.cpp b/Source/core/html/imports/HTMLImportChild.cpp
index 7a02c587ea69dc086d1162e12dfcf5a687594ae4..d4d6edd3040bb006bd5130710d8c0ce8534ad2a1 100644
--- a/Source/core/html/imports/HTMLImportChild.cpp
+++ b/Source/core/html/imports/HTMLImportChild.cpp
@@ -214,12 +214,29 @@ HTMLLinkElement* HTMLImportChild::link() const
return m_client->link();
}
+// Ensuring following invariants against the import tree:
+// - HTMLImportChild::firstImport() is the "first import" of the DFS order of the import tree.
+// - The "first import" manages all the children that is loaded by the document.
+void HTMLImportChild::normalize()
dglazkov 2014/05/12 17:32:37 I apologize, I am trying to (re)learn how this wor
+{
+ if (!loader()->isFirstImport(this) && this->precedes(loader()->firstImport())) {
+ HTMLImportChild* oldFirst = loader()->firstImport();
+ loader()->moveToFirst(this);
+ takeChildrenFrom(oldFirst);
+ }
+
+ for (HTMLImport* child = firstChild(); child; child = child->next())
+ toHTMLImportChild(child)->normalize();
+}
+
#if !defined(NDEBUG)
void HTMLImportChild::showThis()
{
+ bool isFirst = loader() ? loader()->isFirstImport(this) : false;
HTMLImport::showThis();
- fprintf(stderr, " loader=%p step=%p sync=%s url=%s",
+ fprintf(stderr, " loader=%p first=%d, step=%p sync=%s url=%s",
m_loader,
+ isFirst,
m_customElementMicrotaskStep.get(),
isSync() ? "Y" : "N",
url().string().utf8().data());
« no previous file with comments | « Source/core/html/imports/HTMLImportChild.h ('k') | Source/core/html/imports/HTMLImportLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698