Title: [256407] branches/safari-609-branch/Source
Revision
256407
Author
alanc...@apple.com
Date
2020-02-11 16:59:52 -0800 (Tue, 11 Feb 2020)

Log Message

Cherry-pick r255881. rdar://problem/59299143

    Adopt MTOverrideShouldPlayHDRVideo()
    https://bugs.webkit.org/show_bug.cgi?id=207275
    <rdar://problem/58837093>

    Reviewed by Eric Carlson.

    Source/WebCore:

    * platform/PlatformScreen.h:
    * platform/mac/PlatformScreenMac.mm:
    (WebCore::setShouldOverrideScreenSupportsHighDynamicRange):

    Source/WebCore/PAL:

    * pal/cocoa/MediaToolboxSoftLink.cpp:
    * pal/cocoa/MediaToolboxSoftLink.h:

    Source/WebKit:

    The WebProcess sandbox can block access to the services necessary for MediaToolbox to determine whether
    the current display is capable of displaying HDR. Rather than opening up the sandbox, provide the information
    gathered by the UIProcess by way of MTOverrideShouldPlayHDRVideo().

    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::windowScreenDidChange):
    (WebKit::WebPage::displayID const):
    * WebProcess/WebPage/WebPage.h:
    * WebProcess/WebProcess.cpp:
    (WebKit::WebProcess::setScreenProperties): Deleted.
    * WebProcess/WebProcess.h:
    * WebProcess/cocoa/WebProcessCocoa.mm:
    (WebKit::WebProcess::setScreenProperties):
    (WebKit::WebProcess::updatePageScreenProperties):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255881 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-609-branch/Source/WebCore/ChangeLog (256406 => 256407)


--- branches/safari-609-branch/Source/WebCore/ChangeLog	2020-02-12 00:59:48 UTC (rev 256406)
+++ branches/safari-609-branch/Source/WebCore/ChangeLog	2020-02-12 00:59:52 UTC (rev 256407)
@@ -1,5 +1,57 @@
 2020-02-11  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r255881. rdar://problem/59299143
+
+    Adopt MTOverrideShouldPlayHDRVideo()
+    https://bugs.webkit.org/show_bug.cgi?id=207275
+    <rdar://problem/58837093>
+    
+    Reviewed by Eric Carlson.
+    
+    Source/WebCore:
+    
+    * platform/PlatformScreen.h:
+    * platform/mac/PlatformScreenMac.mm:
+    (WebCore::setShouldOverrideScreenSupportsHighDynamicRange):
+    
+    Source/WebCore/PAL:
+    
+    * pal/cocoa/MediaToolboxSoftLink.cpp:
+    * pal/cocoa/MediaToolboxSoftLink.h:
+    
+    Source/WebKit:
+    
+    The WebProcess sandbox can block access to the services necessary for MediaToolbox to determine whether
+    the current display is capable of displaying HDR. Rather than opening up the sandbox, provide the information
+    gathered by the UIProcess by way of MTOverrideShouldPlayHDRVideo().
+    
+    * WebProcess/WebPage/WebPage.cpp:
+    (WebKit::WebPage::windowScreenDidChange):
+    (WebKit::WebPage::displayID const):
+    * WebProcess/WebPage/WebPage.h:
+    * WebProcess/WebProcess.cpp:
+    (WebKit::WebProcess::setScreenProperties): Deleted.
+    * WebProcess/WebProcess.h:
+    * WebProcess/cocoa/WebProcessCocoa.mm:
+    (WebKit::WebProcess::setScreenProperties):
+    (WebKit::WebProcess::updatePageScreenProperties):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255881 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-02-05  Jer Noble  <jer.no...@apple.com>
+
+            Adopt MTOverrideShouldPlayHDRVideo()
+            https://bugs.webkit.org/show_bug.cgi?id=207275
+            <rdar://problem/58837093>
+
+            Reviewed by Eric Carlson.
+
+            * platform/PlatformScreen.h:
+            * platform/mac/PlatformScreenMac.mm:
+            (WebCore::setShouldOverrideScreenSupportsHighDynamicRange):
+
+2020-02-11  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r255846. rdar://problem/59299151
 
     Make WKWebView._negotiatedLegacyTLS accurate when loading main resouorce from network or cache

Modified: branches/safari-609-branch/Source/WebCore/PAL/ChangeLog (256406 => 256407)


--- branches/safari-609-branch/Source/WebCore/PAL/ChangeLog	2020-02-12 00:59:48 UTC (rev 256406)
+++ branches/safari-609-branch/Source/WebCore/PAL/ChangeLog	2020-02-12 00:59:52 UTC (rev 256407)
@@ -1,3 +1,54 @@
+2020-02-11  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r255881. rdar://problem/59299143
+
+    Adopt MTOverrideShouldPlayHDRVideo()
+    https://bugs.webkit.org/show_bug.cgi?id=207275
+    <rdar://problem/58837093>
+    
+    Reviewed by Eric Carlson.
+    
+    Source/WebCore:
+    
+    * platform/PlatformScreen.h:
+    * platform/mac/PlatformScreenMac.mm:
+    (WebCore::setShouldOverrideScreenSupportsHighDynamicRange):
+    
+    Source/WebCore/PAL:
+    
+    * pal/cocoa/MediaToolboxSoftLink.cpp:
+    * pal/cocoa/MediaToolboxSoftLink.h:
+    
+    Source/WebKit:
+    
+    The WebProcess sandbox can block access to the services necessary for MediaToolbox to determine whether
+    the current display is capable of displaying HDR. Rather than opening up the sandbox, provide the information
+    gathered by the UIProcess by way of MTOverrideShouldPlayHDRVideo().
+    
+    * WebProcess/WebPage/WebPage.cpp:
+    (WebKit::WebPage::windowScreenDidChange):
+    (WebKit::WebPage::displayID const):
+    * WebProcess/WebPage/WebPage.h:
+    * WebProcess/WebProcess.cpp:
+    (WebKit::WebProcess::setScreenProperties): Deleted.
+    * WebProcess/WebProcess.h:
+    * WebProcess/cocoa/WebProcessCocoa.mm:
+    (WebKit::WebProcess::setScreenProperties):
+    (WebKit::WebProcess::updatePageScreenProperties):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255881 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-02-05  Jer Noble  <jer.no...@apple.com>
+
+            Adopt MTOverrideShouldPlayHDRVideo()
+            https://bugs.webkit.org/show_bug.cgi?id=207275
+            <rdar://problem/58837093>
+
+            Reviewed by Eric Carlson.
+
+            * pal/cocoa/MediaToolboxSoftLink.cpp:
+            * pal/cocoa/MediaToolboxSoftLink.h:
+
 2020-02-04  Russell Epstein  <repst...@apple.com>
 
         Cherry-pick r255461. rdar://problem/59153618

Modified: branches/safari-609-branch/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.cpp (256406 => 256407)


--- branches/safari-609-branch/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.cpp	2020-02-12 00:59:48 UTC (rev 256406)
+++ branches/safari-609-branch/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.cpp	2020-02-12 00:59:52 UTC (rev 256407)
@@ -33,5 +33,6 @@
 SOFT_LINK_FRAMEWORK_FOR_SOURCE_WITH_EXPORT(PAL, MediaToolbox, PAL_EXPORT)
 
 SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE_WITH_EXPORT(PAL, MediaToolbox, MTShouldPlayHDRVideo, Boolean, (CFArrayRef displayList), (displayList), PAL_EXPORT)
+SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE_WITH_EXPORT(PAL, MediaToolbox, MTOverrideShouldPlayHDRVideo, void, (Boolean override, Boolean playHDRVideo), (override, playHDRVideo), PAL_EXPORT)
 
 #endif

Modified: branches/safari-609-branch/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.h (256406 => 256407)


--- branches/safari-609-branch/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.h	2020-02-12 00:59:48 UTC (rev 256406)
+++ branches/safari-609-branch/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.h	2020-02-12 00:59:52 UTC (rev 256407)
@@ -33,5 +33,6 @@
 SOFT_LINK_FRAMEWORK_FOR_HEADER(PAL, MediaToolbox)
 
 SOFT_LINK_FUNCTION_MAY_FAIL_FOR_HEADER(PAL, MediaToolbox, MTShouldPlayHDRVideo, Boolean, (CFArrayRef displayList), (displayList))
+SOFT_LINK_FUNCTION_MAY_FAIL_FOR_HEADER(PAL, MediaToolbox, MTOverrideShouldPlayHDRVideo, void, (Boolean override, Boolean playHDRVideo), (override, playHDRVideo))
 
 #endif

Modified: branches/safari-609-branch/Source/WebCore/platform/PlatformScreen.h (256406 => 256407)


--- branches/safari-609-branch/Source/WebCore/platform/PlatformScreen.h	2020-02-12 00:59:48 UTC (rev 256406)
+++ branches/safari-609-branch/Source/WebCore/platform/PlatformScreen.h	2020-02-12 00:59:52 UTC (rev 256407)
@@ -76,7 +76,7 @@
 WEBCORE_EXPORT bool screenSupportsExtendedColor(Widget* = nullptr);
 
 #if PLATFORM(MAC) || PLATFORM(IOS_FAMILY)
-bool screenSupportsHighDynamicRange(Widget* = nullptr);
+WEBCORE_EXPORT bool screenSupportsHighDynamicRange(Widget* = nullptr);
 #else
 constexpr bool screenSupportsHighDynamicRange(Widget* = nullptr) { return false; }
 #endif
@@ -105,6 +105,8 @@
 WEBCORE_EXPORT ScreenProperties collectScreenProperties();
 WEBCORE_EXPORT void setScreenProperties(const ScreenProperties&);
 
+WEBCORE_EXPORT void setShouldOverrideScreenSupportsHighDynamicRange(bool shouldOverride, bool supportsHighDynamicRange);
+
 WEBCORE_EXPORT PlatformDisplayID primaryScreenDisplayID();
 
 uint32_t primaryOpenGLDisplayMask();

Modified: branches/safari-609-branch/Source/WebCore/platform/mac/PlatformScreenMac.mm (256406 => 256407)


--- branches/safari-609-branch/Source/WebCore/platform/mac/PlatformScreenMac.mm	2020-02-12 00:59:48 UTC (rev 256406)
+++ branches/safari-609-branch/Source/WebCore/platform/mac/PlatformScreenMac.mm	2020-02-12 00:59:52 UTC (rev 256407)
@@ -156,6 +156,12 @@
     screenProperties() = properties;
 }
 
+void setShouldOverrideScreenSupportsHighDynamicRange(bool shouldOverride, bool supportsHighDynamicRange)
+{
+    if (PAL::canLoad_MediaToolbox_MTOverrideShouldPlayHDRVideo())
+        PAL::softLink_MediaToolbox_MTOverrideShouldPlayHDRVideo(shouldOverride, supportsHighDynamicRange);
+}
+
 static ScreenData screenData(PlatformDisplayID screendisplayID)
 {
     RELEASE_ASSERT(!screenProperties().screenDataMap.isEmpty());

Modified: branches/safari-609-branch/Source/WebKit/ChangeLog (256406 => 256407)


--- branches/safari-609-branch/Source/WebKit/ChangeLog	2020-02-12 00:59:48 UTC (rev 256406)
+++ branches/safari-609-branch/Source/WebKit/ChangeLog	2020-02-12 00:59:52 UTC (rev 256407)
@@ -1,5 +1,68 @@
 2020-02-11  Alan Coon  <alanc...@apple.com>
 
+        Cherry-pick r255881. rdar://problem/59299143
+
+    Adopt MTOverrideShouldPlayHDRVideo()
+    https://bugs.webkit.org/show_bug.cgi?id=207275
+    <rdar://problem/58837093>
+    
+    Reviewed by Eric Carlson.
+    
+    Source/WebCore:
+    
+    * platform/PlatformScreen.h:
+    * platform/mac/PlatformScreenMac.mm:
+    (WebCore::setShouldOverrideScreenSupportsHighDynamicRange):
+    
+    Source/WebCore/PAL:
+    
+    * pal/cocoa/MediaToolboxSoftLink.cpp:
+    * pal/cocoa/MediaToolboxSoftLink.h:
+    
+    Source/WebKit:
+    
+    The WebProcess sandbox can block access to the services necessary for MediaToolbox to determine whether
+    the current display is capable of displaying HDR. Rather than opening up the sandbox, provide the information
+    gathered by the UIProcess by way of MTOverrideShouldPlayHDRVideo().
+    
+    * WebProcess/WebPage/WebPage.cpp:
+    (WebKit::WebPage::windowScreenDidChange):
+    (WebKit::WebPage::displayID const):
+    * WebProcess/WebPage/WebPage.h:
+    * WebProcess/WebProcess.cpp:
+    (WebKit::WebProcess::setScreenProperties): Deleted.
+    * WebProcess/WebProcess.h:
+    * WebProcess/cocoa/WebProcessCocoa.mm:
+    (WebKit::WebProcess::setScreenProperties):
+    (WebKit::WebProcess::updatePageScreenProperties):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@255881 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-02-05  Jer Noble  <jer.no...@apple.com>
+
+            Adopt MTOverrideShouldPlayHDRVideo()
+            https://bugs.webkit.org/show_bug.cgi?id=207275
+            <rdar://problem/58837093>
+
+            Reviewed by Eric Carlson.
+
+            The WebProcess sandbox can block access to the services necessary for MediaToolbox to determine whether
+            the current display is capable of displaying HDR. Rather than opening up the sandbox, provide the information
+            gathered by the UIProcess by way of MTOverrideShouldPlayHDRVideo().
+
+            * WebProcess/WebPage/WebPage.cpp:
+            (WebKit::WebPage::windowScreenDidChange):
+            (WebKit::WebPage::displayID const):
+            * WebProcess/WebPage/WebPage.h:
+            * WebProcess/WebProcess.cpp:
+            (WebKit::WebProcess::setScreenProperties): Deleted.
+            * WebProcess/WebProcess.h:
+            * WebProcess/cocoa/WebProcessCocoa.mm:
+            (WebKit::WebProcess::setScreenProperties):
+            (WebKit::WebProcess::updatePageScreenProperties):
+
+2020-02-11  Alan Coon  <alanc...@apple.com>
+
         Cherry-pick r255846. rdar://problem/59299151
 
     Make WKWebView._negotiatedLegacyTLS accurate when loading main resouorce from network or cache

Modified: branches/safari-609-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp (256406 => 256407)


--- branches/safari-609-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-02-12 00:59:48 UTC (rev 256406)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-02-12 00:59:52 UTC (rev 256407)
@@ -1963,6 +1963,10 @@
 void WebPage::windowScreenDidChange(uint32_t displayID)
 {
     m_page->chrome().windowScreenDidChange(static_cast<PlatformDisplayID>(displayID));
+
+#if PLATFORM(MAC)
+    WebProcess::singleton().updatePageScreenProperties();
+#endif
 }
 
 void WebPage::scalePage(double scale, const IntPoint& origin)

Modified: branches/safari-609-branch/Source/WebKit/WebProcess/WebProcess.cpp (256406 => 256407)


--- branches/safari-609-branch/Source/WebKit/WebProcess/WebProcess.cpp	2020-02-12 00:59:48 UTC (rev 256406)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/WebProcess.cpp	2020-02-12 00:59:52 UTC (rev 256407)
@@ -1872,15 +1872,6 @@
 }
 #endif
 
-#if PLATFORM(MAC)
-void WebProcess::setScreenProperties(const WebCore::ScreenProperties& properties)
-{
-    WebCore::setScreenProperties(properties);
-    for (auto& page : m_pageMap.values())
-        page->screenPropertiesDidChange();
-}
-#endif
-
 #if ENABLE(MEDIA_STREAM)
 void WebProcess::addMockMediaDevice(const WebCore::MockMediaDevice& device)
 {

Modified: branches/safari-609-branch/Source/WebKit/WebProcess/WebProcess.h (256406 => 256407)


--- branches/safari-609-branch/Source/WebKit/WebProcess/WebProcess.h	2020-02-12 00:59:48 UTC (rev 256406)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/WebProcess.h	2020-02-12 00:59:52 UTC (rev 256407)
@@ -313,6 +313,10 @@
     bool removeServiceWorkerRegistration(WebCore::ServiceWorkerRegistrationIdentifier);
 #endif
 
+#if PLATFORM(MAC)
+    void updatePageScreenProperties();
+#endif
+
 private:
     WebProcess();
     ~WebProcess();

Modified: branches/safari-609-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm (256406 => 256407)


--- branches/safari-609-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-02-12 00:59:48 UTC (rev 256406)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-02-12 00:59:52 UTC (rev 256407)
@@ -77,6 +77,7 @@
 #import <pal/spi/mac/NSApplicationSPI.h>
 #import <stdio.h>
 #import <wtf/FileSystem.h>
+#import <wtf/ProcessPrivilege.h>
 #import <wtf/cocoa/NSURLExtras.h>
 
 #if PLATFORM(IOS)
@@ -891,6 +892,29 @@
     AVAssetMIMETypeCache::singleton().addSupportedTypes(types);
 }
 
+#if PLATFORM(MAC)
+void WebProcess::setScreenProperties(const ScreenProperties& properties)
+{
+    WebCore::setScreenProperties(properties);
+    for (auto& page : m_pageMap.values())
+        page->screenPropertiesDidChange();
+    updatePageScreenProperties();
+}
+
+void WebProcess::updatePageScreenProperties()
+{
+    if (hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer)) {
+        setShouldOverrideScreenSupportsHighDynamicRange(false, false);
+        return;
+    }
+
+    bool allPagesAreOnHDRScreens = allOf(m_pageMap.values(), [] (auto& page) {
+        return screenSupportsHighDynamicRange(page->mainFrameView());
+    });
+    setShouldOverrideScreenSupportsHighDynamicRange(true, allPagesAreOnHDRScreens);
+}
+#endif
+
 } // namespace WebKit
 
 #undef RELEASE_LOG_SESSION_ID
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to