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

Unified Diff: Source/core/html/HTMLMediaElement.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/HTMLDetailsElement.cpp ('k') | Source/core/html/HTMLObjectElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index 01c2c705f5f2d5f91c08dee88c114d52648dc9dc..201cabf017411aaa59d7dd2353778be8a6d57a41 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -464,8 +464,8 @@ void HTMLMediaElement::finishParsingChildren()
if (!RuntimeEnabledFeatures::videoTrackEnabled())
return;
- for (Node* node = firstChild(); node; node = node->nextSibling()) {
- if (node->hasTagName(trackTag)) {
+ for (Element* child = ElementTraversal::firstWithin(*this); child; child = ElementTraversal::nextSibling(*child)) {
+ if (child->hasTagName(trackTag)) {
scheduleDelayedAction(LoadTextTrackResource);
break;
}
@@ -740,18 +740,18 @@ void HTMLMediaElement::selectMediaResource()
// 3 - If the media element has a src attribute, then let mode be attribute.
Mode mode = attribute;
if (!fastHasAttribute(srcAttr)) {
- Node* node;
- for (node = firstChild(); node; node = node->nextSibling()) {
- if (node->hasTagName(sourceTag))
+ Element* element;
+ for (element = ElementTraversal::firstWithin(*this); element; element = ElementTraversal::nextSibling(*element)) {
+ if (element->hasTagName(sourceTag))
break;
}
// Otherwise, if the media element does not have a src attribute but has a source
// element child, then let mode be children and let candidate be the first such
// source element child in tree order.
- if (node) {
+ if (element) {
mode = children;
- m_nextChildNodeToConsider = node;
+ m_nextChildNodeToConsider = element;
m_currentSourceNode = 0;
} else {
// Otherwise the media element has neither a src attribute nor a source element
@@ -1190,10 +1190,10 @@ void HTMLMediaElement::textTrackModeChanged(TextTrack* track)
// or showing by default for the first time, the user agent must immediately and synchronously
// run the following algorithm ...
- for (Node* node = firstChild(); node; node = node->nextSibling()) {
- if (!node->hasTagName(trackTag))
+ for (Element* child = ElementTraversal::firstWithin(*this); child; child = ElementTraversal::nextSibling(*child)) {
+ if (!child->hasTagName(trackTag))
continue;
- HTMLTrackElement* trackElement = toHTMLTrackElement(node);
+ HTMLTrackElement* trackElement = toHTMLTrackElement(child);
if (trackElement->track() != track)
continue;
@@ -1422,9 +1422,9 @@ void HTMLMediaElement::cancelPendingEventsAndCallbacks()
WTF_LOG(Media, "HTMLMediaElement::cancelPendingEventsAndCallbacks");
m_asyncEventQueue->cancelAllEvents();
- for (Node* node = firstChild(); node; node = node->nextSibling()) {
- if (node->hasTagName(sourceTag))
- toHTMLSourceElement(node)->cancelPendingErrorEvent();
+ for (Element* child = ElementTraversal::firstWithin(*this); child; child = ElementTraversal::nextSibling(*child)) {
+ if (child->hasTagName(sourceTag))
+ toHTMLSourceElement(child)->cancelPendingErrorEvent();
}
}
« no previous file with comments | « Source/core/html/HTMLDetailsElement.cpp ('k') | Source/core/html/HTMLObjectElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698