<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[279720] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/279720">279720</a></dd>
<dt>Author</dt> <dd>pvollan@apple.com</dd>
<dt>Date</dt> <dd>2021-07-08 04:46:21 -0700 (Thu, 08 Jul 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Set Caption preferences in the UI process
https://bugs.webkit.org/show_bug.cgi?id=227742
<rdar://79040526>

Reviewed by Eric Carlson.

Source/WebCore:

Add a Caption user preferences delegate, which can be subclassed to perform the work in the UI process.

No new tests, since this is not trivial to add a test for. This has been manually tested.

* WebCore.xcodeproj/project.pbxproj:
* page/CaptionUserPreferencesMediaAF.cpp:
(WebCore::captionPreferencesDelegate):
(WebCore::CaptionUserPreferencesMediaAF::captionDisplayMode const):
(WebCore::CaptionUserPreferencesMediaAF::platformSetCaptionDisplayMode):
(WebCore::CaptionUserPreferencesMediaAF::setCaptionDisplayMode):
(WebCore::CaptionUserPreferencesMediaAF::setCaptionPreferencesDelegate):
(WebCore::CaptionUserPreferencesMediaAF::platformSetPreferredLanguage):
(WebCore::CaptionUserPreferencesMediaAF::setPreferredLanguage):
* page/CaptionUserPreferencesMediaAF.h:
* platform/CaptionPreferencesDelegate.h: Added.
(WebCore::CaptionPreferencesDelegate::~CaptionPreferencesDelegate):
(WebCore::CaptionPreferencesDelegate::setDisplayMode):

Source/WebKit:

Subclass the Caption user preferences delegate, which will send messages to the UI process, requesting to set the preferences.

* SourcesCocoa.txt:
* UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::setCaptionDisplayMode):
(WebKit::WebProcessProxy::setCaptionLanguage):
* UIProcess/WebProcessProxy.h:
* UIProcess/WebProcessProxy.messages.in:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebCaptionPreferencesDelegate.cpp: Added.
(WebKit::WebCaptionPreferencesDelegate::setDisplayMode):
(WebKit::WebCaptionPreferencesDelegate::setPreferredLanguage):
* WebProcess/WebCoreSupport/WebCaptionPreferencesDelegate.h: Added.
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorepageCaptionUserPreferencesMediaAFcpp">trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp</a></li>
<li><a href="#trunkSourceWebCorepageCaptionUserPreferencesMediaAFh">trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.h</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitSourcesCocoatxt">trunk/Source/WebKit/SourcesCocoa.txt</a></li>
<li><a href="#trunkSourceWebKitUIProcessCocoaWebProcessProxyCocoamm">trunk/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebProcessProxyh">trunk/Source/WebKit/UIProcess/WebProcessProxy.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebProcessProxymessagesin">trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKitWebKitxcodeprojprojectpbxproj">trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKitWebProcesscocoaWebProcessCocoamm">trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformCaptionPreferencesDelegateh">trunk/Source/WebCore/platform/CaptionPreferencesDelegate.h</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebCoreSupportWebCaptionPreferencesDelegatecpp">trunk/Source/WebKit/WebProcess/WebCoreSupport/WebCaptionPreferencesDelegate.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebCoreSupportWebCaptionPreferencesDelegateh">trunk/Source/WebKit/WebProcess/WebCoreSupport/WebCaptionPreferencesDelegate.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (279719 => 279720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-07-08 10:20:57 UTC (rev 279719)
+++ trunk/Source/WebCore/ChangeLog      2021-07-08 11:46:21 UTC (rev 279720)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2021-07-08  Per Arne  <pvollan@apple.com>
+
+        Set Caption preferences in the UI process
+        https://bugs.webkit.org/show_bug.cgi?id=227742
+        <rdar://79040526>
+
+        Reviewed by Eric Carlson.
+
+        Add a Caption user preferences delegate, which can be subclassed to perform the work in the UI process.
+
+        No new tests, since this is not trivial to add a test for. This has been manually tested.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * page/CaptionUserPreferencesMediaAF.cpp:
+        (WebCore::captionPreferencesDelegate):
+        (WebCore::CaptionUserPreferencesMediaAF::captionDisplayMode const):
+        (WebCore::CaptionUserPreferencesMediaAF::platformSetCaptionDisplayMode):
+        (WebCore::CaptionUserPreferencesMediaAF::setCaptionDisplayMode):
+        (WebCore::CaptionUserPreferencesMediaAF::setCaptionPreferencesDelegate):
+        (WebCore::CaptionUserPreferencesMediaAF::platformSetPreferredLanguage):
+        (WebCore::CaptionUserPreferencesMediaAF::setPreferredLanguage):
+        * page/CaptionUserPreferencesMediaAF.h:
+        * platform/CaptionPreferencesDelegate.h: Added.
+        (WebCore::CaptionPreferencesDelegate::~CaptionPreferencesDelegate):
+        (WebCore::CaptionPreferencesDelegate::setDisplayMode):
+
</ins><span class="cx"> 2021-07-08  Martin Robinson  <mrobinson@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         [css-scroll-snap] scroll-snap-align should use the box's writing-mode when the box is larger than the snapport
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (279719 => 279720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj   2021-07-08 10:20:57 UTC (rev 279719)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj      2021-07-08 11:46:21 UTC (rev 279720)
</span><span class="lines">@@ -5173,6 +5173,7 @@
</span><span class="cx">          E39628C12395743100658ECD /* MotionManagerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = E39628C02395743000658ECD /* MotionManagerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          E3A776671DC85D2800B690D8 /* DOMJITIDLConvert.h in Headers */ = {isa = PBXBuildFile; fileRef = E3A776651DC85D2200B690D8 /* DOMJITIDLConvert.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          E3A776681DC85D2800B690D8 /* DOMJITIDLType.h in Headers */ = {isa = PBXBuildFile; fileRef = E3A776661DC85D2200B690D8 /* DOMJITIDLType.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+               E3A86FC32695EB480059264D /* CaptionPreferencesDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = E3A86FC12695EB480059264D /* CaptionPreferencesDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">           E3AFD7AD255F50EB00E5E30E /* WorkerThreadType.h in Headers */ = {isa = PBXBuildFile; fileRef = E3AFD7AB255F50DC00E5E30E /* WorkerThreadType.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          E3B2F0ED1D7F4CA300B0C9D1 /* LoadableScript.h in Headers */ = {isa = PBXBuildFile; fileRef = E3B2F0E71D7F35EC00B0C9D1 /* LoadableScript.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          E3B2F0EE1D7F4CA900B0C9D1 /* LoadableScriptClient.h in Headers */ = {isa = PBXBuildFile; fileRef = E3B2F0E81D7F35EC00B0C9D1 /* LoadableScriptClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -5523,7 +5524,6 @@
</span><span class="cx">          FD3160AB12B026F700C1A359 /* ReverbConvolverStage.h in Headers */ = {isa = PBXBuildFile; fileRef = FD31607512B026F700C1A359 /* ReverbConvolverStage.h */; };
</span><span class="cx">          FD3160AD12B026F700C1A359 /* ReverbInputBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = FD31607712B026F700C1A359 /* ReverbInputBuffer.h */; };
</span><span class="cx">          FD3160AF12B026F700C1A359 /* VectorMath.h in Headers */ = {isa = PBXBuildFile; fileRef = FD31607912B026F700C1A359 /* VectorMath.h */; };
</span><del>-               FD3160BF12B0272A00C1A359 /* AudioFileReaderMac.h in Headers */ = {isa = PBXBuildFile; fileRef = FD3160B912B0272A00C1A359 /* AudioFileReaderMac.h */; };
</del><span class="cx">           FD359190138DB22000E1EBEC /* AudioParamTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = FD35918E138DB22000E1EBEC /* AudioParamTimeline.h */; };
</span><span class="cx">          FD45A94F175D3F3E00C21EC8 /* Shape.h in Headers */ = {isa = PBXBuildFile; fileRef = FD08A87F175D3926002CD360 /* Shape.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          FD45A952175D3F3E00C21EC8 /* ShapeOutsideInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = FD08A887175D3926002CD360 /* ShapeOutsideInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -16513,6 +16513,7 @@
</span><span class="cx">          E398FC231DC32A1B003C4684 /* DOMJITHelpers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMJITHelpers.cpp; sourceTree = "<group>"; };
</span><span class="cx">          E3A776651DC85D2200B690D8 /* DOMJITIDLConvert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMJITIDLConvert.h; sourceTree = "<group>"; };
</span><span class="cx">          E3A776661DC85D2200B690D8 /* DOMJITIDLType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMJITIDLType.h; sourceTree = "<group>"; };
</span><ins>+               E3A86FC12695EB480059264D /* CaptionPreferencesDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CaptionPreferencesDelegate.h; sourceTree = "<group>"; };
</ins><span class="cx">           E3AE6CD12252F27000C70B50 /* AllDescendantsCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AllDescendantsCollection.cpp; sourceTree = "<group>"; };
</span><span class="cx">          E3AFA9641DA6E908002861BD /* JSNodeDOMJIT.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNodeDOMJIT.cpp; sourceTree = "<group>"; };
</span><span class="cx">          E3AFD7AB255F50DC00E5E30E /* WorkerThreadType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WorkerThreadType.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -28080,6 +28081,7 @@
</span><span class="cx">                          B2C3D9EC0D006C1D00EF6F26 /* text */,
</span><span class="cx">                          E1EE8B6B2412B2A700E794D6 /* xr */,
</span><span class="cx">                          DFDB912CF8E88A6DA1AD264F /* AbortableTaskQueue.h */,
</span><ins>+                               E3A86FC12695EB480059264D /* CaptionPreferencesDelegate.h */,
</ins><span class="cx">                           C330A22113EC196B0000B45B /* ColorChooser.h */,
</span><span class="cx">                          C37CDEBC149EF2030042090D /* ColorChooserClient.h */,
</span><span class="cx">                          BCC8CFCA0986CD2400140BF2 /* ColorData.gperf */,
</span><span class="lines">@@ -31777,8 +31779,6 @@
</span><span class="cx">                          FD31608212B026F700C1A359 /* AudioDSPKernelProcessor.h in Headers */,
</span><span class="cx">                          FD31608312B026F700C1A359 /* AudioFileReader.h in Headers */,
</span><span class="cx">                          46AAAA3D25D3632000BAF42F /* AudioFileReaderCocoa.h in Headers */,
</span><del>-                               CD5596921475B678001D0BD0 /* AudioFileReaderIOS.h in Headers */,
-                               FD3160BF12B0272A00C1A359 /* AudioFileReaderMac.h in Headers */,
</del><span class="cx">                           CD2F4A2418D89F700063746D /* AudioHardwareListener.h in Headers */,
</span><span class="cx">                          CD2F4A2818D8A3490063746D /* AudioHardwareListenerMac.h in Headers */,
</span><span class="cx">                          FDE2D55B159E66EB00DCCCF8 /* AudioIOCallback.h in Headers */,
</span><span class="lines">@@ -31995,6 +31995,7 @@
</span><span class="cx">                          49484FCE102CF23C00187DD3 /* CanvasStyle.h in Headers */,
</span><span class="cx">                          7C193BBF1F5E0EED0088F3E6 /* CanvasTextAlign.h in Headers */,
</span><span class="cx">                          7C193BC01F5E0EED0088F3E6 /* CanvasTextBaseline.h in Headers */,
</span><ins>+                               E3A86FC32695EB480059264D /* CaptionPreferencesDelegate.h in Headers */,
</ins><span class="cx">                           079D0868162F20E800DB8658 /* CaptionUserPreferences.h in Headers */,
</span><span class="cx">                          079D086B162F21F900DB8658 /* CaptionUserPreferencesMediaAF.h in Headers */,
</span><span class="cx">                          07B7116D1D899E63009F0FFB /* CaptureDevice.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCorepageCaptionUserPreferencesMediaAFcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp (279719 => 279720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp      2021-07-08 10:20:57 UTC (rev 279719)
+++ trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp 2021-07-08 11:46:21 UTC (rev 279720)
</span><span class="lines">@@ -100,6 +100,12 @@
</span><span class="cx"> 
</span><span class="cx"> #if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
</span><span class="cx"> 
</span><ins>+static std::unique_ptr<CaptionPreferencesDelegate>& captionPreferencesDelegate()
+{
+    static NeverDestroyed<std::unique_ptr<CaptionPreferencesDelegate>> delegate;
+    return delegate.get();
+}
+
</ins><span class="cx"> static std::optional<CaptionUserPreferencesMediaAF::CaptionDisplayMode>& cachedCaptionDisplayMode()
</span><span class="cx"> {
</span><span class="cx">     static NeverDestroyed<std::optional<CaptionUserPreferencesMediaAF::CaptionDisplayMode>> captionDisplayMode;
</span><span class="lines">@@ -177,17 +183,9 @@
</span><span class="cx"> 
</span><span class="cx">     return platformCaptionDisplayMode();
</span><span class="cx"> }
</span><del>-    
-void CaptionUserPreferencesMediaAF::setCaptionDisplayMode(CaptionUserPreferences::CaptionDisplayMode mode)
</del><ins>+
+void CaptionUserPreferencesMediaAF::platformSetCaptionDisplayMode(CaptionDisplayMode mode)
</ins><span class="cx"> {
</span><del>-    if (testingMode() || !MediaAccessibilityLibrary()) {
-        CaptionUserPreferences::setCaptionDisplayMode(mode);
-        return;
-    }
-
-    if (captionDisplayMode() == Manual)
-        return;
-
</del><span class="cx">     MACaptionAppearanceDisplayType displayType = kMACaptionAppearanceDisplayTypeForcedOnly;
</span><span class="cx">     switch (mode) {
</span><span class="cx">     case Automatic:
</span><span class="lines">@@ -207,6 +205,24 @@
</span><span class="cx">     MACaptionAppearanceSetDisplayType(kMACaptionAppearanceDomainUser, displayType);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void CaptionUserPreferencesMediaAF::setCaptionDisplayMode(CaptionUserPreferences::CaptionDisplayMode mode)
+{
+    if (testingMode() || !MediaAccessibilityLibrary()) {
+        CaptionUserPreferences::setCaptionDisplayMode(mode);
+        return;
+    }
+
+    if (captionDisplayMode() == Manual)
+        return;
+
+    if (captionPreferencesDelegate()) {
+        captionPreferencesDelegate()->setDisplayMode(mode);
+        return;
+    }
+    
+    platformSetCaptionDisplayMode(mode);
+}
+
</ins><span class="cx"> CaptionUserPreferences::CaptionDisplayMode CaptionUserPreferencesMediaAF::platformCaptionDisplayMode()
</span><span class="cx"> {
</span><span class="cx">     MACaptionAppearanceDisplayType displayType = MACaptionAppearanceGetDisplayType(kMACaptionAppearanceDomainUser);
</span><span class="lines">@@ -291,6 +307,11 @@
</span><span class="cx">     CaptionUserPreferences::captionPreferencesChanged();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void CaptionUserPreferencesMediaAF::setCaptionPreferencesDelegate(std::unique_ptr<CaptionPreferencesDelegate>&& delegate)
+{
+    captionPreferencesDelegate() = WTFMove(delegate);
+}
+
</ins><span class="cx"> String CaptionUserPreferencesMediaAF::captionsWindowCSS() const
</span><span class="cx"> {
</span><span class="cx">     MACaptionAppearanceBehavior behavior;
</span><span class="lines">@@ -481,6 +502,11 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void CaptionUserPreferencesMediaAF::platformSetPreferredLanguage(const String& language)
+{
+    MACaptionAppearanceAddSelectedLanguage(kMACaptionAppearanceDomainUser, language.createCFString().get());
+}
+
</ins><span class="cx"> void CaptionUserPreferencesMediaAF::setPreferredLanguage(const String& language)
</span><span class="cx"> {
</span><span class="cx">     if (CaptionUserPreferences::captionDisplayMode() == Manual)
</span><span class="lines">@@ -491,7 +517,12 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    MACaptionAppearanceAddSelectedLanguage(kMACaptionAppearanceDomainUser, language.createCFString().get());
</del><ins>+    if (captionPreferencesDelegate()) {
+        captionPreferencesDelegate()->setPreferredLanguage(language);
+        return;
+    }
+
+    platformSetPreferredLanguage(language);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Vector<String> CaptionUserPreferencesMediaAF::preferredLanguages() const
</span></span></pre></div>
<a id="trunkSourceWebCorepageCaptionUserPreferencesMediaAFh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.h (279719 => 279720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.h        2021-07-08 10:20:57 UTC (rev 279719)
+++ trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.h   2021-07-08 11:46:21 UTC (rev 279720)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> #if ENABLE(VIDEO)
</span><span class="cx"> 
</span><span class="cx"> #include "CSSPropertyNames.h"
</span><ins>+#include "CaptionPreferencesDelegate.h"
</ins><span class="cx"> #include "CaptionUserPreferences.h"
</span><span class="cx"> #include "Color.h"
</span><span class="cx"> 
</span><span class="lines">@@ -44,6 +45,7 @@
</span><span class="cx">     void setCaptionDisplayMode(CaptionDisplayMode) override;
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT static CaptionDisplayMode platformCaptionDisplayMode();
</span><ins>+    WEBCORE_EXPORT static void platformSetCaptionDisplayMode(CaptionDisplayMode);
</ins><span class="cx">     WEBCORE_EXPORT static void setCachedCaptionDisplayMode(CaptionDisplayMode);
</span><span class="cx"> 
</span><span class="cx">     bool userPrefersCaptions() const override;
</span><span class="lines">@@ -58,6 +60,7 @@
</span><span class="cx">     Vector<String> preferredLanguages() const override;
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT static Vector<String> platformPreferredLanguages();
</span><ins>+    WEBCORE_EXPORT static void platformSetPreferredLanguage(const String&);
</ins><span class="cx">     WEBCORE_EXPORT static void setCachedPreferredLanguages(const Vector<String>&);
</span><span class="cx"> 
</span><span class="cx">     void setPreferredAudioCharacteristic(const String&) override;
</span><span class="lines">@@ -66,6 +69,8 @@
</span><span class="cx">     void captionPreferencesChanged() override;
</span><span class="cx"> 
</span><span class="cx">     bool shouldFilterTrackMenu() const { return true; }
</span><ins>+    
+    WEBCORE_EXPORT static void setCaptionPreferencesDelegate(std::unique_ptr<CaptionPreferencesDelegate>&&);
</ins><span class="cx"> #else
</span><span class="cx">     bool shouldFilterTrackMenu() const { return false; }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformCaptionPreferencesDelegateh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/CaptionPreferencesDelegate.h (0 => 279720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/CaptionPreferencesDelegate.h                               (rev 0)
+++ trunk/Source/WebCore/platform/CaptionPreferencesDelegate.h  2021-07-08 11:46:21 UTC (rev 279720)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+/*
+* Copyright (C) 2021 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#pragma once
+
+#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
+
+#include "CaptionUserPreferences.h"
+
+namespace WebCore {
+
+class CaptionPreferencesDelegate {
+public:
+    virtual ~CaptionPreferencesDelegate() { }
+
+    virtual void setDisplayMode(CaptionUserPreferences::CaptionDisplayMode) { }
+    virtual void setPreferredLanguage(const String&) { }
+};
+
+} // namespace WebCore
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (279719 => 279720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2021-07-08 10:20:57 UTC (rev 279719)
+++ trunk/Source/WebKit/ChangeLog       2021-07-08 11:46:21 UTC (rev 279720)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2021-07-08  Per Arne  <pvollan@apple.com>
+
+        Set Caption preferences in the UI process
+        https://bugs.webkit.org/show_bug.cgi?id=227742
+        <rdar://79040526>
+
+        Reviewed by Eric Carlson.
+
+        Subclass the Caption user preferences delegate, which will send messages to the UI process, requesting to set the preferences.
+
+        * SourcesCocoa.txt:
+        * UIProcess/Cocoa/WebProcessProxyCocoa.mm:
+        (WebKit::WebProcessProxy::setCaptionDisplayMode):
+        (WebKit::WebProcessProxy::setCaptionLanguage):
+        * UIProcess/WebProcessProxy.h:
+        * UIProcess/WebProcessProxy.messages.in:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/WebCoreSupport/WebCaptionPreferencesDelegate.cpp: Added.
+        (WebKit::WebCaptionPreferencesDelegate::setDisplayMode):
+        (WebKit::WebCaptionPreferencesDelegate::setPreferredLanguage):
+        * WebProcess/WebCoreSupport/WebCaptionPreferencesDelegate.h: Added.
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::platformInitializeWebProcess):
+
</ins><span class="cx"> 2021-07-07  Tim Horton  <timothy_horton@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Add WKHoverPlatter and some knobs to tweak its appearance
</span></span></pre></div>
<a id="trunkSourceWebKitSourcesCocoatxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/SourcesCocoa.txt (279719 => 279720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/SourcesCocoa.txt     2021-07-08 10:20:57 UTC (rev 279719)
+++ trunk/Source/WebKit/SourcesCocoa.txt        2021-07-08 11:46:21 UTC (rev 279720)
</span><span class="lines">@@ -664,6 +664,7 @@
</span><span class="cx"> WebProcess/Plugins/PDF/PDFPluginPasswordField.mm
</span><span class="cx"> WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm
</span><span class="cx"> 
</span><ins>+WebProcess/WebCoreSupport/WebCaptionPreferencesDelegate.cpp
</ins><span class="cx"> WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp
</span><span class="cx"> WebProcess/WebCoreSupport/WebValidationMessageClient.cpp
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessCocoaWebProcessProxyCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm (279719 => 279720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm      2021-07-08 10:20:57 UTC (rev 279719)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm 2021-07-08 11:46:21 UTC (rev 279720)
</span><span class="lines">@@ -37,7 +37,6 @@
</span><span class="cx"> #import "WKTypeRefWrapper.h"
</span><span class="cx"> #import "WebProcessMessages.h"
</span><span class="cx"> #import "WebProcessPool.h"
</span><del>-#import <pal/cf/AudioToolboxSoftLink.h>
</del><span class="cx"> #import <sys/sysctl.h>
</span><span class="cx"> #import <wtf/NeverDestroyed.h>
</span><span class="cx"> #import <wtf/Scope.h>
</span><span class="lines">@@ -53,10 +52,16 @@
</span><span class="cx"> #import <JavaScriptCore/RemoteInspectorConstants.h>
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
+#include <WebCore/CaptionUserPreferencesMediaAF.h>
+#endif
+
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> #include "TCCSoftLink.h"
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#import <pal/cf/AudioToolboxSoftLink.h>
+
</ins><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="cx"> static const Seconds unexpectedActivityDuration = 10_s;
</span><span class="lines">@@ -210,6 +215,18 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
+void WebProcessProxy::setCaptionDisplayMode(WebCore::CaptionUserPreferences::CaptionDisplayMode displayMode)
+{
+    WebCore::CaptionUserPreferencesMediaAF::platformSetCaptionDisplayMode(displayMode);
+}
+
+void WebProcessProxy::setCaptionLanguage(const String& language)
+{
+    WebCore::CaptionUserPreferencesMediaAF::platformSetPreferredLanguage(language);
+}
+#endif
+
</ins><span class="cx"> void WebProcessProxy::unblockAccessibilityServerIfNeeded()
</span><span class="cx"> {
</span><span class="cx">     if (m_hasSentMessageToUnblockAccessibilityServer)
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebProcessProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.h (279719 => 279720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebProcessProxy.h  2021-07-08 10:20:57 UTC (rev 279719)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.h     2021-07-08 11:46:21 UTC (rev 279720)
</span><span class="lines">@@ -62,6 +62,10 @@
</span><span class="cx"> #include <wtf/RobinHoodHashSet.h>
</span><span class="cx"> #include <wtf/WeakHashSet.h>
</span><span class="cx"> 
</span><ins>+#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
+#include <WebCore/CaptionUserPreferences.h>
+#endif
+
</ins><span class="cx"> namespace API {
</span><span class="cx"> class Navigation;
</span><span class="cx"> class PageConfiguration;
</span><span class="lines">@@ -409,6 +413,11 @@
</span><span class="cx">     void platformResumeProcess();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
+    void setCaptionDisplayMode(WebCore::CaptionUserPreferences::CaptionDisplayMode);
+    void setCaptionLanguage(const String&);
+#endif
+
</ins><span class="cx"> protected:
</span><span class="cx">     WebProcessProxy(WebProcessPool&, WebsiteDataStore*, IsPrewarmed);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebProcessProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in (279719 => 279720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in        2021-07-08 10:20:57 UTC (rev 279719)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in   2021-07-08 11:46:21 UTC (rev 279720)
</span><span class="lines">@@ -91,4 +91,9 @@
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     IsAXAuthenticated(audit_token_t auditToken) -> (bool authenticated) Synchronous
</span><span class="cx"> #endif
</span><ins>+
+#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
+    SetCaptionDisplayMode(WebCore::CaptionUserPreferences::CaptionDisplayMode mode)
+    SetCaptionLanguage(String language)
+#endif
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitWebKitxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (279719 => 279720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj     2021-07-08 10:20:57 UTC (rev 279719)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj        2021-07-08 11:46:21 UTC (rev 279720)
</span><span class="lines">@@ -5921,6 +5921,8 @@
</span><span class="cx">          E39628DB23960CC500658ECD /* WebDeviceOrientationUpdateProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDeviceOrientationUpdateProvider.h; sourceTree = "<group>"; };
</span><span class="cx">          E39628DC23960CC600658ECD /* WebDeviceOrientationUpdateProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebDeviceOrientationUpdateProvider.cpp; sourceTree = "<group>"; };
</span><span class="cx">          E39628E423971F3400658ECD /* WebDeviceOrientationUpdateProvider.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebDeviceOrientationUpdateProvider.messages.in; sourceTree = "<group>"; };
</span><ins>+               E3A86FBB26958D830059264D /* WebCaptionPreferencesDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebCaptionPreferencesDelegate.h; sourceTree = "<group>"; };
+               E3A86FBC26958E330059264D /* WebCaptionPreferencesDelegate.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebCaptionPreferencesDelegate.cpp; sourceTree = "<group>"; };
</ins><span class="cx">           E3BCE877267252120011D8DB /* AccessibilityPreferences.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityPreferences.cpp; sourceTree = "<group>"; };
</span><span class="cx">          E3BCE878267252120011D8DB /* AccessibilityPreferences.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AccessibilityPreferences.h; sourceTree = "<group>"; };
</span><span class="cx">          E3CAAA432413278A00CED2E2 /* AccessibilitySupportSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilitySupportSPI.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -9846,6 +9848,8 @@
</span><span class="cx">                          F43A9CDE25D72E2D00990E26 /* ShareableBitmapUtilities.cpp */,
</span><span class="cx">                          F43A9CDD25D72E0C00990E26 /* ShareableBitmapUtilities.h */,
</span><span class="cx">                          CEDA12DE152CCAE800D9E08D /* WebAlternativeTextClient.h */,
</span><ins>+                               E3A86FBC26958E330059264D /* WebCaptionPreferencesDelegate.cpp */,
+                               E3A86FBB26958D830059264D /* WebCaptionPreferencesDelegate.h */,
</ins><span class="cx">                           BC111A53112F4FBB00337BAB /* WebChromeClient.cpp */,
</span><span class="cx">                          BC032D6010F4378D0058C15A /* WebChromeClient.h */,
</span><span class="cx">                          3F87B9BA15893F630090FF62 /* WebColorChooser.cpp */,
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebCoreSupportWebCaptionPreferencesDelegatecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebCaptionPreferencesDelegate.cpp (0 => 279720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebCaptionPreferencesDelegate.cpp                          (rev 0)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebCaptionPreferencesDelegate.cpp     2021-07-08 11:46:21 UTC (rev 279720)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+/*
+* Copyright (C) 2021 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#pragma once
+
+#include "config.h"
+#include "WebCaptionPreferencesDelegate.h"
+
+#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
+
+#include "WebProcess.h"
+#include "WebProcessProxyMessages.h"
+
+namespace WebKit {
+
+void WebCaptionPreferencesDelegate::setDisplayMode(WebCore::CaptionUserPreferences::CaptionDisplayMode displayMode)
+{
+    WebProcess::singleton().parentProcessConnection()->send(Messages::WebProcessProxy::SetCaptionDisplayMode(displayMode), 0);
+}
+
+void WebCaptionPreferencesDelegate::setPreferredLanguage(const String& language)
+{
+    WebProcess::singleton().parentProcessConnection()->send(Messages::WebProcessProxy::SetCaptionLanguage(language), 0);
+}
+
+} // namespace WebKit
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebCoreSupportWebCaptionPreferencesDelegateh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebCaptionPreferencesDelegate.h (0 => 279720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebCaptionPreferencesDelegate.h                            (rev 0)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebCaptionPreferencesDelegate.h       2021-07-08 11:46:21 UTC (rev 279720)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+/*
+* Copyright (C) 2021 Apple Inc. All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions
+* are met:
+* 1. Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+* 2. Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the distribution.
+*
+* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+* PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#pragma once
+
+#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
+
+#include <WebCore/CaptionPreferencesDelegate.h>
+
+namespace WebKit {
+
+class WebCaptionPreferencesDelegate final : public WebCore::CaptionPreferencesDelegate {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    virtual ~WebCaptionPreferencesDelegate() { }
+
+    void setDisplayMode(WebCore::CaptionUserPreferences::CaptionDisplayMode) final;
+    void setPreferredLanguage(const String&) final;
+};
+
+} // namespace WebKit
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitWebProcesscocoaWebProcessCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (279719 => 279720)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm  2021-07-08 10:20:57 UTC (rev 279719)
+++ trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm     2021-07-08 11:46:21 UTC (rev 279720)
</span><span class="lines">@@ -153,7 +153,8 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
</span><del>-#include <WebCore/CaptionUserPreferencesMediaAF.h>
</del><ins>+#import "WebCaptionPreferencesDelegate.h"
+#import <WebCore/CaptionUserPreferencesMediaAF.h>
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #import <WebCore/MediaAccessibilitySoftLink.h>
</span><span class="lines">@@ -463,6 +464,10 @@
</span><span class="cx"> 
</span><span class="cx">     SystemSoundManager::singleton().setSystemSoundDelegate(makeUnique<WebSystemSoundDelegate>());
</span><span class="cx"> 
</span><ins>+#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
+    WebCore::CaptionUserPreferencesMediaAF::setCaptionPreferencesDelegate(makeUnique<WebCaptionPreferencesDelegate>());
+#endif
+
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     if (canLoad_HIServices__AXSetAuditTokenIsAuthenticatedCallback())
</span><span class="cx">         softLink_HIServices__AXSetAuditTokenIsAuthenticatedCallback(isAXAuthenticatedCallback);
</span></span></pre>
</div>
</div>

</body>
</html>