| Index: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
|
| diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
|
| index 9532e3b68e7f1c287ec6a75c91615c6270589db2..fa1b4d6c36b50acfa656dd7a562c03367eb072d2 100644
|
| --- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
|
| +++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
|
| @@ -409,8 +409,9 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum
|
| , m_seeking(false)
|
| , m_sentStalledEvent(false)
|
| , m_sentEndEvent(false)
|
| - , m_closedCaptionsVisible(false)
|
| , m_ignorePreloadNone(false)
|
| + , m_textTracksVisible(false)
|
| + , m_shouldPerformAutomaticTrackSelection(true)
|
| , m_tracksAreReady(true)
|
| , m_processingPreferenceChange(false)
|
| , m_remoteRoutesAvailable(false)
|
| @@ -1252,6 +1253,11 @@ void HTMLMediaElement::textTrackModeChanged(TextTrack* track)
|
| textTracks()->scheduleChangeEvent();
|
| }
|
|
|
| +void HTMLMediaElement::disableAutomaticTextTrackSelection()
|
| +{
|
| + m_shouldPerformAutomaticTrackSelection = false;
|
| +}
|
| +
|
| bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionIfInvalid)
|
| {
|
| if (!url.isValid()) {
|
| @@ -2608,10 +2614,13 @@ void HTMLMediaElement::honorUserPreferencesForAutomaticTextTrackSelection()
|
| if (!m_textTracks || !m_textTracks->length())
|
| return;
|
|
|
| + if (!m_shouldPerformAutomaticTrackSelection)
|
| + return;
|
| +
|
| AutomaticTrackSelection::Configuration configuration;
|
| if (m_processingPreferenceChange)
|
| configuration.disableCurrentlyEnabledTracks = true;
|
| - if (m_closedCaptionsVisible)
|
| + if (m_textTracksVisible)
|
| configuration.forceEnableSubtitleOrCaptionTrack = true;
|
|
|
| Settings* settings = document().settings();
|
| @@ -3281,9 +3290,9 @@ bool HTMLMediaElement::hasClosedCaptions() const
|
| return false;
|
| }
|
|
|
| -bool HTMLMediaElement::closedCaptionsVisible() const
|
| +bool HTMLMediaElement::textTracksVisible() const
|
| {
|
| - return m_closedCaptionsVisible;
|
| + return m_textTracksVisible;
|
| }
|
|
|
| static void assertShadowRootChildren(ShadowRoot& shadowRoot)
|
| @@ -3339,30 +3348,10 @@ void HTMLMediaElement::mediaControlsDidBecomeVisible()
|
| // When the user agent starts exposing a user interface for a video element,
|
| // the user agent should run the rules for updating the text track rendering
|
| // of each of the text tracks in the video element's list of text tracks ...
|
| - if (isHTMLVideoElement() && closedCaptionsVisible())
|
| + if (isHTMLVideoElement() && textTracksVisible())
|
| ensureTextTrackContainer().updateDisplay(*this, TextTrackContainer::DidStartExposingControls);
|
| }
|
|
|
| -void HTMLMediaElement::setClosedCaptionsVisible(bool closedCaptionVisible)
|
| -{
|
| - WTF_LOG(Media, "HTMLMediaElement::setClosedCaptionsVisible(%p, %s)", this, boolString(closedCaptionVisible));
|
| -
|
| - if (!hasClosedCaptions())
|
| - return;
|
| -
|
| - m_closedCaptionsVisible = closedCaptionVisible;
|
| -
|
| - markCaptionAndSubtitleTracksAsUnconfigured();
|
| - m_processingPreferenceChange = true;
|
| - honorUserPreferencesForAutomaticTextTrackSelection();
|
| - m_processingPreferenceChange = false;
|
| -
|
| - // As track visibility changed while m_processingPreferenceChange was set,
|
| - // there was no call to updateTextTrackDisplay(). This call is not in the
|
| - // spec, see the note in configureTextTrackDisplay().
|
| - updateTextTrackDisplay();
|
| -}
|
| -
|
| void HTMLMediaElement::setTextTrackKindUserPreferenceForAllMediaElements(Document* document)
|
| {
|
| auto it = documentToElementSetMap().find(document);
|
| @@ -3381,13 +3370,13 @@ void HTMLMediaElement::automaticTrackSelectionForUpdatedUserPreference()
|
|
|
| markCaptionAndSubtitleTracksAsUnconfigured();
|
| m_processingPreferenceChange = true;
|
| - m_closedCaptionsVisible = false;
|
| + m_textTracksVisible = false;
|
| honorUserPreferencesForAutomaticTextTrackSelection();
|
| m_processingPreferenceChange = false;
|
|
|
| // If a track is set to 'showing' post performing automatic track selection,
|
| - // set closed captions state to visible to update the CC button and display the track.
|
| - m_closedCaptionsVisible = m_textTracks->hasShowingTracks();
|
| + // set text tracks state to visible to update the CC button and display the track.
|
| + m_textTracksVisible = m_textTracks->hasShowingTracks();
|
| updateTextTrackDisplay();
|
| }
|
|
|
| @@ -3512,7 +3501,7 @@ void HTMLMediaElement::configureTextTrackDisplay()
|
| return;
|
|
|
| bool haveVisibleTextTrack = m_textTracks->hasShowingTracks();
|
| - m_closedCaptionsVisible = haveVisibleTextTrack;
|
| + m_textTracksVisible = haveVisibleTextTrack;
|
|
|
| if (!haveVisibleTextTrack && !mediaControls())
|
| return;
|
|
|