https://bugs.webkit.org/show_bug.cgi?id=227937
<rdar://problem/79069662>
Reviewed by Eric Carlson.
r279720 made it so that `CaptionUserPreferencesMediaAF::setCaptionDisplayMode` no longer
directly modifies `kMACaptionAppearanceDomainUser` in the WebProcess, using a cached value
as a way of preventing the WebProcess from trying to read back that value after it's set,
instead having the UIProcess send `Messages::WebProcess::SetMediaAccessibilityPreferences`
whenever this changes to update that cached value. Unfortunately, because the WebProcess
needs to read this value immediately after changing it, this IPC round trip causes the
WebProcess to read the old value, which results in no observable changes. In order to fix
this, notify `CaptionUserPreferences` that `captionPreferencesChanged` when the above IPC
message is received (which will also handle cases when the value changes outside WebKit).
Source/WebCore:
* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::sortedTrackListForMenu):
(WebCore::MediaControlsHost::displayNameForTrack):
(WebCore::MediaControlsHost::captionDisplayMode const):
(WebCore::MediaControlsHost::showMediaControlsContextMenu):
* dom/Document.cpp:
(WebCore::Document::registerForCaptionPreferencesChangedCallbacks):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::addTextTrack):
(WebCore::HTMLMediaElement::configureTextTrackGroup):
(WebCore::HTMLMediaElement::setSelectedTextTrack):
(WebCore::HTMLMediaElement::captionPreferencesChanged):
(WebCore::HTMLMediaElement::captionDisplayMode):
(WebCore::HTMLMediaElement::mediaPlayerPreferredAudioCharacteristics const):
* html/shadow/MediaControlTextTrackContainerElement.cpp:
(WebCore::MediaControlTextTrackContainerElement::updateActiveCuesFontSize):
(WebCore::MediaControlTextTrackContainerElement::updateTextStrokeStyle):
* page/PageGroup.h:
(WebCore::PageGroup::captionPreferences const): Added.
* page/PageGroup.cpp:
(WebCore::PageGroup::ensureCaptionPreferences): Added.
(WebCore::PageGroup::captionPreferences): Deleted.
* platform/cocoa/PlaybackSessionModelMediaElement.mm:
(WebCore::PlaybackSessionModelMediaElement::updateMediaSelectionOptions):
(WebCore::PlaybackSessionModelMediaElement::audioMediaSelectionOptions const):
(WebCore::PlaybackSessionModelMediaElement::legibleMediaSelectionOptions const):
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::setShouldDisplayTrackKind):
(WebCore::InternalSettings::shouldDisplayTrackKind):
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::Internals):
(WebCore::Internals::userPreferredAudioCharacteristics const):
(WebCore::Internals::setUserPreferredAudioCharacteristic):
(WebCore::Internals::captionsStyleSheetOverride):
(WebCore::Internals::setCaptionsStyleSheetOverride):
(WebCore::Internals::setPrimaryAudioTrackLanguageOverride):
(WebCore::Internals::setCaptionDisplayMode):
Rename `PageGroup::captionPreferences` to `PageGroup::ensureCaptionPreferences` so that it's
possible to get the `CaptionUserPreferences` without always creating it.
Source/WebKit:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::setMediaAccessibilityPreferences):
Make sure to also update every `CaptionUserPreferences` once the cached preference values
are saved so that any active media can update accordingly.
Canonical link: https://commits.webkit.org/239663@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@279914 268f45cc-cd09-0410-ab3c-d52691b4dbfc