| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. |
| 3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1564 | 1564 |
| 1565 // 9.8 | 1565 // 9.8 |
| 1566 if (lastNode == furthestBlock) | 1566 if (lastNode == furthestBlock) |
| 1567 bookmark.moveToAfter(nodeEntry); | 1567 bookmark.moveToAfter(nodeEntry); |
| 1568 // 9.9 | 1568 // 9.9 |
| 1569 m_tree.reparent(node, lastNode); | 1569 m_tree.reparent(node, lastNode); |
| 1570 // 9.10 | 1570 // 9.10 |
| 1571 lastNode = node; | 1571 lastNode = node; |
| 1572 } | 1572 } |
| 1573 // 10. | 1573 // 10. |
| 1574 if (ContainerNode* parent = lastNode->element()->parentNode()) | 1574 m_tree.insertAlreadyParsedChild(commonAncestor.get(), lastNode); |
| 1575 parent->parserRemoveChild(lastNode->element()); | |
| 1576 if (commonAncestor->causesFosterParenting()) | |
| 1577 m_tree.fosterParent(lastNode->element()); | |
| 1578 else { | |
| 1579 if (commonAncestor->hasTagName(templateTag)) | |
| 1580 toHTMLTemplateElement(commonAncestor->node())->content()->parser
AppendChild(lastNode->element()); | |
| 1581 else | |
| 1582 commonAncestor->node()->parserAppendChild(lastNode->element()); | |
| 1583 ASSERT(lastNode->stackItem()->isElementNode()); | |
| 1584 ASSERT(lastNode->element()->parentNode()); | |
| 1585 if (lastNode->element()->parentNode()->attached() && !lastNode->elem
ent()->attached()) | |
| 1586 lastNode->element()->lazyAttach(); | |
| 1587 } | |
| 1588 // 11. | 1575 // 11. |
| 1589 RefPtr<HTMLStackItem> newItem = m_tree.createElementFromSavedToken(forma
ttingElementRecord->stackItem().get()); | 1576 RefPtr<HTMLStackItem> newItem = m_tree.createElementFromSavedToken(forma
ttingElementRecord->stackItem().get()); |
| 1590 // 12. | 1577 // 12. |
| 1591 newItem->element()->takeAllChildrenFrom(furthestBlock->element()); | 1578 m_tree.takeAllChildren(newItem.get(), furthestBlock); |
| 1592 // 13. | 1579 // 13. |
| 1593 Element* furthestBlockElement = furthestBlock->element(); | 1580 m_tree.reparent(furthestBlock, newItem.get()); |
| 1594 // FIXME: All this creation / parserAppendChild / attach business should | |
| 1595 // be in HTMLConstructionSite. My guess is that steps 11--15 | |
| 1596 // should all be in some HTMLConstructionSite function. | |
| 1597 furthestBlockElement->parserAppendChild(newItem->element()); | |
| 1598 // FIXME: Why is this attach logic necessary? Style resolve should attac
h us if needed. | |
| 1599 if (furthestBlockElement->attached() && !newItem->element()->attached())
{ | |
| 1600 // Notice that newItem->element() might already be attached if, for
example, one of the reparented | |
| 1601 // children is a style element, which attaches itself automatically. | |
| 1602 newItem->element()->attach(); | |
| 1603 } | |
| 1604 // 14. | 1581 // 14. |
| 1605 m_tree.activeFormattingElements()->swapTo(formattingElement, newItem, bo
okmark); | 1582 m_tree.activeFormattingElements()->swapTo(formattingElement, newItem, bo
okmark); |
| 1606 // 15. | 1583 // 15. |
| 1607 m_tree.openElements()->remove(formattingElement); | 1584 m_tree.openElements()->remove(formattingElement); |
| 1608 m_tree.openElements()->insertAbove(newItem, furthestBlock); | 1585 m_tree.openElements()->insertAbove(newItem, furthestBlock); |
| 1609 } | 1586 } |
| 1610 } | 1587 } |
| 1611 | 1588 |
| 1612 void HTMLTreeBuilder::resetInsertionModeAppropriately() | 1589 void HTMLTreeBuilder::resetInsertionModeAppropriately() |
| 1613 { | 1590 { |
| (...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2824 ASSERT(m_isAttached); | 2801 ASSERT(m_isAttached); |
| 2825 // Warning, this may detach the parser. Do not do anything else after this. | 2802 // Warning, this may detach the parser. Do not do anything else after this. |
| 2826 m_tree.finishedParsing(); | 2803 m_tree.finishedParsing(); |
| 2827 } | 2804 } |
| 2828 | 2805 |
| 2829 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) | 2806 void HTMLTreeBuilder::parseError(AtomicHTMLToken*) |
| 2830 { | 2807 { |
| 2831 } | 2808 } |
| 2832 | 2809 |
| 2833 } | 2810 } |
| OLD | NEW |