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 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 if (targetNode->inDocument()) | 787 if (targetNode->inDocument()) |
788 targetNode->didNotifySubtreeInsertionsToDocument(); | 788 targetNode->didNotifySubtreeInsertionsToDocument(); |
789 } | 789 } |
790 } | 790 } |
791 | 791 |
792 void ContainerNode::notifyNodeInsertedInternal(Node& root, NodeVector& postInser
tionNotificationTargets) | 792 void ContainerNode::notifyNodeInsertedInternal(Node& root, NodeVector& postInser
tionNotificationTargets) |
793 { | 793 { |
794 EventDispatchForbiddenScope assertNoEventDispatch; | 794 EventDispatchForbiddenScope assertNoEventDispatch; |
795 ScriptForbiddenScope forbidScript; | 795 ScriptForbiddenScope forbidScript; |
796 | 796 |
797 for (Node* node = &root; node; node = NodeTraversal::next(*node, &root)) { | 797 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) { |
798 // As an optimization we don't notify leaf nodes when when inserting | 798 // As an optimization we don't notify leaf nodes when when inserting |
799 // into detached subtrees. | 799 // into detached subtrees. |
800 if (!inDocument() && !node->isContainerNode()) | 800 if (!inDocument() && !node.isContainerNode()) |
801 continue; | 801 continue; |
802 if (Node::InsertionShouldCallDidNotifySubtreeInsertions == node->inserte
dInto(this)) | 802 if (Node::InsertionShouldCallDidNotifySubtreeInsertions == node.inserted
Into(this)) |
803 postInsertionNotificationTargets.append(node); | 803 postInsertionNotificationTargets.append(&node); |
804 for (ShadowRoot* shadowRoot = node->youngestShadowRoot(); shadowRoot; sh
adowRoot = shadowRoot->olderShadowRoot()) | 804 for (ShadowRoot* shadowRoot = node.youngestShadowRoot(); shadowRoot; sha
dowRoot = shadowRoot->olderShadowRoot()) |
805 notifyNodeInsertedInternal(*shadowRoot, postInsertionNotificationTar
gets); | 805 notifyNodeInsertedInternal(*shadowRoot, postInsertionNotificationTar
gets); |
806 } | 806 } |
807 } | 807 } |
808 | 808 |
809 void ContainerNode::notifyNodeRemoved(Node& root) | 809 void ContainerNode::notifyNodeRemoved(Node& root) |
810 { | 810 { |
811 ScriptForbiddenScope forbidScript; | 811 ScriptForbiddenScope forbidScript; |
812 EventDispatchForbiddenScope assertNoEventDispatch; | 812 EventDispatchForbiddenScope assertNoEventDispatch; |
813 | 813 |
814 Document& document = root.document(); | 814 Document& document = root.document(); |
815 for (Node* node = &root; node; node = NodeTraversal::next(*node, &root)) { | 815 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) { |
816 // As an optimization we skip notifying Text nodes and other leaf nodes | 816 // As an optimization we skip notifying Text nodes and other leaf nodes |
817 // of removal when they're not in the Document tree since the virtual | 817 // of removal when they're not in the Document tree since the virtual |
818 // call to removedFrom is not needed. | 818 // call to removedFrom is not needed. |
819 if (!node->inDocument() && !node->isContainerNode()) | 819 if (!node.inDocument() && !node.isContainerNode()) |
820 continue; | 820 continue; |
821 if (document.cssTarget() == node) | 821 if (document.cssTarget() == node) |
822 document.setCSSTarget(nullptr); | 822 document.setCSSTarget(nullptr); |
823 node->removedFrom(this); | 823 node.removedFrom(this); |
824 for (ShadowRoot* shadowRoot = node->youngestShadowRoot(); shadowRoot; sh
adowRoot = shadowRoot->olderShadowRoot()) | 824 for (ShadowRoot* shadowRoot = node.youngestShadowRoot(); shadowRoot; sha
dowRoot = shadowRoot->olderShadowRoot()) |
825 notifyNodeRemoved(*shadowRoot); | 825 notifyNodeRemoved(*shadowRoot); |
826 } | 826 } |
827 } | 827 } |
828 | 828 |
829 void ContainerNode::attach(const AttachContext& context) | 829 void ContainerNode::attach(const AttachContext& context) |
830 { | 830 { |
831 attachChildren(context); | 831 attachChildren(context); |
832 clearChildNeedsStyleRecalc(); | 832 clearChildNeedsStyleRecalc(); |
833 Node::attach(context); | 833 Node::attach(context); |
834 } | 834 } |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1441 return true; | 1441 return true; |
1442 | 1442 |
1443 if (node->isElementNode() && toElement(node)->shadow()) | 1443 if (node->isElementNode() && toElement(node)->shadow()) |
1444 return true; | 1444 return true; |
1445 | 1445 |
1446 return false; | 1446 return false; |
1447 } | 1447 } |
1448 #endif | 1448 #endif |
1449 | 1449 |
1450 } // namespace blink | 1450 } // namespace blink |
OLD | NEW |