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

Unified Diff: Source/core/html/HTMLTableSectionElement.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/HTMLTableRowElement.cpp ('k') | Source/core/html/track/LoadableTextTrack.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLTableSectionElement.cpp
diff --git a/Source/core/html/HTMLTableSectionElement.cpp b/Source/core/html/HTMLTableSectionElement.cpp
index bf796d6ef31bfb3c654b4259965ecba9034fe4da..31a0f3ee7dbfcf68f3ae766b237d619fa5dd159b 100644
--- a/Source/core/html/HTMLTableSectionElement.cpp
+++ b/Source/core/html/HTMLTableSectionElement.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/HTMLTableElement.h"
@@ -95,15 +96,12 @@ void HTMLTableSectionElement::deleteRow(int index, ExceptionState& exceptionStat
int HTMLTableSectionElement::numRows() const
{
- int rows = 0;
- const Node *n = firstChild();
- while (n) {
- if (n->hasTagName(trTag))
- rows++;
- n = n->nextSibling();
+ int rowCount = 0;
+ for (const Element* child = ElementTraversal::firstWithin(*this); child; child = ElementTraversal::nextSibling(*child)) {
+ if (child->hasTagName(trTag))
+ ++rowCount;
}
-
- return rows;
+ return rowCount;
}
PassRefPtr<HTMLCollection> HTMLTableSectionElement::rows()
« no previous file with comments | « Source/core/html/HTMLTableRowElement.cpp ('k') | Source/core/html/track/LoadableTextTrack.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698