| 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, 2013 Apple Inc. All rights
reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights
reserved. |
| 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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 } | 594 } |
| 595 | 595 |
| 596 void ContainerNode::notifyNodeInserted(Node& root, ChildrenChangeSource source) | 596 void ContainerNode::notifyNodeInserted(Node& root, ChildrenChangeSource source) |
| 597 { | 597 { |
| 598 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); | 598 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); |
| 599 ASSERT(!root.isShadowRoot()); | 599 ASSERT(!root.isShadowRoot()); |
| 600 | 600 |
| 601 RefPtr<Node> protect(this); | 601 RefPtr<Node> protect(this); |
| 602 RefPtr<Node> protectNode(root); | 602 RefPtr<Node> protectNode(root); |
| 603 | 603 |
| 604 NodeVector postInsertionNotificationTargets; | 604 notifyNodeInsertedInternal(root); |
| 605 notifyNodeInsertedInternal(root, postInsertionNotificationTargets); | |
| 606 | 605 |
| 607 childrenChanged(ChildrenChange::forInsertion(root, source)); | 606 childrenChanged(ChildrenChange::forInsertion(root, source)); |
| 608 | |
| 609 for (size_t i = 0; i < postInsertionNotificationTargets.size(); ++i) { | |
| 610 Node* targetNode = postInsertionNotificationTargets[i].get(); | |
| 611 if (targetNode->inDocument()) | |
| 612 targetNode->didNotifySubtreeInsertionsToDocument(); | |
| 613 } | |
| 614 } | 607 } |
| 615 | 608 |
| 616 void ContainerNode::notifyNodeInsertedInternal(Node& root, NodeVector& postInser
tionNotificationTargets) | 609 void ContainerNode::notifyNodeInsertedInternal(Node& root) |
| 617 { | 610 { |
| 618 EventDispatchForbiddenScope assertNoEventDispatch; | 611 EventDispatchForbiddenScope assertNoEventDispatch; |
| 619 ScriptForbiddenScope forbidScript; | 612 ScriptForbiddenScope forbidScript; |
| 620 | 613 |
| 621 for (Node* node = &root; node; node = NodeTraversal::next(*node, &root)) { | 614 for (Node* node = &root; node; node = NodeTraversal::next(*node, &root)) { |
| 622 // As an optimization we don't notify leaf nodes when when inserting | 615 // As an optimization we don't notify leaf nodes when when inserting |
| 623 // into detached subtrees. | 616 // into detached subtrees. |
| 624 if (!inDocument() && !node->isContainerNode()) | 617 if (!inDocument() && !node->isContainerNode()) |
| 625 continue; | 618 continue; |
| 626 if (Node::InsertionShouldCallDidNotifySubtreeInsertions == node->inserte
dInto(this)) | 619 node->insertedInto(this); |
| 627 postInsertionNotificationTargets.append(node); | |
| 628 for (ShadowRoot* shadowRoot = node->youngestShadowRoot(); shadowRoot; sh
adowRoot = shadowRoot->olderShadowRoot()) | 620 for (ShadowRoot* shadowRoot = node->youngestShadowRoot(); shadowRoot; sh
adowRoot = shadowRoot->olderShadowRoot()) |
| 629 notifyNodeInsertedInternal(*shadowRoot, postInsertionNotificationTar
gets); | 621 notifyNodeInsertedInternal(*shadowRoot); |
| 630 } | 622 } |
| 631 } | 623 } |
| 632 | 624 |
| 633 void ContainerNode::notifyNodeRemoved(Node& root) | 625 void ContainerNode::notifyNodeRemoved(Node& root) |
| 634 { | 626 { |
| 635 ScriptForbiddenScope forbidScript; | 627 ScriptForbiddenScope forbidScript; |
| 636 EventDispatchForbiddenScope assertNoEventDispatch; | 628 EventDispatchForbiddenScope assertNoEventDispatch; |
| 637 | 629 |
| 638 for (Node* node = &root; node; node = NodeTraversal::next(*node, &root)) { | 630 for (Node* node = &root; node; node = NodeTraversal::next(*node, &root)) { |
| 639 // As an optimization we skip notifying Text nodes and other leaf nodes | 631 // As an optimization we skip notifying Text nodes and other leaf nodes |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 return true; | 945 return true; |
| 954 | 946 |
| 955 if (node->isElementNode() && toElement(node)->shadow()) | 947 if (node->isElementNode() && toElement(node)->shadow()) |
| 956 return true; | 948 return true; |
| 957 | 949 |
| 958 return false; | 950 return false; |
| 959 } | 951 } |
| 960 #endif | 952 #endif |
| 961 | 953 |
| 962 } // namespace blink | 954 } // namespace blink |
| OLD | NEW |