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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
236 return toContainerNode(this)->firstChild(); | 236 return toContainerNode(this)->firstChild(); |
237 } | 237 } |
238 | 238 |
239 inline Node* Node::lastChild() const | 239 inline Node* Node::lastChild() const |
240 { | 240 { |
241 if (!isContainerNode()) | 241 if (!isContainerNode()) |
242 return 0; | 242 return 0; |
243 return toContainerNode(this)->lastChild(); | 243 return toContainerNode(this)->lastChild(); |
244 } | 244 } |
245 | 245 |
246 inline Node* Node::highestAncestor() const | 246 inline Node& Node::highestAncestor() const |
247 { | 247 { |
248 Node* node = const_cast<Node*>(this); | 248 Node* node = const_cast<Node*>(this); |
249 Node* highest = node; | 249 Node* highest = node; |
250 for (; node; node = node->parentNode()) | 250 for (; node; node = node->parentNode()) |
251 highest = node; | 251 highest = node; |
252 return highest; | 252 ASSERT(highest); |
adamk
2014/02/26 20:37:23
This ASSERT is basically checking that the for loo
Inactive
2014/02/26 21:00:01
Done.
| |
253 return *highest; | |
253 } | 254 } |
254 | 255 |
255 inline Node* Node::parentElementOrShadowRoot() const | 256 inline Node* Node::parentElementOrShadowRoot() const |
256 { | 257 { |
257 ContainerNode* parent = parentNode(); | 258 ContainerNode* parent = parentNode(); |
258 return parent && (parent->isElementNode() || parent->isShadowRoot()) ? paren t : 0; | 259 return parent && (parent->isElementNode() || parent->isShadowRoot()) ? paren t : 0; |
259 } | 260 } |
260 | 261 |
261 // This constant controls how much buffer is initially allocated | 262 // This constant controls how much buffer is initially allocated |
262 // for a Node Vector that is used to store child Nodes of a given Node. | 263 // for a Node Vector that is used to store child Nodes of a given Node. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
332 | 333 |
333 RefPtr<Node> m_currentNode; | 334 RefPtr<Node> m_currentNode; |
334 unsigned m_currentIndex; | 335 unsigned m_currentIndex; |
335 OwnPtr<Vector<RefPtr<Node> > > m_childNodes; // Lazily instantiated. | 336 OwnPtr<Vector<RefPtr<Node> > > m_childNodes; // Lazily instantiated. |
336 ChildNodesLazySnapshot* m_nextSnapshot; | 337 ChildNodesLazySnapshot* m_nextSnapshot; |
337 }; | 338 }; |
338 | 339 |
339 } // namespace WebCore | 340 } // namespace WebCore |
340 | 341 |
341 #endif // ContainerNode_h | 342 #endif // ContainerNode_h |
OLD | NEW |