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

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

Issue 14056005: Added code to enable the first caption track if the user has requested captions and one such track … (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 8 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
« no previous file with comments | « LayoutTests/media/video-controls-captions-multiple-clicks-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 918 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 929
930 // 12 - Further sort tasks in events that have the same time by the 930 // 12 - Further sort tasks in events that have the same time by the
931 // relative text track cue order of the text track cues associated 931 // relative text track cue order of the text track cues associated
932 // with these tasks. 932 // with these tasks.
933 return a.second->cueIndex() - b.second->cueIndex() < 0; 933 return a.second->cueIndex() - b.second->cueIndex() < 0;
934 } 934 }
935 935
936 936
937 void HTMLMediaElement::updateActiveTextTrackCues(double movieTime) 937 void HTMLMediaElement::updateActiveTextTrackCues(double movieTime)
938 { 938 {
939 LOG(Media, "HTMLMediaElement::updateActiveTextTracks"); 939 LOG(Media, "HTMLMediaElement::updateActiveTextTrackCues");
940 940
941 // 4.8.10.8 Playing the media resource 941 // 4.8.10.8 Playing the media resource
942 942
943 // If the current playback position changes while the steps are running, 943 // If the current playback position changes while the steps are running,
944 // then the user agent must wait for the steps to complete, and then must 944 // then the user agent must wait for the steps to complete, and then must
945 // immediately rerun the steps. 945 // immediately rerun the steps.
946 if (ignoreTrackDisplayUpdateRequests()) 946 if (ignoreTrackDisplayUpdateRequests())
947 return; 947 return;
948 948
949 // 1 - Let current cues be a list of cues, initialized to contain all the 949 // 1 - Let current cues be a list of cues, initialized to contain all the
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 1145
1146 m_asyncEventQueue->enqueueEvent(event.release()); 1146 m_asyncEventQueue->enqueueEvent(event.release());
1147 1147
1148 // ... if the text track has a corresponding track element, to then fire a 1148 // ... if the text track has a corresponding track element, to then fire a
1149 // simple event named cuechange at the track element as well. 1149 // simple event named cuechange at the track element as well.
1150 if (affectedTracks[i]->trackType() == TextTrack::TrackElement) { 1150 if (affectedTracks[i]->trackType() == TextTrack::TrackElement) {
1151 RefPtr<Event> event = Event::create(eventNames().cuechangeEvent, fal se, false); 1151 RefPtr<Event> event = Event::create(eventNames().cuechangeEvent, fal se, false);
1152 HTMLTrackElement* trackElement = static_cast<LoadableTextTrack*>(aff ectedTracks[i])->trackElement(); 1152 HTMLTrackElement* trackElement = static_cast<LoadableTextTrack*>(aff ectedTracks[i])->trackElement();
1153 ASSERT(trackElement); 1153 ASSERT(trackElement);
1154 event->setTarget(trackElement); 1154 event->setTarget(trackElement);
1155 1155
1156 m_asyncEventQueue->enqueueEvent(event.release()); 1156 m_asyncEventQueue->enqueueEvent(event.release());
1157 } 1157 }
1158 } 1158 }
1159 1159
1160 // 16 - Set the text track cue active flag of all the cues in the current 1160 // 16 - Set the text track cue active flag of all the cues in the current
1161 // cues, and unset the text track cue active flag of all the cues in the 1161 // cues, and unset the text track cue active flag of all the cues in the
1162 // other cues. 1162 // other cues.
1163 for (size_t i = 0; i < currentCuesSize; ++i) 1163 for (size_t i = 0; i < currentCuesSize; ++i)
1164 currentCues[i].data()->setIsActive(true); 1164 currentCues[i].data()->setIsActive(true);
1165 1165
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 if (track->mode() != TextTrack::disabledKeyword()) { 1225 if (track->mode() != TextTrack::disabledKeyword()) {
1226 if (trackElement->readyState() == HTMLTrackElement::LOADED) 1226 if (trackElement->readyState() == HTMLTrackElement::LOADED)
1227 textTrackAddCues(track, track->cues()); 1227 textTrackAddCues(track, track->cues());
1228 1228
1229 // If this is the first added track, create the list of text tra cks. 1229 // If this is the first added track, create the list of text tra cks.
1230 if (!m_textTracks) 1230 if (!m_textTracks)
1231 m_textTracks = TextTrackList::create(this, ActiveDOMObject::sc riptExecutionContext()); 1231 m_textTracks = TextTrackList::create(this, ActiveDOMObject::sc riptExecutionContext());
1232 } 1232 }
1233 break; 1233 break;
1234 } 1234 }
1235 } 1235 } else if (track->trackType() == TextTrack::AddTrack && track->mode() != Tex tTrack::disabledKeyword())
1236 textTrackAddCues(track, track->cues());
1236 1237
1237 #if USE(PLATFORM_TEXT_TRACK_MENU) 1238 #if USE(PLATFORM_TEXT_TRACK_MENU)
1238 if (platformTextTrackMenu()) 1239 if (platformTextTrackMenu())
1239 platformTextTrackMenu()->trackWasSelected(track->platformTextTrack()); 1240 platformTextTrackMenu()->trackWasSelected(track->platformTextTrack());
1240 #endif 1241 #endif
1241 1242
1242 configureTextTrackDisplay(); 1243 configureTextTrackDisplay();
1243 updateActiveTextTrackCues(currentTime()); 1244 updateActiveTextTrackCues(currentTime());
1244 } 1245 }
1245 1246
1246 void HTMLMediaElement::textTrackKindChanged(TextTrack* track) 1247 void HTMLMediaElement::textTrackKindChanged(TextTrack* track)
1247 { 1248 {
1248 if (track->kind() != TextTrack::captionsKeyword() && track->kind() != TextTr ack::subtitlesKeyword() && track->mode() == TextTrack::showingKeyword()) 1249 if (track->kind() != TextTrack::captionsKeyword() && track->kind() != TextTr ack::subtitlesKeyword() && track->mode() == TextTrack::showingKeyword())
1249 track->setMode(TextTrack::hiddenKeyword()); 1250 track->setMode(TextTrack::hiddenKeyword());
1250 } 1251 }
1251 1252
1252 void HTMLMediaElement::beginIgnoringTrackDisplayUpdateRequests() 1253 void HTMLMediaElement::beginIgnoringTrackDisplayUpdateRequests()
1253 { 1254 {
1254 ++m_ignoreTrackDisplayUpdate; 1255 ++m_ignoreTrackDisplayUpdate;
1255 } 1256 }
1256 1257
1257 void HTMLMediaElement::endIgnoringTrackDisplayUpdateRequests() 1258 void HTMLMediaElement::endIgnoringTrackDisplayUpdateRequests()
1258 { 1259 {
1259 ASSERT(m_ignoreTrackDisplayUpdate); 1260 ASSERT(m_ignoreTrackDisplayUpdate);
1260 --m_ignoreTrackDisplayUpdate; 1261 --m_ignoreTrackDisplayUpdate;
1261 if (!m_ignoreTrackDisplayUpdate && m_inActiveDocument) 1262 if (!m_ignoreTrackDisplayUpdate && m_inActiveDocument)
1262 updateActiveTextTrackCues(currentTime()); 1263 updateActiveTextTrackCues(currentTime());
1263 } 1264 }
1264 1265
1265 void HTMLMediaElement::textTrackAddCues(TextTrack*, const TextTrackCueList* cues ) 1266 void HTMLMediaElement::textTrackAddCues(TextTrack*, const TextTrackCueList* cues )
1266 { 1267 {
1268 LOG(Media, "HTMLMediaElement::textTrackAddCues");
1269
1267 TrackDisplayUpdateScope scope(this); 1270 TrackDisplayUpdateScope scope(this);
1268 for (size_t i = 0; i < cues->length(); ++i) 1271 for (size_t i = 0; i < cues->length(); ++i)
1269 textTrackAddCue(cues->item(i)->track(), cues->item(i)); 1272 textTrackAddCue(cues->item(i)->track(), cues->item(i));
1270 } 1273 }
1271 1274
1272 void HTMLMediaElement::textTrackRemoveCues(TextTrack*, const TextTrackCueList* c ues) 1275 void HTMLMediaElement::textTrackRemoveCues(TextTrack*, const TextTrackCueList* c ues)
1273 { 1276 {
1277 LOG(Media, "HTMLMediaElement::textTrackRemoveCues");
1278
1274 TrackDisplayUpdateScope scope(this); 1279 TrackDisplayUpdateScope scope(this);
1275 for (size_t i = 0; i < cues->length(); ++i) 1280 for (size_t i = 0; i < cues->length(); ++i)
1276 textTrackRemoveCue(cues->item(i)->track(), cues->item(i)); 1281 textTrackRemoveCue(cues->item(i)->track(), cues->item(i));
1277 } 1282 }
1278 1283
1279 void HTMLMediaElement::textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue> cue) 1284 void HTMLMediaElement::textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue> cue)
1280 { 1285 {
1281 // Negative duration cues need be treated in the interval tree as 1286 // Negative duration cues need be treated in the interval tree as
1282 // zero-length cues. 1287 // zero-length cues.
1283 double endTime = max(cue->startTime(), cue->endTime()); 1288 double endTime = max(cue->startTime(), cue->endTime());
1284 1289
1285 CueInterval interval = m_cueTree.createInterval(cue->startTime(), endTime, c ue.get()); 1290 CueInterval interval = m_cueTree.createInterval(cue->startTime(), endTime, c ue.get());
1286 if (!m_cueTree.contains(interval)) 1291 if (!m_cueTree.contains(interval))
1287 m_cueTree.add(interval); 1292 m_cueTree.add(interval);
1288 updateActiveTextTrackCues(currentTime()); 1293 updateActiveTextTrackCues(currentTime());
1289 } 1294 }
1290 1295
1291 void HTMLMediaElement::textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue> c ue) 1296 void HTMLMediaElement::textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue> c ue)
1292 { 1297 {
1293 // Negative duration cues need to be treated in the interval tree as 1298 // Negative duration cues need to be treated in the interval tree as
1294 // zero-length cues. 1299 // zero-length cues.
1295 double endTime = max(cue->startTime(), cue->endTime()); 1300 double endTime = max(cue->startTime(), cue->endTime());
1296 1301
1297 CueInterval interval = m_cueTree.createInterval(cue->startTime(), endTime, c ue.get()); 1302 CueInterval interval = m_cueTree.createInterval(cue->startTime(), endTime, c ue.get());
1298 m_cueTree.remove(interval); 1303 m_cueTree.remove(interval);
1299 1304
1300 size_t index = m_currentlyActiveCues.find(interval); 1305 size_t index = m_currentlyActiveCues.find(interval);
1301 if (index != notFound) 1306 if (index != notFound) {
1302 m_currentlyActiveCues.remove(index); 1307 m_currentlyActiveCues.remove(index);
1308 cue->setIsActive(false);
1309 }
1303 1310
1304 cue->removeDisplayTree(); 1311 cue->removeDisplayTree();
1305 updateActiveTextTrackCues(currentTime()); 1312 updateActiveTextTrackCues(currentTime());
1306 } 1313 }
1307 1314
1308 1315
1309 bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionI fInvalid) 1316 bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionI fInvalid)
1310 { 1317 {
1311 if (!url.isValid()) { 1318 if (!url.isValid()) {
1312 LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%s) -> FALSE because url i s invalid", urlForLoggingMedia(url).utf8().data()); 1319 LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%s) -> FALSE because url i s invalid", urlForLoggingMedia(url).utf8().data());
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after
2852 return false; 2859 return false;
2853 2860
2854 CaptionUserPreferences* captionPreferences = page->group().captionPreference s(); 2861 CaptionUserPreferences* captionPreferences = page->group().captionPreference s();
2855 return captionPreferences->userHasCaptionPreferences() && captionPreferences ->shouldShowCaptions(); 2862 return captionPreferences->userHasCaptionPreferences() && captionPreferences ->shouldShowCaptions();
2856 } 2863 }
2857 2864
2858 void HTMLMediaElement::configureTextTrackGroup(const TrackGroup& group) 2865 void HTMLMediaElement::configureTextTrackGroup(const TrackGroup& group)
2859 { 2866 {
2860 ASSERT(group.tracks.size()); 2867 ASSERT(group.tracks.size());
2861 2868
2869 LOG(Media, "HTMLMediaElement::configureTextTrackGroup(%d)", group.kind);
2870
2862 Page* page = document()->page(); 2871 Page* page = document()->page();
2863 CaptionUserPreferences* captionPreferences = page? page->group().captionPref erences() : 0; 2872 CaptionUserPreferences* captionPreferences = page? page->group().captionPref erences() : 0;
2864 2873
2865 // First, find the track in the group that should be enabled (if any). 2874 // First, find the track in the group that should be enabled (if any).
2866 Vector<RefPtr<TextTrack> > currentlyEnabledTracks; 2875 Vector<RefPtr<TextTrack> > currentlyEnabledTracks;
2867 RefPtr<TextTrack> trackToEnable; 2876 RefPtr<TextTrack> trackToEnable;
2868 RefPtr<TextTrack> defaultTrack; 2877 RefPtr<TextTrack> defaultTrack;
2869 RefPtr<TextTrack> fallbackTrack; 2878 RefPtr<TextTrack> fallbackTrack;
2870 int highestTrackScore = 0; 2879 int highestTrackScore = 0;
2871 for (size_t i = 0; i < group.tracks.size(); ++i) { 2880 for (size_t i = 0; i < group.tracks.size(); ++i) {
(...skipping 28 matching lines...) Expand all
2900 // Let the text track mode be showing by default. 2909 // Let the text track mode be showing by default.
2901 defaultTrack = textTrack; 2910 defaultTrack = textTrack;
2902 } 2911 }
2903 } 2912 }
2904 2913
2905 if (!trackToEnable && defaultTrack) 2914 if (!trackToEnable && defaultTrack)
2906 trackToEnable = defaultTrack; 2915 trackToEnable = defaultTrack;
2907 2916
2908 // If no track matches the user's preferred language and non was marked 'def ault', enable the first track 2917 // If no track matches the user's preferred language and non was marked 'def ault', enable the first track
2909 // because the user has explicitly stated a preference for this kind of trac k. 2918 // because the user has explicitly stated a preference for this kind of trac k.
2919 if (!fallbackTrack && m_closedCaptionsVisible && group.kind == TrackGroup::C aptionsAndSubtitles)
2920 fallbackTrack = group.tracks[0];
2921
2910 if (!trackToEnable && fallbackTrack) 2922 if (!trackToEnable && fallbackTrack)
2911 trackToEnable = fallbackTrack; 2923 trackToEnable = fallbackTrack;
2912 2924
2913 if (currentlyEnabledTracks.size()) { 2925 if (currentlyEnabledTracks.size()) {
2914 for (size_t i = 0; i < currentlyEnabledTracks.size(); ++i) { 2926 for (size_t i = 0; i < currentlyEnabledTracks.size(); ++i) {
2915 RefPtr<TextTrack> textTrack = currentlyEnabledTracks[i]; 2927 RefPtr<TextTrack> textTrack = currentlyEnabledTracks[i];
2916 if (textTrack != trackToEnable) 2928 if (textTrack != trackToEnable)
2917 textTrack->setMode(TextTrack::disabledKeyword()); 2929 textTrack->setMode(TextTrack::disabledKeyword());
2918 } 2930 }
2919 } 2931 }
2920 2932
2921 if (trackToEnable) 2933 if (trackToEnable)
2922 trackToEnable->setMode(TextTrack::showingKeyword()); 2934 trackToEnable->setMode(TextTrack::showingKeyword());
2923
2924 m_processingPreferenceChange = false;
2925 } 2935 }
2926 2936
2927 void HTMLMediaElement::setSelectedTextTrack(TextTrack* trackToSelect) 2937 void HTMLMediaElement::setSelectedTextTrack(TextTrack* trackToSelect)
2928 { 2938 {
2929 TextTrackList* trackList = textTracks(); 2939 TextTrackList* trackList = textTracks();
2930 if (!trackList || !trackList->length()) 2940 if (!trackList || !trackList->length())
2931 return; 2941 return;
2932 if (trackToSelect && !trackList->contains(trackToSelect)) 2942 if (trackToSelect && !trackList->contains(trackToSelect))
2933 return; 2943 return;
2934 2944
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
3875 return false; 3885 return false;
3876 } 3886 }
3877 3887
3878 bool HTMLMediaElement::closedCaptionsVisible() const 3888 bool HTMLMediaElement::closedCaptionsVisible() const
3879 { 3889 {
3880 return m_closedCaptionsVisible; 3890 return m_closedCaptionsVisible;
3881 } 3891 }
3882 3892
3883 void HTMLMediaElement::updateTextTrackDisplay() 3893 void HTMLMediaElement::updateTextTrackDisplay()
3884 { 3894 {
3895 LOG(Media, "HTMLMediaElement::updateTextTrackDisplay");
3896
3885 if (!hasMediaControls() && !createMediaControls()) 3897 if (!hasMediaControls() && !createMediaControls())
3886 return; 3898 return;
3887 3899
3888 mediaControls()->updateTextTrackDisplay(); 3900 mediaControls()->updateTextTrackDisplay();
3889 } 3901 }
3890 3902
3891 void HTMLMediaElement::setClosedCaptionsVisible(bool closedCaptionVisible) 3903 void HTMLMediaElement::setClosedCaptionsVisible(bool closedCaptionVisible)
3892 { 3904 {
3893 LOG(Media, "HTMLMediaElement::setClosedCaptionsVisible(%s)", boolString(clos edCaptionVisible)); 3905 LOG(Media, "HTMLMediaElement::setClosedCaptionsVisible(%s)", boolString(clos edCaptionVisible));
3894 3906
3895 if (!m_player || !hasClosedCaptions()) 3907 if (!m_player || !hasClosedCaptions())
3896 return; 3908 return;
3897 3909
3898 m_closedCaptionsVisible = closedCaptionVisible; 3910 m_closedCaptionsVisible = closedCaptionVisible;
3899 m_player->setClosedCaptionsVisible(closedCaptionVisible); 3911 m_player->setClosedCaptionsVisible(closedCaptionVisible);
3900 3912
3901 if (RuntimeEnabledFeatures::webkitVideoTrackEnabled()) { 3913 if (RuntimeEnabledFeatures::webkitVideoTrackEnabled()) {
3902 m_processingPreferenceChange = true; 3914 m_processingPreferenceChange = true;
3903 markCaptionAndSubtitleTracksAsUnconfigured(); 3915 markCaptionAndSubtitleTracksAsUnconfigured();
3916 m_processingPreferenceChange = false;
3917
3904 updateTextTrackDisplay(); 3918 updateTextTrackDisplay();
3905 } 3919 }
3906 } 3920 }
3907 3921
3908 void HTMLMediaElement::setWebkitClosedCaptionsVisible(bool visible) 3922 void HTMLMediaElement::setWebkitClosedCaptionsVisible(bool visible)
3909 { 3923 {
3910 setClosedCaptionsVisible(visible); 3924 setClosedCaptionsVisible(visible);
3911 } 3925 }
3912 3926
3913 bool HTMLMediaElement::webkitClosedCaptionsVisible() const 3927 bool HTMLMediaElement::webkitClosedCaptionsVisible() const
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
4032 4046
4033 if (!hasMediaControls() && !createMediaControls()) 4047 if (!hasMediaControls() && !createMediaControls())
4034 return; 4048 return;
4035 4049
4036 mediaControls()->show(); 4050 mediaControls()->show();
4037 } 4051 }
4038 4052
4039 void HTMLMediaElement::configureTextTrackDisplay() 4053 void HTMLMediaElement::configureTextTrackDisplay()
4040 { 4054 {
4041 ASSERT(m_textTracks); 4055 ASSERT(m_textTracks);
4056 LOG(Media, "HTMLMediaElement::configureTextTrackDisplay");
4042 4057
4043 if (m_processingPreferenceChange) 4058 if (m_processingPreferenceChange)
4044 return; 4059 return;
4045 4060
4046 bool haveVisibleTextTrack = false; 4061 bool haveVisibleTextTrack = false;
4047 for (unsigned i = 0; i < m_textTracks->length(); ++i) { 4062 for (unsigned i = 0; i < m_textTracks->length(); ++i) {
4048 if (m_textTracks->item(i)->mode() == TextTrack::showingKeyword()) { 4063 if (m_textTracks->item(i)->mode() == TextTrack::showingKeyword()) {
4049 haveVisibleTextTrack = true; 4064 haveVisibleTextTrack = true;
4050 break; 4065 break;
4051 } 4066 }
4052 } 4067 }
4053 4068
4054 if (m_haveVisibleTextTrack == haveVisibleTextTrack) 4069 if (m_haveVisibleTextTrack == haveVisibleTextTrack)
4055 return; 4070 return;
4056 m_haveVisibleTextTrack = haveVisibleTextTrack; 4071 m_haveVisibleTextTrack = haveVisibleTextTrack;
4057 m_closedCaptionsVisible = m_haveVisibleTextTrack; 4072 m_closedCaptionsVisible = m_haveVisibleTextTrack;
4058 4073
4059 if (!m_haveVisibleTextTrack && !hasMediaControls()) 4074 if (!m_haveVisibleTextTrack && !hasMediaControls())
4060 return; 4075 return;
4061 if (!hasMediaControls() && !createMediaControls()) 4076 if (!hasMediaControls() && !createMediaControls())
4062 return; 4077 return;
4063 4078
4064 mediaControls()->changedClosedCaptionsVisibility(); 4079 mediaControls()->changedClosedCaptionsVisibility();
4065 4080
4066 if (RuntimeEnabledFeatures::webkitVideoTrackEnabled()) 4081 if (RuntimeEnabledFeatures::webkitVideoTrackEnabled())
4067 updateTextTrackDisplay(); 4082 updateTextTrackDisplay();
4068 } 4083 }
4069 4084
4070 void HTMLMediaElement::captionPreferencesChanged() 4085 void HTMLMediaElement::captionPreferencesChanged()
4071 { 4086 {
4072 if (!isVideo()) 4087 if (!isVideo())
4073 return; 4088 return;
4074 4089
4075 if (hasMediaControls()) 4090 if (hasMediaControls())
4076 mediaControls()->textTrackPreferencesChanged(); 4091 mediaControls()->textTrackPreferencesChanged();
4077 4092
4078 setClosedCaptionsVisible(userPrefersCaptions()); 4093 setClosedCaptionsVisible(userPrefersCaptions());
4079 } 4094 }
4080 4095
4081 void HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured() 4096 void HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured()
4082 { 4097 {
4083 if (!m_textTracks) 4098 if (!m_textTracks)
4084 return; 4099 return;
4085 4100
4086 // Mark all tracks as not "configured" so that configureTextTracks() 4101 // Mark all tracks as not "configured" so that configureTextTracks()
4087 // will reconsider which tracks to display in light of new user preferences 4102 // will reconsider which tracks to display in light of new user preferences
4088 // (e.g. default tracks should not be displayed if the user has turned off 4103 // (e.g. default tracks should not be displayed if the user has turned off
4089 // captions and non-default tracks should be displayed based on language 4104 // captions and non-default tracks should be displayed based on language
4090 // preferences if the user has turned captions on). 4105 // preferences if the user has turned captions on).
4091 for (unsigned i = 0; i < m_textTracks->length(); ++i) { 4106 for (unsigned i = 0; i < m_textTracks->length(); ++i) {
4092
4093 RefPtr<TextTrack> textTrack = m_textTracks->item(i); 4107 RefPtr<TextTrack> textTrack = m_textTracks->item(i);
4094 String kind = textTrack->kind(); 4108 String kind = textTrack->kind();
4095 4109
4096 if (kind == TextTrack::subtitlesKeyword() || kind == TextTrack::captions Keyword()) 4110 if (kind == TextTrack::subtitlesKeyword() || kind == TextTrack::captions Keyword())
4097 textTrack->setHasBeenConfigured(false); 4111 textTrack->setHasBeenConfigured(false);
4098 } 4112 }
4099 configureTextTracks(); 4113 configureTextTracks();
4100 } 4114 }
4101 4115
4102 4116
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
4438 info.addMember(m_mediaController, "mediaController"); 4452 info.addMember(m_mediaController, "mediaController");
4439 4453
4440 #if ENABLE(WEB_AUDIO) 4454 #if ENABLE(WEB_AUDIO)
4441 info.addMember(m_audioSourceNode, "audioSourceNode"); 4455 info.addMember(m_audioSourceNode, "audioSourceNode");
4442 #endif 4456 #endif
4443 4457
4444 } 4458 }
4445 4459
4446 } 4460 }
4447 #endif 4461 #endif
OLDNEW
« no previous file with comments | « LayoutTests/media/video-controls-captions-multiple-clicks-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698