| 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..e711319575491d2ac1ad99f9b9e7fd3633d805c8 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.insertAlreadyParsedChild(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.
|
|
|