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

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

Issue 297863004: Merge 174141 "HTML Imports: Take care of cycles according to the..." (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/1985/
Patch Set: 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
===================================================================
--- Source/core/html/imports/HTMLImportChild.cpp (revision 174593)
+++ Source/core/html/imports/HTMLImportChild.cpp (working copy)
@@ -114,6 +114,11 @@
return m_loader && m_loader->isDone();
}
+bool HTMLImportChild::isFirst() const
+{
+ return m_loader && m_loader->isFirstImport(this);
+}
+
Document* HTMLImportChild::importedDocument() const
{
if (!m_loader)
@@ -150,6 +155,28 @@
didFinish();
}
+void HTMLImportChild::createCustomElementMicrotaskStepIfNeeded()
+{
+ // HTMLImportChild::normalize(), which is called from HTMLImportLoader::addImport(),
+ // can move import children to new parents. So their microtask steps should be updated as well,
+ // to let the steps be in the new parent queues.This method handles such migration.
+ // For implementation simplicity, outdated step objects that are owned by moved children
+ // aren't removed from the (now wrong) queues. Instead, each step invalidates its content so that
+ // it is removed from the wrong queue during the next traversal. See parentWasChanged() for the detail.
+
+ if (m_customElementMicrotaskStep) {
+ m_customElementMicrotaskStep->parentWasChanged();
+ m_customElementMicrotaskStep.clear();
+ }
+
+ if (!isDone() && !formsCycle()) {
+ m_customElementMicrotaskStep = CustomElement::didCreateImport(this)->weakPtr();
+ }
+
+ for (HTMLImport* child = firstChild(); child; child = child->next())
+ toHTMLImportChild(child)->createCustomElementMicrotaskStepIfNeeded();
+}
+
void HTMLImportChild::ensureLoader()
{
if (m_loader)
@@ -160,10 +187,7 @@
else
createLoader();
- if (!isDone() && !formsCycle()) {
- ASSERT(!m_customElementMicrotaskStep);
- m_customElementMicrotaskStep = CustomElement::didCreateImport(this)->weakPtr();
- }
+ createCustomElementMicrotaskStepIfNeeded();
}
void HTMLImportChild::createLoader()
« 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