| 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, 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 return toContainerNode(this)->firstChild(); | 288 return toContainerNode(this)->firstChild(); |
| 289 } | 289 } |
| 290 | 290 |
| 291 inline Node* Node::lastChild() const | 291 inline Node* Node::lastChild() const |
| 292 { | 292 { |
| 293 if (!isContainerNode()) | 293 if (!isContainerNode()) |
| 294 return 0; | 294 return 0; |
| 295 return toContainerNode(this)->lastChild(); | 295 return toContainerNode(this)->lastChild(); |
| 296 } | 296 } |
| 297 | 297 |
| 298 inline Node& Node::highestAncestorOrSelf() const | |
| 299 { | |
| 300 Node* node = const_cast<Node*>(this); | |
| 301 Node* highest = node; | |
| 302 for (; node; node = node->parentNode()) | |
| 303 highest = node; | |
| 304 return *highest; | |
| 305 } | |
| 306 | |
| 307 inline ContainerNode* Node::parentElementOrShadowRoot() const | 298 inline ContainerNode* Node::parentElementOrShadowRoot() const |
| 308 { | 299 { |
| 309 ContainerNode* parent = parentNode(); | 300 ContainerNode* parent = parentNode(); |
| 310 return parent && (parent->isElementNode() || parent->isShadowRoot()) ? paren
t : 0; | 301 return parent && (parent->isElementNode() || parent->isShadowRoot()) ? paren
t : 0; |
| 311 } | 302 } |
| 312 | 303 |
| 313 inline ContainerNode* Node::parentElementOrDocumentFragment() const | 304 inline ContainerNode* Node::parentElementOrDocumentFragment() const |
| 314 { | 305 { |
| 315 ContainerNode* parent = parentNode(); | 306 ContainerNode* parent = parentNode(); |
| 316 return parent && (parent->isElementNode() || parent->isDocumentFragment()) ?
parent : 0; | 307 return parent && (parent->isElementNode() || parent->isDocumentFragment()) ?
parent : 0; |
| 317 } | 308 } |
| 318 | 309 |
| 319 inline bool Node::isTreeScope() const | 310 inline bool Node::isTreeScope() const |
| 320 { | 311 { |
| 321 return &treeScope().rootNode() == this; | 312 return &treeScope().rootNode() == this; |
| 322 } | 313 } |
| 323 | 314 |
| 324 inline void getChildNodes(Node& node, NodeVector& nodes) | 315 inline void getChildNodes(Node& node, NodeVector& nodes) |
| 325 { | 316 { |
| 326 ASSERT(!nodes.size()); | 317 ASSERT(!nodes.size()); |
| 327 for (Node* child = node.firstChild(); child; child = child->nextSibling()) | 318 for (Node* child = node.firstChild(); child; child = child->nextSibling()) |
| 328 nodes.append(child); | 319 nodes.append(child); |
| 329 } | 320 } |
| 330 | 321 |
| 331 } // namespace blink | 322 } // namespace blink |
| 332 | 323 |
| 333 #endif // ContainerNode_h | 324 #endif // ContainerNode_h |
| OLD | NEW |