Diff
Modified: trunk/Source/WebCore/ChangeLog (279719 => 279720)
--- 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)
@@ -1,3 +1,29 @@
+2021-07-08 Per Arne <[email protected]>
+
+ 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):
+
2021-07-08 Martin Robinson <[email protected]>
[css-scroll-snap] scroll-snap-align should use the box's writing-mode when the box is larger than the snapport
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (279719 => 279720)
--- 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)
@@ -5173,6 +5173,7 @@
E39628C12395743100658ECD /* MotionManagerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = E39628C02395743000658ECD /* MotionManagerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
E3A776671DC85D2800B690D8 /* DOMJITIDLConvert.h in Headers */ = {isa = PBXBuildFile; fileRef = E3A776651DC85D2200B690D8 /* DOMJITIDLConvert.h */; settings = {ATTRIBUTES = (Private, ); }; };
E3A776681DC85D2800B690D8 /* DOMJITIDLType.h in Headers */ = {isa = PBXBuildFile; fileRef = E3A776661DC85D2200B690D8 /* DOMJITIDLType.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ E3A86FC32695EB480059264D /* CaptionPreferencesDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = E3A86FC12695EB480059264D /* CaptionPreferencesDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
E3AFD7AD255F50EB00E5E30E /* WorkerThreadType.h in Headers */ = {isa = PBXBuildFile; fileRef = E3AFD7AB255F50DC00E5E30E /* WorkerThreadType.h */; settings = {ATTRIBUTES = (Private, ); }; };
E3B2F0ED1D7F4CA300B0C9D1 /* LoadableScript.h in Headers */ = {isa = PBXBuildFile; fileRef = E3B2F0E71D7F35EC00B0C9D1 /* LoadableScript.h */; settings = {ATTRIBUTES = (Private, ); }; };
E3B2F0EE1D7F4CA900B0C9D1 /* LoadableScriptClient.h in Headers */ = {isa = PBXBuildFile; fileRef = E3B2F0E81D7F35EC00B0C9D1 /* LoadableScriptClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -5523,7 +5524,6 @@
FD3160AB12B026F700C1A359 /* ReverbConvolverStage.h in Headers */ = {isa = PBXBuildFile; fileRef = FD31607512B026F700C1A359 /* ReverbConvolverStage.h */; };
FD3160AD12B026F700C1A359 /* ReverbInputBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = FD31607712B026F700C1A359 /* ReverbInputBuffer.h */; };
FD3160AF12B026F700C1A359 /* VectorMath.h in Headers */ = {isa = PBXBuildFile; fileRef = FD31607912B026F700C1A359 /* VectorMath.h */; };
- FD3160BF12B0272A00C1A359 /* AudioFileReaderMac.h in Headers */ = {isa = PBXBuildFile; fileRef = FD3160B912B0272A00C1A359 /* AudioFileReaderMac.h */; };
FD359190138DB22000E1EBEC /* AudioParamTimeline.h in Headers */ = {isa = PBXBuildFile; fileRef = FD35918E138DB22000E1EBEC /* AudioParamTimeline.h */; };
FD45A94F175D3F3E00C21EC8 /* Shape.h in Headers */ = {isa = PBXBuildFile; fileRef = FD08A87F175D3926002CD360 /* Shape.h */; settings = {ATTRIBUTES = (Private, ); }; };
FD45A952175D3F3E00C21EC8 /* ShapeOutsideInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = FD08A887175D3926002CD360 /* ShapeOutsideInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -16513,6 +16513,7 @@
E398FC231DC32A1B003C4684 /* DOMJITHelpers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMJITHelpers.cpp; sourceTree = "<group>"; };
E3A776651DC85D2200B690D8 /* DOMJITIDLConvert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMJITIDLConvert.h; sourceTree = "<group>"; };
E3A776661DC85D2200B690D8 /* DOMJITIDLType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMJITIDLType.h; sourceTree = "<group>"; };
+ E3A86FC12695EB480059264D /* CaptionPreferencesDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CaptionPreferencesDelegate.h; sourceTree = "<group>"; };
E3AE6CD12252F27000C70B50 /* AllDescendantsCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AllDescendantsCollection.cpp; sourceTree = "<group>"; };
E3AFA9641DA6E908002861BD /* JSNodeDOMJIT.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNodeDOMJIT.cpp; sourceTree = "<group>"; };
E3AFD7AB255F50DC00E5E30E /* WorkerThreadType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WorkerThreadType.h; sourceTree = "<group>"; };
@@ -28080,6 +28081,7 @@
B2C3D9EC0D006C1D00EF6F26 /* text */,
E1EE8B6B2412B2A700E794D6 /* xr */,
DFDB912CF8E88A6DA1AD264F /* AbortableTaskQueue.h */,
+ E3A86FC12695EB480059264D /* CaptionPreferencesDelegate.h */,
C330A22113EC196B0000B45B /* ColorChooser.h */,
C37CDEBC149EF2030042090D /* ColorChooserClient.h */,
BCC8CFCA0986CD2400140BF2 /* ColorData.gperf */,
@@ -31777,8 +31779,6 @@
FD31608212B026F700C1A359 /* AudioDSPKernelProcessor.h in Headers */,
FD31608312B026F700C1A359 /* AudioFileReader.h in Headers */,
46AAAA3D25D3632000BAF42F /* AudioFileReaderCocoa.h in Headers */,
- CD5596921475B678001D0BD0 /* AudioFileReaderIOS.h in Headers */,
- FD3160BF12B0272A00C1A359 /* AudioFileReaderMac.h in Headers */,
CD2F4A2418D89F700063746D /* AudioHardwareListener.h in Headers */,
CD2F4A2818D8A3490063746D /* AudioHardwareListenerMac.h in Headers */,
FDE2D55B159E66EB00DCCCF8 /* AudioIOCallback.h in Headers */,
@@ -31995,6 +31995,7 @@
49484FCE102CF23C00187DD3 /* CanvasStyle.h in Headers */,
7C193BBF1F5E0EED0088F3E6 /* CanvasTextAlign.h in Headers */,
7C193BC01F5E0EED0088F3E6 /* CanvasTextBaseline.h in Headers */,
+ E3A86FC32695EB480059264D /* CaptionPreferencesDelegate.h in Headers */,
079D0868162F20E800DB8658 /* CaptionUserPreferences.h in Headers */,
079D086B162F21F900DB8658 /* CaptionUserPreferencesMediaAF.h in Headers */,
07B7116D1D899E63009F0FFB /* CaptureDevice.h in Headers */,
Modified: trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.cpp (279719 => 279720)
--- 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)
@@ -100,6 +100,12 @@
#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
+static std::unique_ptr<CaptionPreferencesDelegate>& captionPreferencesDelegate()
+{
+ static NeverDestroyed<std::unique_ptr<CaptionPreferencesDelegate>> delegate;
+ return delegate.get();
+}
+
static std::optional<CaptionUserPreferencesMediaAF::CaptionDisplayMode>& cachedCaptionDisplayMode()
{
static NeverDestroyed<std::optional<CaptionUserPreferencesMediaAF::CaptionDisplayMode>> captionDisplayMode;
@@ -177,17 +183,9 @@
return platformCaptionDisplayMode();
}
-
-void CaptionUserPreferencesMediaAF::setCaptionDisplayMode(CaptionUserPreferences::CaptionDisplayMode mode)
+
+void CaptionUserPreferencesMediaAF::platformSetCaptionDisplayMode(CaptionDisplayMode mode)
{
- if (testingMode() || !MediaAccessibilityLibrary()) {
- CaptionUserPreferences::setCaptionDisplayMode(mode);
- return;
- }
-
- if (captionDisplayMode() == Manual)
- return;
-
MACaptionAppearanceDisplayType displayType = kMACaptionAppearanceDisplayTypeForcedOnly;
switch (mode) {
case Automatic:
@@ -207,6 +205,24 @@
MACaptionAppearanceSetDisplayType(kMACaptionAppearanceDomainUser, displayType);
}
+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);
+}
+
CaptionUserPreferences::CaptionDisplayMode CaptionUserPreferencesMediaAF::platformCaptionDisplayMode()
{
MACaptionAppearanceDisplayType displayType = MACaptionAppearanceGetDisplayType(kMACaptionAppearanceDomainUser);
@@ -291,6 +307,11 @@
CaptionUserPreferences::captionPreferencesChanged();
}
+void CaptionUserPreferencesMediaAF::setCaptionPreferencesDelegate(std::unique_ptr<CaptionPreferencesDelegate>&& delegate)
+{
+ captionPreferencesDelegate() = WTFMove(delegate);
+}
+
String CaptionUserPreferencesMediaAF::captionsWindowCSS() const
{
MACaptionAppearanceBehavior behavior;
@@ -481,6 +502,11 @@
#endif
}
+void CaptionUserPreferencesMediaAF::platformSetPreferredLanguage(const String& language)
+{
+ MACaptionAppearanceAddSelectedLanguage(kMACaptionAppearanceDomainUser, language.createCFString().get());
+}
+
void CaptionUserPreferencesMediaAF::setPreferredLanguage(const String& language)
{
if (CaptionUserPreferences::captionDisplayMode() == Manual)
@@ -491,7 +517,12 @@
return;
}
- MACaptionAppearanceAddSelectedLanguage(kMACaptionAppearanceDomainUser, language.createCFString().get());
+ if (captionPreferencesDelegate()) {
+ captionPreferencesDelegate()->setPreferredLanguage(language);
+ return;
+ }
+
+ platformSetPreferredLanguage(language);
}
Vector<String> CaptionUserPreferencesMediaAF::preferredLanguages() const
Modified: trunk/Source/WebCore/page/CaptionUserPreferencesMediaAF.h (279719 => 279720)
--- 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)
@@ -28,6 +28,7 @@
#if ENABLE(VIDEO)
#include "CSSPropertyNames.h"
+#include "CaptionPreferencesDelegate.h"
#include "CaptionUserPreferences.h"
#include "Color.h"
@@ -44,6 +45,7 @@
void setCaptionDisplayMode(CaptionDisplayMode) override;
WEBCORE_EXPORT static CaptionDisplayMode platformCaptionDisplayMode();
+ WEBCORE_EXPORT static void platformSetCaptionDisplayMode(CaptionDisplayMode);
WEBCORE_EXPORT static void setCachedCaptionDisplayMode(CaptionDisplayMode);
bool userPrefersCaptions() const override;
@@ -58,6 +60,7 @@
Vector<String> preferredLanguages() const override;
WEBCORE_EXPORT static Vector<String> platformPreferredLanguages();
+ WEBCORE_EXPORT static void platformSetPreferredLanguage(const String&);
WEBCORE_EXPORT static void setCachedPreferredLanguages(const Vector<String>&);
void setPreferredAudioCharacteristic(const String&) override;
@@ -66,6 +69,8 @@
void captionPreferencesChanged() override;
bool shouldFilterTrackMenu() const { return true; }
+
+ WEBCORE_EXPORT static void setCaptionPreferencesDelegate(std::unique_ptr<CaptionPreferencesDelegate>&&);
#else
bool shouldFilterTrackMenu() const { return false; }
#endif
Added: trunk/Source/WebCore/platform/CaptionPreferencesDelegate.h (0 => 279720)
--- trunk/Source/WebCore/platform/CaptionPreferencesDelegate.h (rev 0)
+++ trunk/Source/WebCore/platform/CaptionPreferencesDelegate.h 2021-07-08 11:46:21 UTC (rev 279720)
@@ -0,0 +1,44 @@
+/*
+* 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
Modified: trunk/Source/WebKit/ChangeLog (279719 => 279720)
--- 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)
@@ -1,3 +1,27 @@
+2021-07-08 Per Arne <[email protected]>
+
+ 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):
+
2021-07-07 Tim Horton <[email protected]>
Add WKHoverPlatter and some knobs to tweak its appearance
Modified: trunk/Source/WebKit/SourcesCocoa.txt (279719 => 279720)
--- 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)
@@ -664,6 +664,7 @@
WebProcess/Plugins/PDF/PDFPluginPasswordField.mm
WebProcess/Plugins/PDF/PDFPluginTextAnnotation.mm
+WebProcess/WebCoreSupport/WebCaptionPreferencesDelegate.cpp
WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp
WebProcess/WebCoreSupport/WebValidationMessageClient.cpp
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm (279719 => 279720)
--- 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)
@@ -37,7 +37,6 @@
#import "WKTypeRefWrapper.h"
#import "WebProcessMessages.h"
#import "WebProcessPool.h"
-#import <pal/cf/AudioToolboxSoftLink.h>
#import <sys/sysctl.h>
#import <wtf/NeverDestroyed.h>
#import <wtf/Scope.h>
@@ -53,10 +52,16 @@
#import <_javascript_Core/RemoteInspectorConstants.h>
#endif
+#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
+#include <WebCore/CaptionUserPreferencesMediaAF.h>
+#endif
+
#if PLATFORM(MAC)
#include "TCCSoftLink.h"
#endif
+#import <pal/cf/AudioToolboxSoftLink.h>
+
namespace WebKit {
static const Seconds unexpectedActivityDuration = 10_s;
@@ -210,6 +215,18 @@
}
#endif
+#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
+
void WebProcessProxy::unblockAccessibilityServerIfNeeded()
{
if (m_hasSentMessageToUnblockAccessibilityServer)
Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.h (279719 => 279720)
--- 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)
@@ -62,6 +62,10 @@
#include <wtf/RobinHoodHashSet.h>
#include <wtf/WeakHashSet.h>
+#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
+#include <WebCore/CaptionUserPreferences.h>
+#endif
+
namespace API {
class Navigation;
class PageConfiguration;
@@ -409,6 +413,11 @@
void platformResumeProcess();
#endif
+#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
+ void setCaptionDisplayMode(WebCore::CaptionUserPreferences::CaptionDisplayMode);
+ void setCaptionLanguage(const String&);
+#endif
+
protected:
WebProcessProxy(WebProcessPool&, WebsiteDataStore*, IsPrewarmed);
Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in (279719 => 279720)
--- 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)
@@ -91,4 +91,9 @@
#if PLATFORM(MAC)
IsAXAuthenticated(audit_token_t auditToken) -> (bool authenticated) Synchronous
#endif
+
+#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
+ SetCaptionDisplayMode(WebCore::CaptionUserPreferences::CaptionDisplayMode mode)
+ SetCaptionLanguage(String language)
+#endif
}
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (279719 => 279720)
--- 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)
@@ -5921,6 +5921,8 @@
E39628DB23960CC500658ECD /* WebDeviceOrientationUpdateProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDeviceOrientationUpdateProvider.h; sourceTree = "<group>"; };
E39628DC23960CC600658ECD /* WebDeviceOrientationUpdateProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebDeviceOrientationUpdateProvider.cpp; sourceTree = "<group>"; };
E39628E423971F3400658ECD /* WebDeviceOrientationUpdateProvider.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebDeviceOrientationUpdateProvider.messages.in; sourceTree = "<group>"; };
+ 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>"; };
E3BCE877267252120011D8DB /* AccessibilityPreferences.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityPreferences.cpp; sourceTree = "<group>"; };
E3BCE878267252120011D8DB /* AccessibilityPreferences.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AccessibilityPreferences.h; sourceTree = "<group>"; };
E3CAAA432413278A00CED2E2 /* AccessibilitySupportSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilitySupportSPI.h; sourceTree = "<group>"; };
@@ -9846,6 +9848,8 @@
F43A9CDE25D72E2D00990E26 /* ShareableBitmapUtilities.cpp */,
F43A9CDD25D72E0C00990E26 /* ShareableBitmapUtilities.h */,
CEDA12DE152CCAE800D9E08D /* WebAlternativeTextClient.h */,
+ E3A86FBC26958E330059264D /* WebCaptionPreferencesDelegate.cpp */,
+ E3A86FBB26958D830059264D /* WebCaptionPreferencesDelegate.h */,
BC111A53112F4FBB00337BAB /* WebChromeClient.cpp */,
BC032D6010F4378D0058C15A /* WebChromeClient.h */,
3F87B9BA15893F630090FF62 /* WebColorChooser.cpp */,
Added: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebCaptionPreferencesDelegate.cpp (0 => 279720)
--- 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)
@@ -0,0 +1,50 @@
+/*
+* 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
Added: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebCaptionPreferencesDelegate.h (0 => 279720)
--- 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)
@@ -0,0 +1,45 @@
+/*
+* 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
Modified: trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (279719 => 279720)
--- 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)
@@ -153,7 +153,8 @@
#endif
#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
-#include <WebCore/CaptionUserPreferencesMediaAF.h>
+#import "WebCaptionPreferencesDelegate.h"
+#import <WebCore/CaptionUserPreferencesMediaAF.h>
#endif
#import <WebCore/MediaAccessibilitySoftLink.h>
@@ -463,6 +464,10 @@
SystemSoundManager::singleton().setSystemSoundDelegate(makeUnique<WebSystemSoundDelegate>());
+#if HAVE(MEDIA_ACCESSIBILITY_FRAMEWORK)
+ WebCore::CaptionUserPreferencesMediaAF::setCaptionPreferencesDelegate(makeUnique<WebCaptionPreferencesDelegate>());
+#endif
+
#if PLATFORM(MAC)
if (canLoad_HIServices__AXSetAuditTokenIsAuthenticatedCallback())
softLink_HIServices__AXSetAuditTokenIsAuthenticatedCallback(isAXAuthenticatedCallback);