Changeset 140784 in webkit
- Timestamp:
- Jan 24, 2013 10:45:39 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r140778 r140784 1 2013-01-24 Hajime Morrita <morrita@google.com> 2 3 Refactoring: The name ContainerNode::removeChildren and ContainerNde::removeAllChilren() is confusing 4 https://bugs.webkit.org/show_bug.cgi?id=107640 5 6 Reviewed by Eric Seidel. 7 8 This change renames unsafe removeAllChilren() function to 9 removeDetachedChildren() and move it to protected visibility. 10 11 In theory, the removed nodes should be detached() before. But some 12 tests violates that assumption. It should be fixed. 13 14 No new tests. No behavior change. 15 16 * dom/ContainerNode.cpp: 17 (WebCore::ContainerNode::removeDetachedChildren): 18 (WebCore::ContainerNode::takeAllChildrenFrom): 19 (WebCore::ContainerNode::~ContainerNode): 20 * dom/ContainerNode.h: 21 (ContainerNode): 22 * dom/ContainerNodeAlgorithms.h: 23 (WebCore::removeDetachedChildrenInContainer): 24 (WebCore): 25 * dom/Document.cpp: 26 (WebCore::Document::removedLastRef): 27 * dom/ShadowRoot.cpp: 28 (WebCore::ShadowRoot::~ShadowRoot): 29 * svg/SVGElementInstance.cpp: 30 (WebCore::SVGElementInstance::detach): 31 * svg/SVGElementInstance.h: 32 (SVGElementInstance): 33 1 34 2013-01-24 Keishi Hattori <keishi@webkit.org> 2 35 -
trunk/Source/WebCore/dom/ContainerNode.cpp
r140633 r140784 91 91 } 92 92 93 void ContainerNode::removeAllChildren() 94 { 95 removeAllChildrenInContainer<Node, ContainerNode>(this); 93 void ContainerNode::removeDetachedChildren() 94 { 95 // FIXME: We should be able to ASSERT(!attached()) here: https://bugs.webkit.org/show_bug.cgi?id=107801 96 removeDetachedChildrenInContainer<Node, ContainerNode>(this); 96 97 } 97 98 … … 100 101 NodeVector children; 101 102 getChildNodes(oldParent, children); 102 oldParent->remove AllChildren();103 oldParent->removeDetachedChildren(); 103 104 104 105 for (unsigned i = 0; i < children.size(); ++i) { … … 124 125 documentInternal()->axObjectCache()->remove(this); 125 126 126 remove AllChildren();127 removeDetachedChildren(); 127 128 } 128 129 -
trunk/Source/WebCore/dom/ContainerNode.h
r138448 r140784 102 102 void parserInsertBefore(PassRefPtr<Node> newChild, Node* refChild); 103 103 104 // FIXME: It's not good to have two functions with such similar names, especially public functions.105 // How do removeChildren and removeAllChildren differ?106 104 void removeChildren(); 107 void removeAllChildren();108 109 105 void takeAllChildrenFrom(ContainerNode*); 110 106 … … 155 151 friend void Private::addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer*); 156 152 153 void removeDetachedChildren(); 157 154 void setFirstChild(Node* child) { m_firstChild = child; } 158 155 void setLastChild(Node* child) { m_lastChild = child; } -
trunk/Source/WebCore/dom/ContainerNodeAlgorithms.h
r140090 r140784 79 79 // This applies to 'ContainerNode' and 'SVGElementInstance' 80 80 template<class GenericNode, class GenericNodeContainer> 81 inline void remove AllChildrenInContainer(GenericNodeContainer* container)81 inline void removeDetachedChildrenInContainer(GenericNodeContainer* container) 82 82 { 83 83 // List of nodes to be deleted. … … 121 121 } 122 122 123 // Helper methods for remove AllChildrenInContainer, hidden from WebCore namespace123 // Helper methods for removeDetachedChildrenInContainer, hidden from WebCore namespace 124 124 namespace Private { 125 125 -
trunk/Source/WebCore/dom/Document.cpp
r140614 r140784 657 657 // If removing a child removes the last self-only ref, we don't 658 658 // want the scope to be destructed until after 659 // remove AllChildren returns, so we guard ourselves with an659 // removeDetachedChildren returns, so we guard ourselves with an 660 660 // extra self-only ref. 661 661 guardRef(); … … 678 678 detachParser(); 679 679 680 // remove AllChildren() doesn't always unregister IDs,680 // removeDetachedChildren() doesn't always unregister IDs, 681 681 // so tear down scope information upfront to avoid having stale references in the map. 682 682 destroyTreeScopeData(); 683 remove AllChildren();683 removeDetachedChildren(); 684 684 685 685 m_markers->detach(); -
trunk/Source/WebCore/dom/ShadowRoot.cpp
r139198 r140784 87 87 // runs so we don't go through TreeScopeAdopter for each child with a 88 88 // destructed tree scope in each descendant. 89 remove AllChildren();89 removeDetachedChildren(); 90 90 91 91 // We must call clearRareData() here since a ShadowRoot class inherits TreeScope -
trunk/Source/WebCore/svg/SVGElementInstance.cpp
r139751 r140784 102 102 m_correspondingUseElement = 0; 103 103 104 remove AllChildrenInContainer<SVGElementInstance, SVGElementInstance>(this);104 removeDetachedChildrenInContainer<SVGElementInstance, SVGElementInstance>(this); 105 105 } 106 106 -
trunk/Source/WebCore/svg/SVGElementInstance.h
r139751 r140784 162 162 163 163 template<class GenericNode, class GenericNodeContainer> 164 friend void remove AllChildrenInContainer(GenericNodeContainer* container);164 friend void removeDetachedChildrenInContainer(GenericNodeContainer*); 165 165 166 166 template<class GenericNode, class GenericNodeContainer>
Note: See TracChangeset
for help on using the changeset viewer.