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

Unified Diff: Source/core/html/HTMLTableRowElement.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/HTMLTableElement.cpp ('k') | Source/core/html/HTMLTableSectionElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLTableRowElement.cpp
diff --git a/Source/core/html/HTMLTableRowElement.cpp b/Source/core/html/HTMLTableRowElement.cpp
index c54defc902ea0f18e7e6af14a0c167f43026f63f..1452c0e19a44e87a00eb0f08059f2c6862f7111f 100644
--- a/Source/core/html/HTMLTableRowElement.cpp
+++ b/Source/core/html/HTMLTableRowElement.cpp
@@ -27,6 +27,7 @@
#include "HTMLNames.h"
#include "bindings/v8/ExceptionState.h"
+#include "core/dom/ElementTraversal.h"
#include "core/dom/ExceptionCode.h"
#include "core/html/HTMLCollection.h"
#include "core/html/HTMLTableCellElement.h"
@@ -65,7 +66,7 @@ int HTMLTableRowElement::rowIndex() const
int rIndex = 0;
if (HTMLTableSectionElement* head = toHTMLTableElement(table)->tHead()) {
- for (Node *row = head->firstChild(); row; row = row->nextSibling()) {
+ for (Element* row = ElementTraversal::firstWithin(*head); row; row = ElementTraversal::nextSibling(*row)) {
if (row == this)
return rIndex;
if (row->hasTagName(trTag))
@@ -73,10 +74,10 @@ int HTMLTableRowElement::rowIndex() const
}
}
- for (Node *node = table->firstChild(); node; node = node->nextSibling()) {
- if (node->hasTagName(tbodyTag)) {
- HTMLTableSectionElement* section = toHTMLTableSectionElement(node);
- for (Node* row = section->firstChild(); row; row = row->nextSibling()) {
+ for (Element* child = ElementTraversal::firstWithin(*table); child; child = ElementTraversal::nextSibling(*child)) {
+ if (child->hasTagName(tbodyTag)) {
+ HTMLTableSectionElement* section = toHTMLTableSectionElement(child);
+ for (Element* row = ElementTraversal::firstWithin(*section); row; row = ElementTraversal::nextSibling(*row)) {
if (row == this)
return rIndex;
if (row->hasTagName(trTag))
@@ -86,7 +87,7 @@ int HTMLTableRowElement::rowIndex() const
}
if (HTMLTableSectionElement* foot = toHTMLTableElement(table)->tFoot()) {
- for (Node *row = foot->firstChild(); row; row = row->nextSibling()) {
+ for (Element* row = ElementTraversal::firstWithin(*foot); row; row = ElementTraversal::nextSibling(*row)) {
if (row == this)
return rIndex;
if (row->hasTagName(trTag))
« no previous file with comments | « Source/core/html/HTMLTableElement.cpp ('k') | Source/core/html/HTMLTableSectionElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698