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

Unified Diff: Source/core/html/track/LoadableTextTrack.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/HTMLTableSectionElement.cpp ('k') | Source/core/rendering/svg/ReferenceFilterBuilder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/track/LoadableTextTrack.cpp
diff --git a/Source/core/html/track/LoadableTextTrack.cpp b/Source/core/html/track/LoadableTextTrack.cpp
index 012b3608c71f8c887745335080b6d677ed6aa998..6089405b11b64c1062b53b28449f2a5073e337d7 100644
--- a/Source/core/html/track/LoadableTextTrack.cpp
+++ b/Source/core/html/track/LoadableTextTrack.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "core/html/track/LoadableTextTrack.h"
+#include "core/dom/ElementTraversal.h"
#include "core/html/HTMLTrackElement.h"
#include "core/html/track/TextTrackCueList.h"
#include "core/html/track/vtt/VTTRegionList.h"
@@ -143,10 +144,10 @@ size_t LoadableTextTrack::trackElementIndex()
ASSERT(m_trackElement->parentNode());
size_t index = 0;
- for (Node* node = m_trackElement->parentNode()->firstChild(); node; node = node->nextSibling()) {
- if (!node->hasTagName(trackTag) || !node->parentNode())
+ for (Element* child = ElementTraversal::firstWithin(*m_trackElement->parentNode()); child; child = ElementTraversal::nextSibling(*child)) {
+ if (!child->hasTagName(trackTag) || !child->parentNode())
continue;
- if (node == m_trackElement)
+ if (child == m_trackElement)
return index;
++index;
}
« no previous file with comments | « Source/core/html/HTMLTableSectionElement.cpp ('k') | Source/core/rendering/svg/ReferenceFilterBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698