Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: third_party/WebKit/Source/core/dom/ContainerNode.cpp

Issue 2336103003: Convert a few more CFI blacklist entries into DISABLE_CFI_PERF attributes. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 oldParent.parserRemoveChild(*child); 83 oldParent.parserRemoveChild(*child);
84 parserAppendChild(child); 84 parserAppendChild(child);
85 } 85 }
86 } 86 }
87 87
88 ContainerNode::~ContainerNode() 88 ContainerNode::~ContainerNode()
89 { 89 {
90 DCHECK(needsAttach()); 90 DCHECK(needsAttach());
91 } 91 }
92 92
93 DISABLE_CFI_PERF
93 bool ContainerNode::isChildTypeAllowed(const Node& child) const 94 bool ContainerNode::isChildTypeAllowed(const Node& child) const
94 { 95 {
95 if (!child.isDocumentFragment()) 96 if (!child.isDocumentFragment())
96 return childTypeAllowed(child.getNodeType()); 97 return childTypeAllowed(child.getNodeType());
97 98
98 for (Node* node = toDocumentFragment(child).firstChild(); node; node = node- >nextSibling()) { 99 for (Node* node = toDocumentFragment(child).firstChild(); node; node = node- >nextSibling()) {
99 if (!childTypeAllowed(node->getNodeType())) 100 if (!childTypeAllowed(node->getNodeType()))
100 return false; 101 return false;
101 } 102 }
102 return true; 103 return true;
103 } 104 }
104 105
105 bool ContainerNode::containsConsideringHostElements(const Node& newChild) const 106 bool ContainerNode::containsConsideringHostElements(const Node& newChild) const
106 { 107 {
107 if (isInShadowTree() || document().isTemplateDocument()) 108 if (isInShadowTree() || document().isTemplateDocument())
108 return newChild.containsIncludingHostElements(*this); 109 return newChild.containsIncludingHostElements(*this);
109 return newChild.contains(this); 110 return newChild.contains(this);
110 } 111 }
111 112
113 DISABLE_CFI_PERF
112 bool ContainerNode::checkAcceptChild(const Node* newChild, const Node* oldChild, ExceptionState& exceptionState) const 114 bool ContainerNode::checkAcceptChild(const Node* newChild, const Node* oldChild, ExceptionState& exceptionState) const
113 { 115 {
114 // Not mentioned in spec: throw NotFoundError if newChild is null 116 // Not mentioned in spec: throw NotFoundError if newChild is null
115 if (!newChild) { 117 if (!newChild) {
116 exceptionState.throwDOMException(NotFoundError, "The new child element i s null."); 118 exceptionState.throwDOMException(NotFoundError, "The new child element i s null.");
117 return false; 119 return false;
118 } 120 }
119 121
120 // Use common case fast path if possible. 122 // Use common case fast path if possible.
121 if ((newChild->isElementNode() || newChild->isTextNode()) && isElementNode() ) { 123 if ((newChild->isElementNode() || newChild->isTextNode()) && isElementNode() ) {
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 667
666 treeScope().adoptIfNeeded(*newChild); 668 treeScope().adoptIfNeeded(*newChild);
667 appendChildCommon(*newChild); 669 appendChildCommon(*newChild);
668 DCHECK_EQ(newChild->connectedSubframeCount(), 0u); 670 DCHECK_EQ(newChild->connectedSubframeCount(), 0u);
669 ChildListMutationScope(*this).childAdded(*newChild); 671 ChildListMutationScope(*this).childAdded(*newChild);
670 } 672 }
671 673
672 notifyNodeInserted(*newChild, ChildrenChangeSourceParser); 674 notifyNodeInserted(*newChild, ChildrenChangeSourceParser);
673 } 675 }
674 676
677 DISABLE_CFI_PERF
675 void ContainerNode::notifyNodeInserted(Node& root, ChildrenChangeSource source) 678 void ContainerNode::notifyNodeInserted(Node& root, ChildrenChangeSource source)
676 { 679 {
677 #if DCHECK_IS_ON() 680 #if DCHECK_IS_ON()
678 DCHECK(!EventDispatchForbiddenScope::isEventDispatchForbidden()); 681 DCHECK(!EventDispatchForbiddenScope::isEventDispatchForbidden());
679 #endif 682 #endif
680 DCHECK(!root.isShadowRoot()); 683 DCHECK(!root.isShadowRoot());
681 684
682 if (document().containsV1ShadowTree()) 685 if (document().containsV1ShadowTree())
683 root.checkSlotChangeAfterInserted(); 686 root.checkSlotChangeAfterInserted();
684 687
685 InspectorInstrumentation::didInsertDOMNode(&root); 688 InspectorInstrumentation::didInsertDOMNode(&root);
686 689
687 NodeVector postInsertionNotificationTargets; 690 NodeVector postInsertionNotificationTargets;
688 notifyNodeInsertedInternal(root, postInsertionNotificationTargets); 691 notifyNodeInsertedInternal(root, postInsertionNotificationTargets);
689 692
690 childrenChanged(ChildrenChange::forInsertion(root, source)); 693 childrenChanged(ChildrenChange::forInsertion(root, source));
691 694
692 for (const auto& targetNode : postInsertionNotificationTargets) { 695 for (const auto& targetNode : postInsertionNotificationTargets) {
693 if (targetNode->isConnected()) 696 if (targetNode->isConnected())
694 targetNode->didNotifySubtreeInsertionsToDocument(); 697 targetNode->didNotifySubtreeInsertionsToDocument();
695 } 698 }
696 } 699 }
697 700
701 DISABLE_CFI_PERF
698 void ContainerNode::notifyNodeInsertedInternal(Node& root, NodeVector& postInser tionNotificationTargets) 702 void ContainerNode::notifyNodeInsertedInternal(Node& root, NodeVector& postInser tionNotificationTargets)
699 { 703 {
700 EventDispatchForbiddenScope assertNoEventDispatch; 704 EventDispatchForbiddenScope assertNoEventDispatch;
701 ScriptForbiddenScope forbidScript; 705 ScriptForbiddenScope forbidScript;
702 706
703 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) { 707 for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) {
704 // As an optimization we don't notify leaf nodes when when inserting 708 // As an optimization we don't notify leaf nodes when when inserting
705 // into detached subtrees that are not in a shadow tree. 709 // into detached subtrees that are not in a shadow tree.
706 if (!isConnected() && !isInShadowTree() && !node.isContainerNode()) 710 if (!isConnected() && !isInShadowTree() && !node.isContainerNode())
707 continue; 711 continue;
(...skipping 14 matching lines...) Expand all
722 // of removal when they're not in the Document tree and not in a shadow root since the virtual 726 // of removal when they're not in the Document tree and not in a shadow root since the virtual
723 // call to removedFrom is not needed. 727 // call to removedFrom is not needed.
724 if (!node.isContainerNode() && !node.isInTreeScope()) 728 if (!node.isContainerNode() && !node.isInTreeScope())
725 continue; 729 continue;
726 node.removedFrom(this); 730 node.removedFrom(this);
727 for (ShadowRoot* shadowRoot = node.youngestShadowRoot(); shadowRoot; sha dowRoot = shadowRoot->olderShadowRoot()) 731 for (ShadowRoot* shadowRoot = node.youngestShadowRoot(); shadowRoot; sha dowRoot = shadowRoot->olderShadowRoot())
728 notifyNodeRemoved(*shadowRoot); 732 notifyNodeRemoved(*shadowRoot);
729 } 733 }
730 } 734 }
731 735
736 DISABLE_CFI_PERF
732 void ContainerNode::attachLayoutTree(const AttachContext& context) 737 void ContainerNode::attachLayoutTree(const AttachContext& context)
733 { 738 {
734 AttachContext childrenContext(context); 739 AttachContext childrenContext(context);
735 childrenContext.resolvedStyle = nullptr; 740 childrenContext.resolvedStyle = nullptr;
736 741
737 for (Node* child = firstChild(); child; child = child->nextSibling()) { 742 for (Node* child = firstChild(); child; child = child->nextSibling()) {
738 #if DCHECK_IS_ON() 743 #if DCHECK_IS_ON()
739 DCHECK(child->needsAttach() || childAttachedAllowedWhenAttachingChildren (this)); 744 DCHECK(child->needsAttach() || childAttachedAllowedWhenAttachingChildren (this));
740 #endif 745 #endif
741 if (child->needsAttach()) 746 if (child->needsAttach())
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 return true; 1381 return true;
1377 1382
1378 if (node->isElementNode() && toElement(node)->shadow()) 1383 if (node->isElementNode() && toElement(node)->shadow())
1379 return true; 1384 return true;
1380 1385
1381 return false; 1386 return false;
1382 } 1387 }
1383 #endif 1388 #endif
1384 1389
1385 } // namespace blink 1390 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/resolver/SharedStyleFinder.cpp ('k') | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698