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

Unified Diff: Source/core/html/imports/HTMLImportLoader.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
Index: Source/core/html/imports/HTMLImportLoader.cpp
diff --git a/Source/core/html/imports/HTMLImportLoader.cpp b/Source/core/html/imports/HTMLImportLoader.cpp
index 7bf0a30622794c5a9973efe77303ca3b74ecd7dc..155e0964cb527b0886b126c9f7058c84ccf831c1 100644
--- a/Source/core/html/imports/HTMLImportLoader.cpp
+++ b/Source/core/html/imports/HTMLImportLoader.cpp
@@ -182,22 +182,20 @@ void HTMLImportLoader::didFinishLoading()
ASSERT(!m_importedDocument || !m_importedDocument->parsing());
}
+void HTMLImportLoader::moveToFirst(HTMLImportChild* import)
+{
+ size_t position = m_imports.find(import);
+ ASSERT(kNotFound != position);
+ m_imports.remove(position);
+ m_imports.insert(0, import);
+}
+
void HTMLImportLoader::addImport(HTMLImportChild* import)
{
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);
- }
-
+ m_imports.append(import);
+ import->normalize();
if (isDone())
import->didFinishLoading();
}

Powered by Google App Engine
This is Rietveld 408576698