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

Side by Side Diff: Source/core/html/HTMLMediaElement.cpp

Issue 952493002: Simplify HTMLMediaElement::textTrackModeChanged (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 // The track readiness state might have changed as a result of the user 1144 // The track readiness state might have changed as a result of the user
1145 // clicking the captions button. In this case, a check whether all the 1145 // clicking the captions button. In this case, a check whether all the
1146 // resources have failed loading should be done in order to hide the CC button. 1146 // resources have failed loading should be done in order to hide the CC button.
1147 if (hasMediaControls() && track->readinessState() == TextTrack::FailedTo Load) 1147 if (hasMediaControls() && track->readinessState() == TextTrack::FailedTo Load)
1148 mediaControls()->refreshClosedCaptionsButtonVisibility(); 1148 mediaControls()->refreshClosedCaptionsButtonVisibility();
1149 } 1149 }
1150 } 1150 }
1151 1151
1152 void HTMLMediaElement::textTrackModeChanged(TextTrack* track) 1152 void HTMLMediaElement::textTrackModeChanged(TextTrack* track)
1153 { 1153 {
1154 if (track->trackType() == TextTrack::TrackElement) { 1154 // Mark this track as "configured" so configureTextTracks won't change the m ode again.
1155 // 4.8.10.12.3 Sourcing out-of-band text tracks 1155 if (track->trackType() == TextTrack::TrackElement)
1156 // ... when a text track corresponding to a track element is created wit h text track 1156 track->setHasBeenConfigured(true);
1157 // mode set to disabled and subsequently changes its text track mode to hidden, showing,
1158 // or showing by default for the first time, the user agent must immedia tely and synchronously
1159 // run the following algorithm ...
1160
1161 for (HTMLTrackElement* trackElement = Traversal<HTMLTrackElement>::first Child(*this); trackElement; trackElement = Traversal<HTMLTrackElement>::nextSibl ing(*trackElement)) {
1162 if (trackElement->track() != track)
1163 continue;
1164
1165 // Mark this track as "configured" so configureTextTracks won't chan ge the mode again.
1166 track->setHasBeenConfigured(true);
1167 if (track->mode() != TextTrack::disabledKeyword()) {
1168 if (trackElement->readyState() == HTMLTrackElement::LOADED)
1169 cueTimeline().addCues(track, track->cues());
1170
1171 // If this is the first added track, create the list of text tra cks.
philipj_slow 2015/02/25 15:52:14 Was this just dead code?
fs 2015/02/25 16:26:11 Yes. (This method was only called from within Text
1172 if (!m_textTracks)
1173 m_textTracks = TextTrackList::create(this);
1174 }
1175 break;
1176 }
1177 } else if (track->trackType() == TextTrack::AddTrack && track->mode() != Tex tTrack::disabledKeyword()) {
1178 cueTimeline().addCues(track, track->cues());
1179 }
1180 1157
1181 configureTextTrackDisplay(AssumeVisibleChange); 1158 configureTextTrackDisplay(AssumeVisibleChange);
1182 1159
1183 ASSERT(textTracks()->contains(track)); 1160 ASSERT(textTracks()->contains(track));
1184 textTracks()->scheduleChangeEvent(); 1161 textTracks()->scheduleChangeEvent();
1185 } 1162 }
1186 1163
1187 void HTMLMediaElement::textTrackKindChanged(TextTrack* track) 1164 void HTMLMediaElement::textTrackKindChanged(TextTrack* track)
1188 { 1165 {
1189 if (track->kind() != TextTrack::captionsKeyword() && track->kind() != TextTr ack::subtitlesKeyword() && track->mode() == TextTrack::showingKeyword()) 1166 if (track->kind() != TextTrack::captionsKeyword() && track->kind() != TextTr ack::subtitlesKeyword() && track->mode() == TextTrack::showingKeyword())
(...skipping 2442 matching lines...) Expand 10 before | Expand all | Expand 10 after
3632 3609
3633 #if ENABLE(WEB_AUDIO) 3610 #if ENABLE(WEB_AUDIO)
3634 void HTMLMediaElement::clearWeakMembers(Visitor* visitor) 3611 void HTMLMediaElement::clearWeakMembers(Visitor* visitor)
3635 { 3612 {
3636 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider()) 3613 if (!visitor->isAlive(m_audioSourceNode) && audioSourceProvider())
3637 audioSourceProvider()->setClient(nullptr); 3614 audioSourceProvider()->setClient(nullptr);
3638 } 3615 }
3639 #endif 3616 #endif
3640 3617
3641 } 3618 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/track/TextTrack.cpp » ('j') | Source/core/html/track/TextTrack.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698