Index: Source/core/html/HTMLMediaElement.cpp |
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp |
index aa41d278c8f73fc305c6fb6df818e5137559f8c7..baea35b62440f28c440a90dc8fa3de898e0073c7 100644 |
--- a/Source/core/html/HTMLMediaElement.cpp |
+++ b/Source/core/html/HTMLMediaElement.cpp |
@@ -2502,6 +2502,10 @@ void HTMLMediaElement::honorUserPreferencesForAutomaticTextTrackSelection() |
if (m_closedCaptionsVisible) |
configuration.forceEnableSubtitleOrCaptionTrack = true; |
+ Settings* settings = document().settings(); |
+ if (settings) |
+ configuration.textTrackKindUserPreference = settings->textTrackKindUserPreference(); |
+ |
AutomaticTrackSelection trackSelection(configuration); |
trackSelection.perform(*m_textTracks); |
@@ -3278,6 +3282,27 @@ void HTMLMediaElement::setClosedCaptionsVisible(bool closedCaptionVisible) |
updateTextTrackDisplay(); |
} |
+void HTMLMediaElement::setTextTrackKindUserPreferenceForAllMediaElements(Document* document) |
+{ |
+ WeakMediaElementSet elements = documentToElementSetMap().get(document); |
+ for (const auto& element: elements) |
fs
2015/06/24 08:59:07
Nit: space around ':'
srivats
2015/07/02 01:41:21
Done.
|
+ element->automaticTrackSelectionForUpdatedUserPreference(); |
+} |
+ |
+void HTMLMediaElement::automaticTrackSelectionForUpdatedUserPreference() |
philipj_slow
2015/06/24 09:54:20
Is it really necessary to act on the changed user
srivats
2015/07/02 01:41:21
It does seem a little buggy to not have the platfo
philipj_slow
2015/07/09 15:20:49
Do native video players take the setting into acco
srivats
2015/07/09 21:25:37
I know that WebKit's native video player reacts to
philipj_slow
2015/07/09 22:36:26
OK, fair enough.
|
+{ |
+ markCaptionAndSubtitleTracksAsUnconfigured(); |
+ m_processingPreferenceChange = true; |
+ m_closedCaptionsVisible = false; |
+ honorUserPreferencesForAutomaticTextTrackSelection(); |
+ m_processingPreferenceChange = false; |
+ |
+ // If a track is set to showing post performing automatic track selection, |
fs
2015/06/24 08:59:07
Nit: showing -> 'showing'
srivats
2015/07/02 01:41:20
Done.
|
+ // set closed captions state to visible to update the CC button and display the track. |
+ m_closedCaptionsVisible = m_textTracks->hasShowingTracks(); |
+ updateTextTrackDisplay(); |
+} |
+ |
void HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured() |
{ |
if (!m_textTracks) |
@@ -3397,13 +3422,7 @@ void HTMLMediaElement::configureTextTrackDisplay(VisibilityChangeAssumption assu |
if (m_processingPreferenceChange) |
return; |
- bool haveVisibleTextTrack = false; |
- for (unsigned i = 0; i < m_textTracks->length(); ++i) { |
- if (m_textTracks->item(i)->mode() == TextTrack::showingKeyword()) { |
- haveVisibleTextTrack = true; |
- break; |
- } |
- } |
+ bool haveVisibleTextTrack = m_textTracks->hasShowingTracks(); |
if (assumption == AssumeNoVisibleChange |
&& m_haveVisibleTextTrack == haveVisibleTextTrack) { |