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

Unified Diff: Source/core/html/parser/HTMLTreeBuilder.cpp

Issue 14759017: callTheAdoptionAgency should work asynchronously (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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/parser/HTMLTreeBuilder.cpp
diff --git a/Source/core/html/parser/HTMLTreeBuilder.cpp b/Source/core/html/parser/HTMLTreeBuilder.cpp
index 48dc4912d6a0dc2222b566f2e3293b9035b5692f..d1f237c09da0a72fe09ef170ba6acac7d4f55a2b 100644
--- a/Source/core/html/parser/HTMLTreeBuilder.cpp
+++ b/Source/core/html/parser/HTMLTreeBuilder.cpp
@@ -1571,36 +1571,13 @@ void HTMLTreeBuilder::callTheAdoptionAgency(AtomicHTMLToken* token)
lastNode = node;
}
// 10.
- if (ContainerNode* parent = lastNode->element()->parentNode())
- parent->parserRemoveChild(lastNode->element());
- if (commonAncestor->causesFosterParenting())
- m_tree.fosterParent(lastNode->element());
- else {
- if (commonAncestor->hasTagName(templateTag))
- toHTMLTemplateElement(commonAncestor->node())->content()->parserAppendChild(lastNode->element());
- else
- commonAncestor->node()->parserAppendChild(lastNode->element());
- ASSERT(lastNode->stackItem()->isElementNode());
- ASSERT(lastNode->element()->parentNode());
- if (lastNode->element()->parentNode()->attached() && !lastNode->element()->attached())
- lastNode->element()->lazyAttach();
- }
+ m_tree.insertAgain(commonAncestor.get(), lastNode);
// 11.
RefPtr<HTMLStackItem> newItem = m_tree.createElementFromSavedToken(formattingElementRecord->stackItem().get());
// 12.
- newItem->element()->takeAllChildrenFrom(furthestBlock->element());
+ m_tree.takeAllChildren(newItem.get(), furthestBlock);
// 13.
- Element* furthestBlockElement = furthestBlock->element();
- // FIXME: All this creation / parserAppendChild / attach business should
- // be in HTMLConstructionSite. My guess is that steps 11--15
- // should all be in some HTMLConstructionSite function.
- furthestBlockElement->parserAppendChild(newItem->element());
- // FIXME: Why is this attach logic necessary? Style resolve should attach us if needed.
- if (furthestBlockElement->attached() && !newItem->element()->attached()) {
- // Notice that newItem->element() might already be attached if, for example, one of the reparented
- // children is a style element, which attaches itself automatically.
- newItem->element()->attach();
- }
+ m_tree.reparent(furthestBlock, newItem.get());
// 14.
m_tree.activeFormattingElements()->swapTo(formattingElement, newItem, bookmark);
// 15.

Powered by Google App Engine
This is Rietveld 408576698