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

Unified Diff: Source/core/html/HTMLTableElement.cpp

Issue 171663005: Consistently use ElementTraversal API when looking for an Element (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLObjectElement.cpp ('k') | Source/core/html/HTMLTableRowElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLTableElement.cpp
diff --git a/Source/core/html/HTMLTableElement.cpp b/Source/core/html/HTMLTableElement.cpp
index e1c901485d1c1a1b958ae9e4bae3e44f1f2a4438..1421cad5740e05d6afd4409ebb7fbf6490d1b3a9 100644
--- a/Source/core/html/HTMLTableElement.cpp
+++ b/Source/core/html/HTMLTableElement.cpp
@@ -65,7 +65,7 @@ PassRefPtr<HTMLTableElement> HTMLTableElement::create(Document& document)
HTMLTableCaptionElement* HTMLTableElement::caption() const
{
- for (Node* child = firstChild(); child; child = child->nextSibling()) {
+ for (Element* child = ElementTraversal::firstWithin(*this); child; child = ElementTraversal::nextSibling(*child)) {
if (child->hasTagName(captionTag))
return toHTMLTableCaptionElement(child);
}
@@ -80,7 +80,7 @@ void HTMLTableElement::setCaption(PassRefPtr<HTMLTableCaptionElement> newCaption
HTMLTableSectionElement* HTMLTableElement::tHead() const
{
- for (Node* child = firstChild(); child; child = child->nextSibling()) {
+ for (Element* child = ElementTraversal::firstWithin(*this); child; child = ElementTraversal::nextSibling(*child)) {
if (child->hasTagName(theadTag))
return toHTMLTableSectionElement(child);
}
@@ -91,17 +91,18 @@ void HTMLTableElement::setTHead(PassRefPtr<HTMLTableSectionElement> newHead, Exc
{
deleteTHead();
- Node* child;
- for (child = firstChild(); child; child = child->nextSibling())
- if (child->isElementNode() && !child->hasTagName(captionTag) && !child->hasTagName(colgroupTag))
+ Element* child;
+ for (child = ElementTraversal::firstWithin(*this); child; child = ElementTraversal::nextSibling(*child)) {
+ if (!child->hasTagName(captionTag) && !child->hasTagName(colgroupTag))
break;
+ }
insertBefore(newHead, child, exceptionState);
}
HTMLTableSectionElement* HTMLTableElement::tFoot() const
{
- for (Node* child = firstChild(); child; child = child->nextSibling()) {
+ for (Element* child = ElementTraversal::firstWithin(*this); child; child = ElementTraversal::nextSibling(*child)) {
if (child->hasTagName(tfootTag))
return toHTMLTableSectionElement(child);
}
@@ -112,10 +113,11 @@ void HTMLTableElement::setTFoot(PassRefPtr<HTMLTableSectionElement> newFoot, Exc
{
deleteTFoot();
- Node* child;
- for (child = firstChild(); child; child = child->nextSibling())
- if (child->isElementNode() && !child->hasTagName(captionTag) && !child->hasTagName(colgroupTag) && !child->hasTagName(theadTag))
+ Element* child;
+ for (child = ElementTraversal::firstWithin(*this); child; child = ElementTraversal::nextSibling(*child)) {
+ if (!child->hasTagName(captionTag) && !child->hasTagName(colgroupTag) && !child->hasTagName(theadTag))
break;
+ }
insertBefore(newFoot, child, exceptionState);
}
« no previous file with comments | « Source/core/html/HTMLObjectElement.cpp ('k') | Source/core/html/HTMLTableRowElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698