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

Side by Side Diff: Source/core/dom/Node.cpp

Issue 420323002: Move Node::lastDescendantOrSelf() to NodeTraversal and rename to lastWithinOrSelf() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/dom/NodeTraversal.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 // By default, setting nodeValue has no effect. 400 // By default, setting nodeValue has no effect.
401 } 401 }
402 402
403 PassRefPtrWillBeRawPtr<NodeList> Node::childNodes() 403 PassRefPtrWillBeRawPtr<NodeList> Node::childNodes()
404 { 404 {
405 if (isContainerNode()) 405 if (isContainerNode())
406 return ensureRareData().ensureNodeLists().ensureChildNodeList(toContaine rNode(*this)); 406 return ensureRareData().ensureNodeLists().ensureChildNodeList(toContaine rNode(*this));
407 return ensureRareData().ensureNodeLists().ensureEmptyChildNodeList(*this); 407 return ensureRareData().ensureNodeLists().ensureEmptyChildNodeList(*this);
408 } 408 }
409 409
410 Node& Node::lastDescendantOrSelf() const
411 {
412 Node* n = const_cast<Node*>(this);
413 while (n && n->lastChild())
414 n = n->lastChild();
415 ASSERT(n);
416 return *n;
417 }
418
419 Node* Node::pseudoAwarePreviousSibling() const 410 Node* Node::pseudoAwarePreviousSibling() const
420 { 411 {
421 if (parentElement() && !previousSibling()) { 412 if (parentElement() && !previousSibling()) {
422 Element* parent = parentElement(); 413 Element* parent = parentElement();
423 if (isAfterPseudoElement() && parent->lastChild()) 414 if (isAfterPseudoElement() && parent->lastChild())
424 return parent->lastChild(); 415 return parent->lastChild();
425 if (!isBeforePseudoElement()) 416 if (!isBeforePseudoElement())
426 return parent->pseudoElement(BEFORE); 417 return parent->pseudoElement(BEFORE);
427 } 418 }
428 return previousSibling(); 419 return previousSibling();
(...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after
2550 node->showTreeForThis(); 2541 node->showTreeForThis();
2551 } 2542 }
2552 2543
2553 void showNodePath(const blink::Node* node) 2544 void showNodePath(const blink::Node* node)
2554 { 2545 {
2555 if (node) 2546 if (node)
2556 node->showNodePathForThis(); 2547 node->showNodePathForThis();
2557 } 2548 }
2558 2549
2559 #endif 2550 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/dom/NodeTraversal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698