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

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

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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, 2009, 2010, 2011, 2013 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2013 Apple Inc. All r ights 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 enum SubtreeModificationAction { 60 enum SubtreeModificationAction {
61 DispatchSubtreeModifiedEvent, 61 DispatchSubtreeModifiedEvent,
62 OmitSubtreeModifiedEvent 62 OmitSubtreeModifiedEvent
63 }; 63 };
64 64
65 // This constant controls how much buffer is initially allocated 65 // This constant controls how much buffer is initially allocated
66 // for a Node Vector that is used to store child Nodes of a given Node. 66 // for a Node Vector that is used to store child Nodes of a given Node.
67 // FIXME: Optimize the value. 67 // FIXME: Optimize the value.
68 const int initialNodeVectorSize = 11; 68 const int initialNodeVectorSize = 11;
69 using NodeVector = WillBeHeapVector<RefPtrWillBeMember<Node>, initialNodeVectorS ize>; 69 using NodeVector = HeapVector<Member<Node>, initialNodeVectorSize>;
70 70
71 class CORE_EXPORT ContainerNode : public Node { 71 class CORE_EXPORT ContainerNode : public Node {
72 public: 72 public:
73 ~ContainerNode() override; 73 ~ContainerNode() override;
74 74
75 Node* firstChild() const { return m_firstChild; } 75 Node* firstChild() const { return m_firstChild; }
76 Node* lastChild() const { return m_lastChild; } 76 Node* lastChild() const { return m_lastChild; }
77 bool hasChildren() const { return m_firstChild; } 77 bool hasChildren() const { return m_firstChild; }
78 78
79 bool hasOneChild() const { return m_firstChild && !m_firstChild->nextSibling (); } 79 bool hasOneChild() const { return m_firstChild && !m_firstChild->nextSibling (); }
80 bool hasOneTextChild() const { return hasOneChild() && m_firstChild->isTextN ode(); } 80 bool hasOneTextChild() const { return hasOneChild() && m_firstChild->isTextN ode(); }
81 bool hasChildCount(unsigned) const; 81 bool hasChildCount(unsigned) const;
82 82
83 PassRefPtrWillBeRawPtr<HTMLCollection> children(); 83 RawPtr<HTMLCollection> children();
84 84
85 unsigned countChildren() const; 85 unsigned countChildren() const;
86 86
87 PassRefPtrWillBeRawPtr<Element> querySelector(const AtomicString& selectors, ExceptionState&); 87 RawPtr<Element> querySelector(const AtomicString& selectors, ExceptionState& );
88 PassRefPtrWillBeRawPtr<StaticElementList> querySelectorAll(const AtomicStrin g& selectors, ExceptionState&); 88 RawPtr<StaticElementList> querySelectorAll(const AtomicString& selectors, Ex ceptionState&);
89 89
90 PassRefPtrWillBeRawPtr<Node> insertBefore(PassRefPtrWillBeRawPtr<Node> newCh ild, Node* refChild, ExceptionState& = ASSERT_NO_EXCEPTION); 90 RawPtr<Node> insertBefore(RawPtr<Node> newChild, Node* refChild, ExceptionSt ate& = ASSERT_NO_EXCEPTION);
91 PassRefPtrWillBeRawPtr<Node> replaceChild(PassRefPtrWillBeRawPtr<Node> newCh ild, PassRefPtrWillBeRawPtr<Node> oldChild, ExceptionState& = ASSERT_NO_EXCEPTIO N); 91 RawPtr<Node> replaceChild(RawPtr<Node> newChild, RawPtr<Node> oldChild, Exce ptionState& = ASSERT_NO_EXCEPTION);
92 PassRefPtrWillBeRawPtr<Node> removeChild(PassRefPtrWillBeRawPtr<Node> child, ExceptionState& = ASSERT_NO_EXCEPTION); 92 RawPtr<Node> removeChild(RawPtr<Node> child, ExceptionState& = ASSERT_NO_EXC EPTION);
93 PassRefPtrWillBeRawPtr<Node> appendChild(PassRefPtrWillBeRawPtr<Node> newChi ld, ExceptionState& = ASSERT_NO_EXCEPTION); 93 RawPtr<Node> appendChild(RawPtr<Node> newChild, ExceptionState& = ASSERT_NO_ EXCEPTION);
94 94
95 Element* getElementById(const AtomicString& id) const; 95 Element* getElementById(const AtomicString& id) const;
96 PassRefPtrWillBeRawPtr<TagCollection> getElementsByTagName(const AtomicStrin g&); 96 RawPtr<TagCollection> getElementsByTagName(const AtomicString&);
97 PassRefPtrWillBeRawPtr<TagCollection> getElementsByTagNameNS(const AtomicStr ing& namespaceURI, const AtomicString& localName); 97 RawPtr<TagCollection> getElementsByTagNameNS(const AtomicString& namespaceUR I, const AtomicString& localName);
98 PassRefPtrWillBeRawPtr<NameNodeList> getElementsByName(const AtomicString& e lementName); 98 RawPtr<NameNodeList> getElementsByName(const AtomicString& elementName);
99 PassRefPtrWillBeRawPtr<ClassCollection> getElementsByClassName(const AtomicS tring& classNames); 99 RawPtr<ClassCollection> getElementsByClassName(const AtomicString& className s);
100 PassRefPtrWillBeRawPtr<RadioNodeList> radioNodeList(const AtomicString&, boo l onlyMatchImgElements = false); 100 RawPtr<RadioNodeList> radioNodeList(const AtomicString&, bool onlyMatchImgEl ements = false);
101 101
102 // These methods are only used during parsing. 102 // These methods are only used during parsing.
103 // They don't send DOM mutation events or accept DocumentFragments. 103 // They don't send DOM mutation events or accept DocumentFragments.
104 void parserAppendChild(PassRefPtrWillBeRawPtr<Node>); 104 void parserAppendChild(RawPtr<Node>);
105 void parserRemoveChild(Node&); 105 void parserRemoveChild(Node&);
106 void parserInsertBefore(PassRefPtrWillBeRawPtr<Node> newChild, Node& refChil d); 106 void parserInsertBefore(RawPtr<Node> newChild, Node& refChild);
107 void parserTakeAllChildrenFrom(ContainerNode&); 107 void parserTakeAllChildrenFrom(ContainerNode&);
108 108
109 void removeChildren(SubtreeModificationAction = DispatchSubtreeModifiedEvent ); 109 void removeChildren(SubtreeModificationAction = DispatchSubtreeModifiedEvent );
110 110
111 void cloneChildNodes(ContainerNode* clone); 111 void cloneChildNodes(ContainerNode* clone);
112 112
113 void attach(const AttachContext& = AttachContext()) override; 113 void attach(const AttachContext& = AttachContext()) override;
114 void detach(const AttachContext& = AttachContext()) override; 114 void detach(const AttachContext& = AttachContext()) override;
115 LayoutRect boundingBox() const final; 115 LayoutRect boundingBox() const final;
116 void setFocus(bool) override; 116 void setFocus(bool) override;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 byParser 192 byParser
193 }; 193 };
194 return change; 194 return change;
195 } 195 }
196 196
197 bool isChildInsertion() const { return type == ElementInserted || type = = NonElementInserted; } 197 bool isChildInsertion() const { return type == ElementInserted || type = = NonElementInserted; }
198 bool isChildRemoval() const { return type == ElementRemoved || type == N onElementRemoved; } 198 bool isChildRemoval() const { return type == ElementRemoved || type == N onElementRemoved; }
199 bool isChildElementChange() const { return type == ElementInserted || ty pe == ElementRemoved; } 199 bool isChildElementChange() const { return type == ElementInserted || ty pe == ElementRemoved; }
200 200
201 ChildrenChangeType type; 201 ChildrenChangeType type;
202 RawPtrWillBeMember<Node> siblingBeforeChange; 202 Member<Node> siblingBeforeChange;
203 RawPtrWillBeMember<Node> siblingAfterChange; 203 Member<Node> siblingAfterChange;
204 ChildrenChangeSource byParser; 204 ChildrenChangeSource byParser;
205 }; 205 };
206 206
207 // Notifies the node that it's list of children have changed (either by addi ng or removing child nodes), or a child 207 // Notifies the node that it's list of children have changed (either by addi ng or removing child nodes), or a child
208 // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE ha s changed its value. 208 // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE ha s changed its value.
209 virtual void childrenChanged(const ChildrenChange&); 209 virtual void childrenChanged(const ChildrenChange&);
210 210
211 DECLARE_VIRTUAL_TRACE(); 211 DECLARE_VIRTUAL_TRACE();
212 212
213 protected: 213 protected:
214 ContainerNode(TreeScope*, ConstructionType = CreateContainer); 214 ContainerNode(TreeScope*, ConstructionType = CreateContainer);
215 215
216 void invalidateNodeListCachesInAncestors(const QualifiedName* attrName = nul lptr, Element* attributeOwnerElement = nullptr); 216 void invalidateNodeListCachesInAncestors(const QualifiedName* attrName = nul lptr, Element* attributeOwnerElement = nullptr);
217 217
218 #if !ENABLE(OILPAN) 218 #if !ENABLE(OILPAN)
219 void removeDetachedChildren(); 219 void removeDetachedChildren();
220 #endif 220 #endif
221 221
222 void setFirstChild(Node* child) { m_firstChild = child; } 222 void setFirstChild(Node* child) { m_firstChild = child; }
223 void setLastChild(Node* child) { m_lastChild = child; } 223 void setLastChild(Node* child) { m_lastChild = child; }
224 224
225 // Utility functions for NodeListsNodeData API. 225 // Utility functions for NodeListsNodeData API.
226 template <typename Collection> PassRefPtrWillBeRawPtr<Collection> ensureCach edCollection(CollectionType); 226 template <typename Collection> RawPtr<Collection> ensureCachedCollection(Col lectionType);
227 template <typename Collection> PassRefPtrWillBeRawPtr<Collection> ensureCach edCollection(CollectionType, const AtomicString& name); 227 template <typename Collection> RawPtr<Collection> ensureCachedCollection(Col lectionType, const AtomicString& name);
228 template <typename Collection> PassRefPtrWillBeRawPtr<Collection> ensureCach edCollection(CollectionType, const AtomicString& namespaceURI, const AtomicStrin g& localName); 228 template <typename Collection> RawPtr<Collection> ensureCachedCollection(Col lectionType, const AtomicString& namespaceURI, const AtomicString& localName);
229 template <typename Collection> Collection* cachedCollection(CollectionType); 229 template <typename Collection> Collection* cachedCollection(CollectionType);
230 230
231 private: 231 private:
232 bool isContainerNode() const = delete; // This will catch anyone doing an un necessary check. 232 bool isContainerNode() const = delete; // This will catch anyone doing an un necessary check.
233 bool isTextNode() const = delete; // This will catch anyone doing an unneces sary check. 233 bool isTextNode() const = delete; // This will catch anyone doing an unneces sary check.
234 234
235 NodeListsNodeData& ensureNodeLists(); 235 NodeListsNodeData& ensureNodeLists();
236 void removeBetween(Node* previousChild, Node* nextChild, Node& oldChild); 236 void removeBetween(Node* previousChild, Node* nextChild, Node& oldChild);
237 void insertBeforeCommon(Node& nextChild, Node& oldChild); 237 void insertBeforeCommon(Node& nextChild, Node& oldChild);
238 void appendChildCommon(Node& child); 238 void appendChildCommon(Node& child);
(...skipping 15 matching lines...) Expand all
254 254
255 inline bool checkAcceptChildGuaranteedNodeTypes(const Node& newChild, const Node* oldChild, ExceptionState&) const; 255 inline bool checkAcceptChildGuaranteedNodeTypes(const Node& newChild, const Node* oldChild, ExceptionState&) const;
256 inline bool checkAcceptChild(const Node* newChild, const Node* oldChild, Exc eptionState&) const; 256 inline bool checkAcceptChild(const Node* newChild, const Node* oldChild, Exc eptionState&) const;
257 inline bool checkParserAcceptChild(const Node& newChild) const; 257 inline bool checkParserAcceptChild(const Node& newChild) const;
258 inline bool containsConsideringHostElements(const Node&) const; 258 inline bool containsConsideringHostElements(const Node&) const;
259 inline bool isChildTypeAllowed(const Node& child) const; 259 inline bool isChildTypeAllowed(const Node& child) const;
260 260
261 bool getUpperLeftCorner(FloatPoint&) const; 261 bool getUpperLeftCorner(FloatPoint&) const;
262 bool getLowerRightCorner(FloatPoint&) const; 262 bool getLowerRightCorner(FloatPoint&) const;
263 263
264 RawPtrWillBeMember<Node> m_firstChild; 264 Member<Node> m_firstChild;
265 RawPtrWillBeMember<Node> m_lastChild; 265 Member<Node> m_lastChild;
266 }; 266 };
267 267
268 #if ENABLE(ASSERT) 268 #if ENABLE(ASSERT)
269 bool childAttachedAllowedWhenAttachingChildren(ContainerNode*); 269 bool childAttachedAllowedWhenAttachingChildren(ContainerNode*);
270 #endif 270 #endif
271 271
272 WILL_NOT_BE_EAGERLY_TRACED_CLASS(ContainerNode); 272 WILL_NOT_BE_EAGERLY_TRACED_CLASS(ContainerNode);
273 273
274 DEFINE_NODE_TYPE_CASTS(ContainerNode, isContainerNode()); 274 DEFINE_NODE_TYPE_CASTS(ContainerNode, isContainerNode());
275 275
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 inline void getChildNodes(ContainerNode& node, NodeVector& nodes) 338 inline void getChildNodes(ContainerNode& node, NodeVector& nodes)
339 { 339 {
340 ASSERT(!nodes.size()); 340 ASSERT(!nodes.size());
341 for (Node* child = node.firstChild(); child; child = child->nextSibling()) 341 for (Node* child = node.firstChild(); child; child = child->nextSibling())
342 nodes.append(child); 342 nodes.append(child);
343 } 343 }
344 344
345 } // namespace blink 345 } // namespace blink
346 346
347 #endif // ContainerNode_h 347 #endif // ContainerNode_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Comment.cpp ('k') | third_party/WebKit/Source/core/dom/ContainerNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698