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; |
} |