Chromium Code Reviews| Index: Source/core/html/HTMLMediaElement.cpp |
| diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp |
| index 299905f7c3714f256eb3b03a50adc27a9ba2b08b..f0eff4daaf2170a1ee3acde177fd7c768f20507c 100644 |
| --- a/Source/core/html/HTMLMediaElement.cpp |
| +++ b/Source/core/html/HTMLMediaElement.cpp |
| @@ -363,6 +363,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum |
| , m_audioTracks(AudioTrackList::create(*this)) |
| , m_videoTracks(VideoTrackList::create(*this)) |
| , m_textTracks(nullptr) |
| + , m_selectedTextTrack(nullptr) |
| #if ENABLE(WEB_AUDIO) |
| , m_audioSourceNode(nullptr) |
| #endif |
| @@ -1167,6 +1168,23 @@ void HTMLMediaElement::textTrackModeChanged(TextTrack* track) |
| textTracks()->scheduleChangeEvent(); |
| } |
| +void HTMLMediaElement::showTextTrackAtIndex(unsigned index) |
|
fs
2015/04/14 12:34:56
Any reason - m_selectedTextTrack excepted - to hav
srivats
2015/04/16 23:37:19
No. I moved this method to MediaControlElements an
|
| +{ |
| + TextTrackList* trackList = textTracks(); |
| + if (!trackList || !trackList->length()) |
| + return; |
| + |
| + for (unsigned i = 0; i < trackList->length(); ++i) { |
| + TextTrack* track = trackList->item(i); |
| + track->setMode(TextTrack::disabledKeyword()); |
|
fs
2015/04/14 12:34:56
This ought to be more selective. I.e. only do this
srivats
2015/04/16 23:37:19
By rendered tracks, are you referring to tracks wi
fs
2015/04/17 11:54:46
No, I mean tracks that are either kind=subtitles o
srivats
2015/04/21 01:48:55
Done.
|
| + } |
| + |
| + if (index < trackList->length()) { |
| + m_selectedTextTrack = trackList->item(index); |
|
fs
2015/04/14 12:34:56
It feels a bit like this is only used to avoid run
srivats
2015/04/16 23:37:19
Done.
|
| + m_selectedTextTrack->setMode(TextTrack::showingKeyword()); |
| + } |
| +} |
| + |
| bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionIfInvalid) |
| { |
| if (!url.isValid()) { |
| @@ -2481,6 +2499,12 @@ void HTMLMediaElement::honorUserPreferencesForAutomaticTextTrackSelection() |
| if (!m_textTracks || !m_textTracks->length()) |
| return; |
| + // If the user has selected a track to display, don't perform automatic selection |
| + if (m_selectedTextTrack) { |
| + m_selectedTextTrack->setMode(TextTrack::showingKeyword()); |
| + return; |
| + } |
| + |
| AutomaticTrackSelection::Configuration configuration; |
| if (m_processingPreferenceChange) |
| configuration.disableCurrentlyEnabledTracks = true; |