| 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, 2009, 2010, 2011 Apple Inc. All rights
reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 // -------------------------------------------------------------------------
---- | 184 // -------------------------------------------------------------------------
---- |
| 185 // Notification of document structure changes (see core/dom/Node.h for more
notification methods) | 185 // Notification of document structure changes (see core/dom/Node.h for more
notification methods) |
| 186 | 186 |
| 187 // Notifies the node that it's list of children have changed (either by addi
ng or removing child nodes), or a child | 187 // Notifies the node that it's list of children have changed (either by addi
ng or removing child nodes), or a child |
| 188 // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE ha
s changed its value. | 188 // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE ha
s changed its value. |
| 189 virtual void childrenChanged(bool createdByParser = false, Node* beforeChang
e = 0, Node* afterChange = 0, int childCountDelta = 0); | 189 virtual void childrenChanged(bool createdByParser = false, Node* beforeChang
e = 0, Node* afterChange = 0, int childCountDelta = 0); |
| 190 | 190 |
| 191 void disconnectDescendantFrames(); | 191 void disconnectDescendantFrames(); |
| 192 | 192 |
| 193 virtual void trace(Visitor*) OVERRIDE; |
| 194 |
| 193 protected: | 195 protected: |
| 194 ContainerNode(TreeScope*, ConstructionType = CreateContainer); | 196 ContainerNode(TreeScope*, ConstructionType = CreateContainer); |
| 195 | 197 |
| 196 template<class GenericNode, class GenericNodeContainer> | 198 template<class GenericNode, class GenericNodeContainer> |
| 197 friend void appendChildToContainer(GenericNode& child, GenericNodeContainer&
); | 199 friend void appendChildToContainer(GenericNode& child, GenericNodeContainer&
); |
| 198 | 200 |
| 199 template<class GenericNode, class GenericNodeContainer> | 201 template<class GenericNode, class GenericNodeContainer> |
| 200 friend void Private::addChildNodesToDeletionQueue(GenericNode*& head, Generi
cNode*& tail, GenericNodeContainer&); | 202 friend void Private::addChildNodesToDeletionQueue(GenericNode*& head, Generi
cNode*& tail, GenericNodeContainer&); |
| 201 | 203 |
| 204 template<class GenericNode, class GenericNodeContainer> |
| 205 friend void removeDetachedChildrenInContainer(GenericNodeContainer&); |
| 206 |
| 207 #if !ENABLE(OILPAN) |
| 202 void removeDetachedChildren(); | 208 void removeDetachedChildren(); |
| 209 #endif |
| 210 |
| 203 void setFirstChild(Node* child) { m_firstChild = child; } | 211 void setFirstChild(Node* child) { m_firstChild = child; } |
| 204 void setLastChild(Node* child) { m_lastChild = child; } | 212 void setLastChild(Node* child) { m_lastChild = child; } |
| 205 | 213 |
| 206 private: | 214 private: |
| 207 void removeBetween(Node* previousChild, Node* nextChild, Node& oldChild); | 215 void removeBetween(Node* previousChild, Node* nextChild, Node& oldChild); |
| 208 void insertBeforeCommon(Node& nextChild, Node& oldChild); | 216 void insertBeforeCommon(Node& nextChild, Node& oldChild); |
| 209 void updateTreeAfterInsertion(Node& child); | 217 void updateTreeAfterInsertion(Node& child); |
| 210 void willRemoveChildren(); | 218 void willRemoveChildren(); |
| 211 void willRemoveChild(Node& child); | 219 void willRemoveChild(Node& child); |
| 212 | 220 |
| 213 bool hasRestyleFlag(DynamicRestyleFlags mask) const { return hasRareData() &
& hasRestyleFlagInternal(mask); } | 221 bool hasRestyleFlag(DynamicRestyleFlags mask) const { return hasRareData() &
& hasRestyleFlagInternal(mask); } |
| 214 bool hasRestyleFlags() const { return hasRareData() && hasRestyleFlagsIntern
al(); } | 222 bool hasRestyleFlags() const { return hasRareData() && hasRestyleFlagsIntern
al(); } |
| 215 void setRestyleFlag(DynamicRestyleFlags); | 223 void setRestyleFlag(DynamicRestyleFlags); |
| 216 bool hasRestyleFlagInternal(DynamicRestyleFlags) const; | 224 bool hasRestyleFlagInternal(DynamicRestyleFlags) const; |
| 217 bool hasRestyleFlagsInternal() const; | 225 bool hasRestyleFlagsInternal() const; |
| 218 | 226 |
| 219 inline bool checkAcceptChildGuaranteedNodeTypes(const Node& newChild, Except
ionState&) const; | 227 inline bool checkAcceptChildGuaranteedNodeTypes(const Node& newChild, Except
ionState&) const; |
| 220 inline bool checkAcceptChild(const Node* newChild, const Node* oldChild, Exc
eptionState&) const; | 228 inline bool checkAcceptChild(const Node* newChild, const Node* oldChild, Exc
eptionState&) const; |
| 221 inline bool containsConsideringHostElements(const Node&) const; | 229 inline bool containsConsideringHostElements(const Node&) const; |
| 222 inline bool isChildTypeAllowed(const Node& child) const; | 230 inline bool isChildTypeAllowed(const Node& child) const; |
| 223 | 231 |
| 224 void attachChildren(const AttachContext& = AttachContext()); | 232 void attachChildren(const AttachContext& = AttachContext()); |
| 225 void detachChildren(const AttachContext& = AttachContext()); | 233 void detachChildren(const AttachContext& = AttachContext()); |
| 226 | 234 |
| 227 bool getUpperLeftCorner(FloatPoint&) const; | 235 bool getUpperLeftCorner(FloatPoint&) const; |
| 228 bool getLowerRightCorner(FloatPoint&) const; | 236 bool getLowerRightCorner(FloatPoint&) const; |
| 229 | 237 |
| 230 Node* m_firstChild; | 238 RawPtrWillBeMember<Node> m_firstChild; |
| 231 Node* m_lastChild; | 239 RawPtrWillBeMember<Node> m_lastChild; |
| 232 }; | 240 }; |
| 233 | 241 |
| 234 #ifndef NDEBUG | 242 #ifndef NDEBUG |
| 235 bool childAttachedAllowedWhenAttachingChildren(ContainerNode*); | 243 bool childAttachedAllowedWhenAttachingChildren(ContainerNode*); |
| 236 #endif | 244 #endif |
| 237 | 245 |
| 238 DEFINE_NODE_TYPE_CASTS(ContainerNode, isContainerNode()); | 246 DEFINE_NODE_TYPE_CASTS(ContainerNode, isContainerNode()); |
| 239 | 247 |
| 240 inline bool ContainerNode::hasChildCount(unsigned count) const | 248 inline bool ContainerNode::hasChildCount(unsigned count) const |
| 241 { | 249 { |
| 242 Node* child = m_firstChild; | 250 Node* child = m_firstChild; |
| 243 while (count && child) { | 251 while (count && child) { |
| 244 child = child->nextSibling(); | 252 child = child->nextSibling(); |
| 245 --count; | 253 --count; |
| 246 } | 254 } |
| 247 return !count && !child; | 255 return !count && !child; |
| 248 } | 256 } |
| 249 | 257 |
| 250 inline ContainerNode::ContainerNode(TreeScope* treeScope, ConstructionType type) | 258 inline ContainerNode::ContainerNode(TreeScope* treeScope, ConstructionType type) |
| 251 : Node(treeScope, type) | 259 : Node(treeScope, type) |
| 252 , m_firstChild(0) | 260 , m_firstChild(nullptr) |
| 253 , m_lastChild(0) | 261 , m_lastChild(nullptr) |
| 254 { | 262 { |
| 255 } | 263 } |
| 256 | 264 |
| 257 inline void ContainerNode::attachChildren(const AttachContext& context) | 265 inline void ContainerNode::attachChildren(const AttachContext& context) |
| 258 { | 266 { |
| 259 AttachContext childrenContext(context); | 267 AttachContext childrenContext(context); |
| 260 childrenContext.resolvedStyle = 0; | 268 childrenContext.resolvedStyle = 0; |
| 261 | 269 |
| 262 for (Node* child = firstChild(); child; child = child->nextSibling()) { | 270 for (Node* child = firstChild(); child; child = child->nextSibling()) { |
| 263 ASSERT(child->needsAttach() || childAttachedAllowedWhenAttachingChildren
(this)); | 271 ASSERT(child->needsAttach() || childAttachedAllowedWhenAttachingChildren
(this)); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 | 400 |
| 393 RefPtr<Node> m_currentNode; | 401 RefPtr<Node> m_currentNode; |
| 394 unsigned m_currentIndex; | 402 unsigned m_currentIndex; |
| 395 OwnPtr<Vector<RefPtr<Node> > > m_childNodes; // Lazily instantiated. | 403 OwnPtr<Vector<RefPtr<Node> > > m_childNodes; // Lazily instantiated. |
| 396 ChildNodesLazySnapshot* m_nextSnapshot; | 404 ChildNodesLazySnapshot* m_nextSnapshot; |
| 397 }; | 405 }; |
| 398 | 406 |
| 399 } // namespace WebCore | 407 } // namespace WebCore |
| 400 | 408 |
| 401 #endif // ContainerNode_h | 409 #endif // ContainerNode_h |
| OLD | NEW |