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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 { | 306 { |
307 ASSERT(newChild); | 307 ASSERT(newChild); |
308 ASSERT(nextChild); | 308 ASSERT(nextChild); |
309 ASSERT(nextChild->parentNode() == this); | 309 ASSERT(nextChild->parentNode() == this); |
310 ASSERT(document() == newChild->document()); | 310 ASSERT(document() == newChild->document()); |
311 ASSERT(!newChild->isDocumentFragment()); | 311 ASSERT(!newChild->isDocumentFragment()); |
312 | 312 |
313 if (nextChild->previousSibling() == newChild || nextChild == newChild) // no
thing to do | 313 if (nextChild->previousSibling() == newChild || nextChild == newChild) // no
thing to do |
314 return; | 314 return; |
315 | 315 |
| 316 if (document() != newChild->document()) |
| 317 document()->adoptNode(newChild.get(), ASSERT_NO_EXCEPTION); |
| 318 |
316 insertBeforeCommon(nextChild, newChild.get()); | 319 insertBeforeCommon(nextChild, newChild.get()); |
317 | 320 |
318 childrenChanged(true, newChild->previousSibling(), nextChild, 1); | 321 childrenChanged(true, newChild->previousSibling(), nextChild, 1); |
319 ChildNodeInsertionNotifier(this).notify(newChild.get()); | 322 ChildNodeInsertionNotifier(this).notify(newChild.get()); |
320 } | 323 } |
321 | 324 |
322 bool ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, Exce
ptionCode& ec, bool shouldLazyAttach) | 325 bool ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, Exce
ptionCode& ec, bool shouldLazyAttach) |
323 { | 326 { |
324 // Check that this node is not "floating". | 327 // Check that this node is not "floating". |
325 // If it is, it can be deleted as a side effect of sending mutation events. | 328 // If it is, it can be deleted as a side effect of sending mutation events. |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 | 681 |
679 dispatchSubtreeModifiedEvent(); | 682 dispatchSubtreeModifiedEvent(); |
680 return true; | 683 return true; |
681 } | 684 } |
682 | 685 |
683 void ContainerNode::parserAppendChild(PassRefPtr<Node> newChild) | 686 void ContainerNode::parserAppendChild(PassRefPtr<Node> newChild) |
684 { | 687 { |
685 ASSERT(newChild); | 688 ASSERT(newChild); |
686 ASSERT(!newChild->parentNode()); // Use appendChild if you need to handle re
parenting (and want DOM mutation events). | 689 ASSERT(!newChild->parentNode()); // Use appendChild if you need to handle re
parenting (and want DOM mutation events). |
687 ASSERT(!newChild->isDocumentFragment()); | 690 ASSERT(!newChild->isDocumentFragment()); |
688 ASSERT(document() == newChild->document()); | 691 |
| 692 if (document() != newChild->document()) |
| 693 document()->adoptNode(newChild.get(), ASSERT_NO_EXCEPTION); |
689 | 694 |
690 Node* last = m_lastChild; | 695 Node* last = m_lastChild; |
691 { | 696 { |
692 NoEventDispatchAssertion assertNoEventDispatch; | 697 NoEventDispatchAssertion assertNoEventDispatch; |
693 // FIXME: This method should take a PassRefPtr. | 698 // FIXME: This method should take a PassRefPtr. |
694 appendChildToContainer(newChild.get(), this); | 699 appendChildToContainer(newChild.get(), this); |
695 treeScope()->adoptIfNeeded(newChild.get()); | 700 treeScope()->adoptIfNeeded(newChild.get()); |
696 } | 701 } |
697 | 702 |
698 childrenChanged(true, last, 0, 1); | 703 childrenChanged(true, last, 0, 1); |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 return true; | 1121 return true; |
1117 | 1122 |
1118 if (node->isElementNode() && toElement(node)->shadow()) | 1123 if (node->isElementNode() && toElement(node)->shadow()) |
1119 return true; | 1124 return true; |
1120 | 1125 |
1121 return false; | 1126 return false; |
1122 } | 1127 } |
1123 #endif | 1128 #endif |
1124 | 1129 |
1125 } // namespace WebCore | 1130 } // namespace WebCore |
OLD | NEW |