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

Side by Side Diff: Source/core/dom/Element.h

Issue 166033005: Port Node's previousElementSibling() / nextElementSibling() to ElementTraversal (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 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
« no previous file with comments | « Source/core/css/SelectorChecker.cpp ('k') | Source/core/dom/Element.cpp » ('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 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013 Appl e Inc. All rights reserved. 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013 Appl e Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 { 693 {
694 return isElementNode() && toElement(this)->hasTagName(name); 694 return isElementNode() && toElement(this)->hasTagName(name);
695 } 695 }
696 696
697 inline Element* Node::parentElement() const 697 inline Element* Node::parentElement() const
698 { 698 {
699 ContainerNode* parent = parentNode(); 699 ContainerNode* parent = parentNode();
700 return parent && parent->isElementNode() ? toElement(parent) : 0; 700 return parent && parent->isElementNode() ? toElement(parent) : 0;
701 } 701 }
702 702
703 inline Element* Node::previousElementSibling() const
704 {
705 Node* n = previousSibling();
706 while (n && !n->isElementNode())
707 n = n->previousSibling();
708 return toElement(n);
709 }
710
711 inline Element* Node::nextElementSibling() const
712 {
713 Node* n = nextSibling();
714 while (n && !n->isElementNode())
715 n = n->nextSibling();
716 return toElement(n);
717 }
718
719 inline bool Element::fastHasAttribute(const QualifiedName& name) const 703 inline bool Element::fastHasAttribute(const QualifiedName& name) const
720 { 704 {
721 ASSERT(fastAttributeLookupAllowed(name)); 705 ASSERT(fastAttributeLookupAllowed(name));
722 return elementData() && getAttributeItem(name); 706 return elementData() && getAttributeItem(name);
723 } 707 }
724 708
725 inline const AtomicString& Element::fastGetAttribute(const QualifiedName& name) const 709 inline const AtomicString& Element::fastGetAttribute(const QualifiedName& name) const
726 { 710 {
727 ASSERT(fastAttributeLookupAllowed(name)); 711 ASSERT(fastAttributeLookupAllowed(name));
728 if (elementData()) { 712 if (elementData()) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 } 870 }
887 871
888 inline bool isShadowHost(const Element* element) 872 inline bool isShadowHost(const Element* element)
889 { 873 {
890 return element && element->shadow(); 874 return element && element->shadow();
891 } 875 }
892 876
893 } // namespace 877 } // namespace
894 878
895 #endif 879 #endif
OLDNEW
« no previous file with comments | « Source/core/css/SelectorChecker.cpp ('k') | Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698