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

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

Issue 250923003: Remove always-false settings for text track selection (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: simplify more Created 6 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
« no previous file with comments | « Source/core/frame/Settings.in ('k') | Source/core/testing/InternalSettings.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index 77280ba10cc2e32dc70eaf19f2d09e8f2e14ae7b..436d57c0f4af581f7ee64bc84de1336b73e040a9 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -2400,27 +2400,15 @@ static int textTrackLanguageSelectionScore(const TextTrack& track)
if (languageMatchIndex >= languages.size())
return 0;
- // Matching a track language is more important than matching track type, so this multiplier must be
- // greater than the maximum value returned by textTrackSelectionScore.
- return (languages.size() - languageMatchIndex) * 10;
+ return languages.size() - languageMatchIndex;
}
-static int textTrackSelectionScore(const TextTrack& track, Settings* settings)
+static int textTrackSelectionScore(const TextTrack& track)
{
- int trackScore = 0;
-
- if (!settings)
- return trackScore;
-
if (track.kind() != TextTrack::captionsKeyword() && track.kind() != TextTrack::subtitlesKeyword())
- return trackScore;
-
- if (track.kind() == TextTrack::subtitlesKeyword() && settings->shouldDisplaySubtitles())
- trackScore = 1;
- else if (track.kind() == TextTrack::captionsKeyword() && settings->shouldDisplayCaptions())
- trackScore = 1;
+ return 0;
- return trackScore + textTrackLanguageSelectionScore(track);
+ return textTrackLanguageSelectionScore(track);
}
void HTMLMediaElement::configureTextTrackGroup(const TrackGroup& group)
@@ -2429,8 +2417,6 @@ void HTMLMediaElement::configureTextTrackGroup(const TrackGroup& group)
WTF_LOG(Media, "HTMLMediaElement::configureTextTrackGroup(%d)", group.kind);
- Settings* settings = document().settings();
-
// First, find the track in the group that should be enabled (if any).
WillBeHeapVector<RefPtrWillBeMember<TextTrack> > currentlyEnabledTracks;
RefPtrWillBeRawPtr<TextTrack> trackToEnable = nullptr;
@@ -2443,7 +2429,7 @@ void HTMLMediaElement::configureTextTrackGroup(const TrackGroup& group)
if (m_processingPreferenceChange && textTrack->mode() == TextTrack::showingKeyword())
currentlyEnabledTracks.append(textTrack);
- int trackScore = textTrackSelectionScore(*textTrack, settings);
+ int trackScore = textTrackSelectionScore(*textTrack);
if (trackScore) {
// * If the text track kind is { [subtitles or captions] [descriptions] } and the user has indicated an interest in having a
// track with this text track kind, text track language, and text track label enabled, and there is no
« no previous file with comments | « Source/core/frame/Settings.in ('k') | Source/core/testing/InternalSettings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698