Allow ports to disable automatic text track selection
authoreric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Feb 2016 16:38:02 +0000 (16:38 +0000)
committereric.carlson@apple.com <eric.carlson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Feb 2016 16:38:02 +0000 (16:38 +0000)
commitc52987dd98b3e7f5637df59574eea6acdfd56707
tree8329f94adee259730cfe6e14881d9032170d7442
parent954d74836e2b6a22442535c330673a69d27fcf4c
Allow ports to disable automatic text track selection
https://bugs.webkit.org/show_bug.cgi?id=153761
<rdar://problem/24416768>

Reviewed by Darin Adler.

Source/WebCore:

Test: media/track/track-manual-mode.html

* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::manualKeyword): New.
(WebCore::MediaControlsHost::captionDisplayMode): Support 'manual' mode.
* Modules/mediacontrols/MediaControlsHost.h:

* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.buildCaptionMenu): Check the 'off' item when in manual mode.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::addTextTrack): Update m_captionDisplayMode when called for the first
  time so it is always correct. Set the track's manual selection mode as appropriate.
(WebCore::HTMLMediaElement::captionPreferencesChanged): Set each track's manual selection
  mode as appropriate.

* html/track/TextTrack.cpp:
(WebCore::TextTrack::kind): Return 'subtitles' for forced tracks when in manual mode.
* html/track/TextTrack.h:

* html/track/TrackBase.h:
(WebCore::TrackBase::kind): Make virtual.

* page/CaptionUserPreferences.cpp:
(WebCore::CaptionUserPreferences::beginBlockingNotifications): New.
(WebCore::CaptionUserPreferences::endBlockingNotifications): Ditto.
(WebCore::CaptionUserPreferences::notify): Don't notify when blocked.
* page/CaptionUserPreferences.h:

* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::CaptionUserPreferencesMediaAF::CaptionUserPreferencesMediaAF): Set manual mode
  when appropriate.
(WebCore::CaptionUserPreferencesMediaAF::captionDisplayMode): Check manual mode.
(WebCore::CaptionUserPreferencesMediaAF::setCaptionDisplayMode): Ditto.
(WebCore::CaptionUserPreferencesMediaAF::setPreferredLanguage): Ditto.
(WebCore::CaptionUserPreferencesMediaAF::textTrackSelectionScore): Return zero when in manual mode.
(WebCore::CaptionUserPreferencesMediaAF::sortedTrackListForMenu): Consider manual mode. Fix
  typos in logging.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::mediaDescriptionForKind): Return 'auxiliary' when in manual mode.

* testing/Internals.cpp:
(WebCore::Internals::setCaptionDisplayMode): Support manual mode.

LayoutTests:

* media/track/track-manual-mode-expected.txt: Added.
* media/track/track-manual-mode.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196010 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
LayoutTests/ChangeLog
LayoutTests/media/track/track-manual-mode-expected.txt [new file with mode: 0644]
LayoutTests/media/track/track-manual-mode.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp
Source/WebCore/Modules/mediacontrols/MediaControlsHost.h
Source/WebCore/Modules/mediacontrols/mediaControlsApple.js
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/track/TextTrack.cpp
Source/WebCore/html/track/TextTrack.h
Source/WebCore/html/track/TrackBase.h
Source/WebCore/page/CaptionUserPreferences.cpp
Source/WebCore/page/CaptionUserPreferences.h
Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
Source/WebCore/testing/Internals.cpp