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

Unified Diff: third_party/WebKit/Source/core/html/shadow/MediaControls.cpp

Issue 2456993003: Improve caption button behavior for video player. (Closed)
Patch Set: Addresss feedback Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/core/html/shadow/MediaControls.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
index 9652b7e9ef2c5f24ffaaa634bc31ec9b6efccb3d..c41813d9332872faa8adf4b732700ec8320c6bc9 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
@@ -34,6 +34,7 @@
#include "core/html/HTMLMediaElement.h"
#include "core/html/shadow/MediaControlsWindowEventListener.h"
#include "core/html/track/TextTrackContainer.h"
+#include "core/html/track/TextTrackList.h"
#include "core/layout/LayoutObject.h"
#include "core/layout/LayoutTheme.h"
#include "platform/EventDispatchForbiddenScope.h"
@@ -556,6 +557,24 @@ void MediaControls::toggleTextTrackList() {
m_textTrackList->setVisible(!m_textTrackList->isWanted());
}
+void MediaControls::showTextTrackAtIndex(unsigned indexToEnable) {
+ TextTrackList* trackList = mediaElement().textTracks();
+ if (indexToEnable >= trackList->length())
+ return;
+ TextTrack* track = trackList->anonymousIndexedGetter(indexToEnable);
+ if (track && track->canBeRendered())
+ track->setMode(TextTrack::showingKeyword());
+}
+
+void MediaControls::disableShowingTextTracks() {
+ TextTrackList* trackList = mediaElement().textTracks();
+ for (unsigned i = 0; i < trackList->length(); ++i) {
+ TextTrack* track = trackList->anonymousIndexedGetter(i);
+ if (track->mode() == TextTrack::showingKeyword())
+ track->setMode(TextTrack::disabledKeyword());
+ }
+}
+
void MediaControls::refreshCastButtonVisibility() {
refreshCastButtonVisibilityWithoutUpdate();
BatchedControlUpdate batch(this);
« no previous file with comments | « third_party/WebKit/Source/core/html/shadow/MediaControls.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698