Title: [256818] branches/safari-609-branch/Source
Revision
256818
Author
[email protected]
Date
2020-02-17 22:10:11 -0800 (Mon, 17 Feb 2020)

Log Message

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

    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 (256817 => 256818)


--- branches/safari-609-branch/Source/WebCore/ChangeLog	2020-02-18 06:10:03 UTC (rev 256817)
+++ branches/safari-609-branch/Source/WebCore/ChangeLog	2020-02-18 06:10:11 UTC (rev 256818)
@@ -1,5 +1,57 @@
 2020-02-17  Alan Coon  <[email protected]>
 
+        Cherry-pick r255881. rdar://problem/59447271
+
+    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  <[email protected]>
+
+            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-17  Alan Coon  <[email protected]>
+
         Cherry-pick r256632. rdar://problem/59478906
 
     NetworkLoadMetrics should be shared by multiple ResourceResponse instances

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


--- branches/safari-609-branch/Source/WebCore/PAL/ChangeLog	2020-02-18 06:10:03 UTC (rev 256817)
+++ branches/safari-609-branch/Source/WebCore/PAL/ChangeLog	2020-02-18 06:10:11 UTC (rev 256818)
@@ -1,3 +1,54 @@
+2020-02-17  Alan Coon  <[email protected]>
+
+        Cherry-pick r255881. rdar://problem/59447271
+
+    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  <[email protected]>
+
+            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-14  Russell Epstein  <[email protected]>
 
         Cherry-pick r256320. rdar://problem/59447006

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


--- branches/safari-609-branch/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.cpp	2020-02-18 06:10:03 UTC (rev 256817)
+++ branches/safari-609-branch/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.cpp	2020-02-18 06:10:11 UTC (rev 256818)
@@ -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 (256817 => 256818)


--- branches/safari-609-branch/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.h	2020-02-18 06:10:03 UTC (rev 256817)
+++ branches/safari-609-branch/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.h	2020-02-18 06:10:11 UTC (rev 256818)
@@ -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 (256817 => 256818)


--- branches/safari-609-branch/Source/WebCore/platform/PlatformScreen.h	2020-02-18 06:10:03 UTC (rev 256817)
+++ branches/safari-609-branch/Source/WebCore/platform/PlatformScreen.h	2020-02-18 06:10:11 UTC (rev 256818)
@@ -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 (256817 => 256818)


--- branches/safari-609-branch/Source/WebCore/platform/mac/PlatformScreenMac.mm	2020-02-18 06:10:03 UTC (rev 256817)
+++ branches/safari-609-branch/Source/WebCore/platform/mac/PlatformScreenMac.mm	2020-02-18 06:10:11 UTC (rev 256818)
@@ -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 (256817 => 256818)


--- branches/safari-609-branch/Source/WebKit/ChangeLog	2020-02-18 06:10:03 UTC (rev 256817)
+++ branches/safari-609-branch/Source/WebKit/ChangeLog	2020-02-18 06:10:11 UTC (rev 256818)
@@ -1,5 +1,68 @@
 2020-02-17  Alan Coon  <[email protected]>
 
+        Cherry-pick r255881. rdar://problem/59447271
+
+    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  <[email protected]>
+
+            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-17  Alan Coon  <[email protected]>
+
         Cherry-pick r256632. rdar://problem/59478906
 
     NetworkLoadMetrics should be shared by multiple ResourceResponse instances

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


--- branches/safari-609-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-02-18 06:10:03 UTC (rev 256817)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2020-02-18 06:10:11 UTC (rev 256818)
@@ -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 (256817 => 256818)


--- branches/safari-609-branch/Source/WebKit/WebProcess/WebProcess.cpp	2020-02-18 06:10:03 UTC (rev 256817)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/WebProcess.cpp	2020-02-18 06:10:11 UTC (rev 256818)
@@ -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 (256817 => 256818)


--- branches/safari-609-branch/Source/WebKit/WebProcess/WebProcess.h	2020-02-18 06:10:03 UTC (rev 256817)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/WebProcess.h	2020-02-18 06:10:11 UTC (rev 256818)
@@ -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 (256817 => 256818)


--- branches/safari-609-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-02-18 06:10:03 UTC (rev 256817)
+++ branches/safari-609-branch/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm	2020-02-18 06:10:11 UTC (rev 256818)
@@ -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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to