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

Unified Diff: Source/core/html/HTMLMediaElement.cpp

Issue 1118613002: Hook up Android closed captions 'enabled' setting to Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressed comments from tkent Created 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index 5558692f2650d0baa1f5ee8941d302f798161f0d..563692abf2ce4bbd6df11920999f4bc584200f6f 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -375,6 +375,15 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum
setHasCustomStyleCallbacks();
addElementToDocumentMap(this, &document);
+
+#if OS(ANDROID)
+ // The OS setting for closed captions state is only available on Android, iOS
+ // and OSX. Set closed captions visibility based on OS text tracks state only if the platform
+ // is Android because the setting is currently only plumbed down on Android.
+ Settings* settings = document.settings();
+ if (settings)
+ m_closedCaptionsVisible = settings->textTracksEnabled();
+#endif
}
HTMLMediaElement::~HTMLMediaElement()
@@ -3397,7 +3406,16 @@ void HTMLMediaElement::configureTextTrackDisplay(VisibilityChangeAssumption assu
return;
}
m_haveVisibleTextTrack = haveVisibleTextTrack;
+
+#if !OS(ANDROID)
m_closedCaptionsVisible = m_haveVisibleTextTrack;
+#else
+ // Set closed captions visible during initial load only if the video has a
+ // visible text track and when the android platform closed captions are enabled.
+ Settings* settings = document().settings();
+ if (settings)
+ m_closedCaptionsVisible = m_haveVisibleTextTrack && settings->textTracksEnabled();
+#endif
if (!m_haveVisibleTextTrack && !mediaControls())
return;

Powered by Google App Engine
This is Rietveld 408576698