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

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, 10 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 byParser 194 byParser
195 }; 195 };
196 return change; 196 return change;
197 } 197 }
198 198
199 bool isChildInsertion() const { return type == ElementInserted || type = = NonElementInserted; } 199 bool isChildInsertion() const { return type == ElementInserted || type = = NonElementInserted; }
200 bool isChildRemoval() const { return type == ElementRemoved || type == N onElementRemoved; } 200 bool isChildRemoval() const { return type == ElementRemoved || type == N onElementRemoved; }
201 bool isChildElementChange() const { return type == ElementInserted || ty pe == ElementRemoved; } 201 bool isChildElementChange() const { return type == ElementInserted || ty pe == ElementRemoved; }
202 202
203 ChildrenChangeType type; 203 ChildrenChangeType type;
204 RawPtrWillBeMember<Node> siblingBeforeChange; 204 Member<Node> siblingBeforeChange;
205 RawPtrWillBeMember<Node> siblingAfterChange; 205 Member<Node> siblingAfterChange;
206 ChildrenChangeSource byParser; 206 ChildrenChangeSource byParser;
207 }; 207 };
208 208
209 // Notifies the node that it's list of children have changed (either by addi ng or removing child nodes), or a child 209 // Notifies the node that it's list of children have changed (either by addi ng or removing child nodes), or a child
210 // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE ha s changed its value. 210 // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE ha s changed its value.
211 virtual void childrenChanged(const ChildrenChange&); 211 virtual void childrenChanged(const ChildrenChange&);
212 212
213 DECLARE_VIRTUAL_TRACE(); 213 DECLARE_VIRTUAL_TRACE();
214 214
215 protected: 215 protected:
216 ContainerNode(TreeScope*, ConstructionType = CreateContainer); 216 ContainerNode(TreeScope*, ConstructionType = CreateContainer);
217 217
218 void invalidateNodeListCachesInAncestors(const QualifiedName* attrName = nul lptr, Element* attributeOwnerElement = nullptr); 218 void invalidateNodeListCachesInAncestors(const QualifiedName* attrName = nul lptr, Element* attributeOwnerElement = nullptr);
219 219
220 #if !ENABLE(OILPAN) 220 #if !ENABLE(OILPAN)
221 void removeDetachedChildren(); 221 void removeDetachedChildren();
222 #endif 222 #endif
223 223
224 void setFirstChild(Node* child) { m_firstChild = child; } 224 void setFirstChild(Node* child) { m_firstChild = child; }
225 void setLastChild(Node* child) { m_lastChild = child; } 225 void setLastChild(Node* child) { m_lastChild = child; }
226 226
227 // Utility functions for NodeListsNodeData API. 227 // Utility functions for NodeListsNodeData API.
228 template <typename Collection> PassRefPtrWillBeRawPtr<Collection> ensureCach edCollection(CollectionType); 228 template <typename Collection> RawPtr<Collection> ensureCachedCollection(Col lectionType);
229 template <typename Collection> PassRefPtrWillBeRawPtr<Collection> ensureCach edCollection(CollectionType, const AtomicString& name); 229 template <typename Collection> RawPtr<Collection> ensureCachedCollection(Col lectionType, const AtomicString& name);
230 template <typename Collection> PassRefPtrWillBeRawPtr<Collection> ensureCach edCollection(CollectionType, const AtomicString& namespaceURI, const AtomicStrin g& localName); 230 template <typename Collection> RawPtr<Collection> ensureCachedCollection(Col lectionType, const AtomicString& namespaceURI, const AtomicString& localName);
231 template <typename Collection> Collection* cachedCollection(CollectionType); 231 template <typename Collection> Collection* cachedCollection(CollectionType);
232 232
233 private: 233 private:
234 bool isContainerNode() const = delete; // This will catch anyone doing an un necessary check. 234 bool isContainerNode() const = delete; // This will catch anyone doing an un necessary check.
235 bool isTextNode() const = delete; // This will catch anyone doing an unneces sary check. 235 bool isTextNode() const = delete; // This will catch anyone doing an unneces sary check.
236 236
237 NodeListsNodeData& ensureNodeLists(); 237 NodeListsNodeData& ensureNodeLists();
238 void removeBetween(Node* previousChild, Node* nextChild, Node& oldChild); 238 void removeBetween(Node* previousChild, Node* nextChild, Node& oldChild);
239 void insertBeforeCommon(Node& nextChild, Node& oldChild); 239 void insertBeforeCommon(Node& nextChild, Node& oldChild);
240 void appendChildCommon(Node& child); 240 void appendChildCommon(Node& child);
(...skipping 18 matching lines...) Expand all
259 inline bool checkParserAcceptChild(const Node& newChild) const; 259 inline bool checkParserAcceptChild(const Node& newChild) const;
260 inline bool containsConsideringHostElements(const Node&) const; 260 inline bool containsConsideringHostElements(const Node&) const;
261 inline bool isChildTypeAllowed(const Node& child) const; 261 inline bool isChildTypeAllowed(const Node& child) const;
262 262
263 void attachChildren(const AttachContext& = AttachContext()); 263 void attachChildren(const AttachContext& = AttachContext());
264 void detachChildren(const AttachContext& = AttachContext()); 264 void detachChildren(const AttachContext& = AttachContext());
265 265
266 bool getUpperLeftCorner(FloatPoint&) const; 266 bool getUpperLeftCorner(FloatPoint&) const;
267 bool getLowerRightCorner(FloatPoint&) const; 267 bool getLowerRightCorner(FloatPoint&) const;
268 268
269 RawPtrWillBeMember<Node> m_firstChild; 269 Member<Node> m_firstChild;
270 RawPtrWillBeMember<Node> m_lastChild; 270 Member<Node> m_lastChild;
271 }; 271 };
272 272
273 #if ENABLE(ASSERT) 273 #if ENABLE(ASSERT)
274 bool childAttachedAllowedWhenAttachingChildren(ContainerNode*); 274 bool childAttachedAllowedWhenAttachingChildren(ContainerNode*);
275 #endif 275 #endif
276 276
277 WILL_NOT_BE_EAGERLY_TRACED_CLASS(ContainerNode); 277 WILL_NOT_BE_EAGERLY_TRACED_CLASS(ContainerNode);
278 278
279 DEFINE_NODE_TYPE_CASTS(ContainerNode, isContainerNode()); 279 DEFINE_NODE_TYPE_CASTS(ContainerNode, isContainerNode());
280 280
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 inline void getChildNodes(ContainerNode& node, NodeVector& nodes) 343 inline void getChildNodes(ContainerNode& node, NodeVector& nodes)
344 { 344 {
345 ASSERT(!nodes.size()); 345 ASSERT(!nodes.size());
346 for (Node* child = node.firstChild(); child; child = child->nextSibling()) 346 for (Node* child = node.firstChild(); child; child = child->nextSibling())
347 nodes.append(child); 347 nodes.append(child);
348 } 348 }
349 349
350 } // namespace blink 350 } // namespace blink
351 351
352 #endif // ContainerNode_h 352 #endif // ContainerNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698