| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 // FIXME: We need to do notifyMutationObserversNodeWillDetach() for each chi
ld, | 98 // FIXME: We need to do notifyMutationObserversNodeWillDetach() for each chi
ld, |
| 99 // probably inside removeDetachedChildrenInContainer. | 99 // probably inside removeDetachedChildrenInContainer. |
| 100 | 100 |
| 101 oldParent->removeDetachedChildren(); | 101 oldParent->removeDetachedChildren(); |
| 102 | 102 |
| 103 for (unsigned i = 0; i < children.size(); ++i) { | 103 for (unsigned i = 0; i < children.size(); ++i) { |
| 104 if (children[i]->attached()) | 104 if (children[i]->attached()) |
| 105 children[i]->detach(); | 105 children[i]->detach(); |
| 106 // FIXME: We need a no mutation event version of adoptNode. | 106 // FIXME: We need a no mutation event version of adoptNode. |
| 107 RefPtr<Node> child = document()->adoptNode(children[i].release(), ASSERT
_NO_EXCEPTION_STATE); | 107 RefPtr<Node> child = document()->adoptNode(children[i].release(), ASSERT
_NO_EXCEPTION); |
| 108 parserAppendChild(child.get()); | 108 parserAppendChild(child.get()); |
| 109 // FIXME: Together with adoptNode above, the tree scope might get update
d recursively twice | 109 // FIXME: Together with adoptNode above, the tree scope might get update
d recursively twice |
| 110 // (if the document changed or oldParent was in a shadow tree, AND *this
is in a shadow tree). | 110 // (if the document changed or oldParent was in a shadow tree, AND *this
is in a shadow tree). |
| 111 // Can we do better? | 111 // Can we do better? |
| 112 treeScope()->adoptIfNeeded(child.get()); | 112 treeScope()->adoptIfNeeded(child.get()); |
| 113 if (attached() && !child->attached()) | 113 if (attached() && !child->attached()) |
| 114 child->attach(); | 114 child->attach(); |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 ASSERT(newChild); | 315 ASSERT(newChild); |
| 316 ASSERT(nextChild); | 316 ASSERT(nextChild); |
| 317 ASSERT(nextChild->parentNode() == this); | 317 ASSERT(nextChild->parentNode() == this); |
| 318 ASSERT(!newChild->isDocumentFragment()); | 318 ASSERT(!newChild->isDocumentFragment()); |
| 319 ASSERT(!hasTagName(HTMLNames::templateTag)); | 319 ASSERT(!hasTagName(HTMLNames::templateTag)); |
| 320 | 320 |
| 321 if (nextChild->previousSibling() == newChild || nextChild == newChild) // no
thing to do | 321 if (nextChild->previousSibling() == newChild || nextChild == newChild) // no
thing to do |
| 322 return; | 322 return; |
| 323 | 323 |
| 324 if (document() != newChild->document()) | 324 if (document() != newChild->document()) |
| 325 document()->adoptNode(newChild.get(), ASSERT_NO_EXCEPTION_STATE); | 325 document()->adoptNode(newChild.get(), ASSERT_NO_EXCEPTION); |
| 326 | 326 |
| 327 insertBeforeCommon(nextChild, newChild.get()); | 327 insertBeforeCommon(nextChild, newChild.get()); |
| 328 | 328 |
| 329 newChild->updateAncestorConnectedSubframeCountForInsertion(); | 329 newChild->updateAncestorConnectedSubframeCountForInsertion(); |
| 330 | 330 |
| 331 ChildListMutationScope(this).childAdded(newChild.get()); | 331 ChildListMutationScope(this).childAdded(newChild.get()); |
| 332 | 332 |
| 333 childrenChanged(true, newChild->previousSibling(), nextChild, 1); | 333 childrenChanged(true, newChild->previousSibling(), nextChild, 1); |
| 334 ChildNodeInsertionNotifier(this).notify(newChild.get()); | 334 ChildNodeInsertionNotifier(this).notify(newChild.get()); |
| 335 } | 335 } |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 } | 653 } |
| 654 | 654 |
| 655 void ContainerNode::parserAppendChild(PassRefPtr<Node> newChild) | 655 void ContainerNode::parserAppendChild(PassRefPtr<Node> newChild) |
| 656 { | 656 { |
| 657 ASSERT(newChild); | 657 ASSERT(newChild); |
| 658 ASSERT(!newChild->parentNode()); // Use appendChild if you need to handle re
parenting (and want DOM mutation events). | 658 ASSERT(!newChild->parentNode()); // Use appendChild if you need to handle re
parenting (and want DOM mutation events). |
| 659 ASSERT(!newChild->isDocumentFragment()); | 659 ASSERT(!newChild->isDocumentFragment()); |
| 660 ASSERT(!hasTagName(HTMLNames::templateTag)); | 660 ASSERT(!hasTagName(HTMLNames::templateTag)); |
| 661 | 661 |
| 662 if (document() != newChild->document()) | 662 if (document() != newChild->document()) |
| 663 document()->adoptNode(newChild.get(), ASSERT_NO_EXCEPTION_STATE); | 663 document()->adoptNode(newChild.get(), ASSERT_NO_EXCEPTION); |
| 664 | 664 |
| 665 Node* last = m_lastChild; | 665 Node* last = m_lastChild; |
| 666 { | 666 { |
| 667 NoEventDispatchAssertion assertNoEventDispatch; | 667 NoEventDispatchAssertion assertNoEventDispatch; |
| 668 // FIXME: This method should take a PassRefPtr. | 668 // FIXME: This method should take a PassRefPtr. |
| 669 appendChildToContainer(newChild.get(), this); | 669 appendChildToContainer(newChild.get(), this); |
| 670 treeScope()->adoptIfNeeded(newChild.get()); | 670 treeScope()->adoptIfNeeded(newChild.get()); |
| 671 } | 671 } |
| 672 | 672 |
| 673 newChild->updateAncestorConnectedSubframeCountForInsertion(); | 673 newChild->updateAncestorConnectedSubframeCountForInsertion(); |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 return true; | 1058 return true; |
| 1059 | 1059 |
| 1060 if (node->isElementNode() && toElement(node)->shadow()) | 1060 if (node->isElementNode() && toElement(node)->shadow()) |
| 1061 return true; | 1061 return true; |
| 1062 | 1062 |
| 1063 return false; | 1063 return false; |
| 1064 } | 1064 } |
| 1065 #endif | 1065 #endif |
| 1066 | 1066 |
| 1067 } // namespace WebCore | 1067 } // namespace WebCore |
| OLD | NEW |