Diff
Modified: trunk/LayoutTests/ChangeLog (252761 => 252762)
--- trunk/LayoutTests/ChangeLog 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/LayoutTests/ChangeLog 2019-11-22 05:17:02 UTC (rev 252762)
@@ -1,3 +1,13 @@
+2019-11-21 Jer Noble <[email protected]>
+
+ Experimental support for HDR media query
+ https://bugs.webkit.org/show_bug.cgi?id=204422
+
+ Reviewed by Eric Carlson.
+
+ * fast/media/mq-highdynamicrange-live-update-expected.txt: Added.
+ * fast/media/mq-highdynamicrange-live-update.html: Added.
+
2019-11-21 Ryosuke Niwa <[email protected]>
Scrolling to fragment shouldn't happen as a part of updating style
Added: trunk/LayoutTests/fast/media/mq-highdynamicrange-live-update-expected.txt (0 => 252762)
--- trunk/LayoutTests/fast/media/mq-highdynamicrange-live-update-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/media/mq-highdynamicrange-live-update-expected.txt 2019-11-22 05:17:02 UTC (rev 252762)
@@ -0,0 +1,3 @@
+Before was: rgb(0, 0, 0) - should be rgb(0, 0, 0)
+
+After was: rgb(0, 128, 0) - should be rgb(0, 128, 0)
Added: trunk/LayoutTests/fast/media/mq-highdynamicrange-live-update.html (0 => 252762)
--- trunk/LayoutTests/fast/media/mq-highdynamicrange-live-update.html (rev 0)
+++ trunk/LayoutTests/fast/media/mq-highdynamicrange-live-update.html 2019-11-22 05:17:02 UTC (rev 252762)
@@ -0,0 +1,36 @@
+<html>
+<head>
+<title>CSS4 media query test: dynamic-range: high.</title>
+<style type="text/css">
+p { color: black; }
+
+@media (dynamic-range: high) {
+ #a { color: green; }
+}
+</style>
+<script>
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+}
+
+window.addEventListener('load', event => {
+ if (!window.internals)
+ return;
+
+ window.internals.settings.setHDRMediaCapabilitiesEnabled(true);
+ window.internals.settings.forcedSupportsHighDynamicRangeValue = "off";
+ var element = document.getElementById("a");
+ document.getElementById("before").textContent = window.getComputedStyle(element).color;
+ window.internals.settings.forcedSupportsHighDynamicRangeValue = "on";
+ document.getElementById("after").textContent = window.getComputedStyle(element).color;
+ testRunner.notifyDone();
+});
+</script>
+</head>
+<body>
+ <p id="a"></p>
+ <p>Before was: <span id="before"></span> - should be rgb(0, 0, 0)</p>
+ <p>After was: <span id="after"></span> - should be rgb(0, 128, 0)</p>
+</body>
+</html>
Modified: trunk/Source/WTF/wtf/cocoa/SoftLinking.h (252761 => 252762)
--- trunk/Source/WTF/wtf/cocoa/SoftLinking.h 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WTF/wtf/cocoa/SoftLinking.h 2019-11-22 05:17:02 UTC (rev 252762)
@@ -531,12 +531,12 @@
resultType softLink_##framework##_##functionName parameterDeclarations; \
}
-#define SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(functionNamespace, framework, functionName, resultType, parameterDeclarations, parameterNames) \
+#define SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE_WITH_EXPORT(functionNamespace, framework, functionName, resultType, parameterDeclarations, parameterNames, export) \
WTF_EXTERN_C_BEGIN \
resultType functionName parameterDeclarations; \
WTF_EXTERN_C_END \
namespace functionNamespace { \
- resultType (*softLink##framework##functionName) parameterDeclarations = 0; \
+ export resultType (*softLink##framework##functionName) parameterDeclarations = 0; \
bool init_##framework##_##functionName(); \
bool init_##framework##_##functionName() \
{ \
@@ -546,7 +546,7 @@
} \
\
bool canLoad_##framework##_##functionName(); \
- bool canLoad_##framework##_##functionName() \
+ export bool canLoad_##framework##_##functionName() \
{ \
static bool loaded = init_##framework##_##functionName(); \
return loaded; \
@@ -560,6 +560,9 @@
} \
}
+#define SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE(functionNamespace, framework, functionName, resultType, parameterDeclarations, parameterNames) \
+ SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE_WITH_EXPORT(functionNamespace, framework, functionName, resultType, parameterDeclarations, parameterNames, )
+
#define SOFT_LINK_POINTER_FOR_HEADER(functionNamespace, framework, variableName, variableType) \
namespace functionNamespace { \
extern variableType (*get_##framework##_##variableName)(); \
Modified: trunk/Source/WebCore/ChangeLog (252761 => 252762)
--- trunk/Source/WebCore/ChangeLog 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebCore/ChangeLog 2019-11-22 05:17:02 UTC (rev 252762)
@@ -1,3 +1,41 @@
+2019-11-21 Jer Noble <[email protected]>
+
+ Experimental support for HDR media query
+ https://bugs.webkit.org/show_bug.cgi?id=204422
+
+ Reviewed by Eric Carlson.
+
+ Test: fast/media/mq-highdynamicrange-live-update.html
+
+ Add support for the dynamic-range: media query.
+
+ * SourcesCocoa.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/CSSValueKeywords.in:
+ * css/MediaFeatureNames.h:
+ * css/MediaQueryEvaluator.cpp:
+ (WebCore::dynamicRangeEvaluate):
+ * css/MediaQueryExpression.cpp:
+ (WebCore::featureWithValidIdent):
+ * page/Chrome.cpp:
+ (WebCore::Chrome::windowScreenDidChange):
+ * page/Settings.yaml:
+ * page/SettingsBase.h:
+ * platform/PlatformScreen.h:
+ * platform/ScreenProperties.h:
+ (WebCore::ScreenData::encode const):
+ (WebCore::ScreenData::decode):
+ * platform/ios/PlatformScreenIOS.mm:
+ (WebCore::screenSupportsHighDynamicRange):
+ * platform/mac/PlatformScreenMac.mm:
+ (WebCore::collectScreenProperties):
+ (WebCore::screenSupportsHighDynamicRange):
+ * testing/InternalSettings.cpp:
+ (WebCore::InternalSettings::forcedSupportsHighDynamicRangeValue const):
+ (WebCore::InternalSettings::setForcedSupportsHighDynamicRangeValue):
+ * testing/InternalSettings.h:
+ * testing/InternalSettings.idl:
+
2019-11-21 Ryosuke Niwa <[email protected]>
Scrolling to fragment shouldn't happen as a part of updating style
Modified: trunk/Source/WebCore/PAL/ChangeLog (252761 => 252762)
--- trunk/Source/WebCore/PAL/ChangeLog 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebCore/PAL/ChangeLog 2019-11-22 05:17:02 UTC (rev 252762)
@@ -1,3 +1,15 @@
+2019-11-21 Jer Noble <[email protected]>
+
+ Experimental support for HDR media query
+ https://bugs.webkit.org/show_bug.cgi?id=204422
+
+ Reviewed by Eric Carlson.
+
+ * PAL.xcodeproj/project.pbxproj:
+ * pal/PlatformMac.cmake:
+ * pal/cocoa/MediaToolboxSoftLink.cpp: Renamed from Source/WebCore/platform/cocoa/MediaToolboxSoftLink.h.
+ * pal/cocoa/MediaToolboxSoftLink.h: Renamed from Source/WebCore/platform/cocoa/MediaToolboxSoftLink.cpp.
+
2019-11-15 Eric Carlson <[email protected]>
Don't use AVCapture on watchOS and tvOS
Modified: trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj (252761 => 252762)
--- trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj 2019-11-22 05:17:02 UTC (rev 252762)
@@ -162,6 +162,8 @@
A3AB6E651F3D217F009C14B1 /* SystemSleepListenerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A3AB6E631F3D217F009C14B1 /* SystemSleepListenerMac.mm */; };
A3C66CDC1F462D6A009E6EE9 /* SessionID.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A3C66CDA1F462D6A009E6EE9 /* SessionID.cpp */; };
A3C66CDD1F462D6A009E6EE9 /* SessionID.h in Headers */ = {isa = PBXBuildFile; fileRef = A3C66CDB1F462D6A009E6EE9 /* SessionID.h */; };
+ CDACB3602387425B0018D7CE /* MediaToolboxSoftLink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDACB35E23873E480018D7CE /* MediaToolboxSoftLink.cpp */; };
+ CDACB361238742740018D7CE /* MediaToolboxSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = CDACB35F23873E480018D7CE /* MediaToolboxSoftLink.h */; };
CDF91113220E4EEC001EA39E /* CelestialSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CDF91112220E4EEC001EA39E /* CelestialSPI.h */; };
CE5673872151A7B9002F92D7 /* IOKitSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = CE5673862151A7B9002F92D7 /* IOKitSPI.h */; };
E5D45D122106A07400D2B738 /* NSColorWellSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = E5D45D112106A07400D2B738 /* NSColorWellSPI.h */; };
@@ -334,6 +336,8 @@
A3C66CDA1F462D6A009E6EE9 /* SessionID.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SessionID.cpp; sourceTree = "<group>"; };
A3C66CDB1F462D6A009E6EE9 /* SessionID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SessionID.h; sourceTree = "<group>"; };
C2147A4A1EFD0AA600056FA5 /* CopyPALHeaders.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CopyPALHeaders.xcconfig; sourceTree = "<group>"; };
+ CDACB35E23873E480018D7CE /* MediaToolboxSoftLink.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = MediaToolboxSoftLink.cpp; sourceTree = "<group>"; };
+ CDACB35F23873E480018D7CE /* MediaToolboxSoftLink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaToolboxSoftLink.h; sourceTree = "<group>"; };
CDF91112220E4EEC001EA39E /* CelestialSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CelestialSPI.h; sourceTree = "<group>"; };
CE5673862151A7B9002F92D7 /* IOKitSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IOKitSPI.h; sourceTree = "<group>"; };
E5D45D112106A07400D2B738 /* NSColorWellSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSColorWellSPI.h; sourceTree = "<group>"; };
@@ -600,6 +604,8 @@
077E87AF226A460200A2AFF0 /* AVFoundationSoftLink.mm */,
F44291661FA52705002CC93E /* FileSizeFormatterCocoa.mm */,
1C022EFC22CFE8E0006DF01B /* Gunzip.cpp */,
+ CDACB35E23873E480018D7CE /* MediaToolboxSoftLink.cpp */,
+ CDACB35F23873E480018D7CE /* MediaToolboxSoftLink.h */,
A1F63C9D21A4DBF7006FB43B /* PassKitSoftLink.h */,
A1F63C9E21A4DBF7006FB43B /* PassKitSoftLink.mm */,
);
@@ -804,6 +810,7 @@
570AB8F120AE2E8D00B8BE87 /* SecKeyProxySPI.h in Headers */,
0C2DA1581F3BEB4900DBC317 /* ServersSPI.h in Headers */,
A3C66CDD1F462D6A009E6EE9 /* SessionID.h in Headers */,
+ CDACB361238742740018D7CE /* MediaToolboxSoftLink.h in Headers */,
A3AB6E561F3D1DDB009C14B1 /* SleepDisabler.h in Headers */,
A3AB6E611F3D1E39009C14B1 /* SleepDisablerCocoa.h in Headers */,
A3788E981F05B6CE00679425 /* Sound.h in Headers */,
@@ -928,6 +935,7 @@
A3AB6E521F3D1DC5009C14B1 /* SleepDisabler.cpp in Sources */,
A3AB6E601F3D1E39009C14B1 /* SleepDisablerCocoa.cpp in Sources */,
A3788E9C1F05B78200679425 /* Sound.cpp in Sources */,
+ CDACB3602387425B0018D7CE /* MediaToolboxSoftLink.cpp in Sources */,
A3788E9E1F05B78E00679425 /* SoundMac.mm in Sources */,
A3AB6E571F3D1DDB009C14B1 /* SystemSleepListener.cpp in Sources */,
A3AB6E651F3D217F009C14B1 /* SystemSleepListenerMac.mm in Sources */,
Modified: trunk/Source/WebCore/PAL/pal/PlatformMac.cmake (252761 => 252762)
--- trunk/Source/WebCore/PAL/pal/PlatformMac.cmake 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebCore/PAL/pal/PlatformMac.cmake 2019-11-22 05:17:02 UTC (rev 252762)
@@ -5,6 +5,7 @@
cocoa/AppSSOSoftLink.h
cocoa/AVFoundationSoftLink.h
+ cocoa/MediaToolboxSoftLink.h
cocoa/PassKitSoftLink.h
mac/LookupSoftLink.h
@@ -118,6 +119,7 @@
cocoa/AVFoundationSoftLink.mm
cocoa/FileSizeFormatterCocoa.mm
cocoa/Gunzip.cpp
+ cocoa/MediaToolboxSoftLink.cpp
cocoa/PassKitSoftLink.mm
crypto/commoncrypto/CryptoDigestCommonCrypto.cpp
Added: trunk/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.cpp (0 => 252762)
--- trunk/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.cpp (rev 0)
+++ trunk/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.cpp 2019-11-22 05:17:02 UTC (rev 252762)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2019 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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.
+ */
+
+#include "config.h"
+
+#if USE(MEDIATOOLBOX)
+
+#include <MediaToolbox/MediaToolbox.h>
+#include <wtf/SoftLinking.h>
+
+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)
+
+#endif
Added: trunk/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.h (0 => 252762)
--- trunk/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.h (rev 0)
+++ trunk/Source/WebCore/PAL/pal/cocoa/MediaToolboxSoftLink.h 2019-11-22 05:17:02 UTC (rev 252762)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2019 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 INC. AND ITS CONTRIBUTORS ``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 INC. OR ITS 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 USE(MEDIATOOLBOX)
+
+#include <MediaToolbox/MediaToolbox.h>
+#include <wtf/SoftLinking.h>
+
+SOFT_LINK_FRAMEWORK_FOR_HEADER(PAL, MediaToolbox)
+
+SOFT_LINK_FUNCTION_MAY_FAIL_FOR_HEADER(PAL, MediaToolbox, MTShouldPlayHDRVideo, Boolean, (CFArrayRef displayList), (displayList))
+
+#endif
Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (252761 => 252762)
--- trunk/Source/WebCore/css/CSSValueKeywords.in 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in 2019-11-22 05:17:02 UTC (rev 252762)
@@ -1441,3 +1441,7 @@
// text-decoration-thickness, text-underline-offset
from-font
+
+// dynamic-range
+standard
+high
Modified: trunk/Source/WebCore/css/MediaFeatureNames.h (252761 => 252762)
--- trunk/Source/WebCore/css/MediaFeatureNames.h 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebCore/css/MediaFeatureNames.h 2019-11-22 05:17:02 UTC (rev 252762)
@@ -47,6 +47,7 @@
macro(deviceHeight, "device-height") \
macro(devicePixelRatio, "-webkit-device-pixel-ratio") \
macro(deviceWidth, "device-width") \
+ macro(dynamicRange, "dynamic-range") \
macro(grid, "grid") \
macro(height, "height") \
macro(hover, "hover") \
Modified: trunk/Source/WebCore/css/MediaQueryEvaluator.cpp (252761 => 252762)
--- trunk/Source/WebCore/css/MediaQueryEvaluator.cpp 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebCore/css/MediaQueryEvaluator.cpp 2019-11-22 05:17:02 UTC (rev 252762)
@@ -419,6 +419,33 @@
#endif
}
+static bool dynamicRangeEvaluate(CSSValue* value, const CSSToLengthConversionData&, Frame& frame, MediaFeaturePrefix)
+{
+ if (!value)
+ return false;
+
+ if (!frame.settings().hdrMediaCapabilitiesEnabled())
+ return false;
+
+ bool supportsHighDynamicRange;
+
+ if (frame.settings().forcedSupportsHighDynamicRangeValue() == Settings::ForcedAccessibilityValue::On)
+ supportsHighDynamicRange = true;
+ else if (frame.settings().forcedSupportsHighDynamicRangeValue() == Settings::ForcedAccessibilityValue::Off)
+ supportsHighDynamicRange = false;
+ else
+ supportsHighDynamicRange = screenSupportsHighDynamicRange(frame.mainFrame().view());
+
+ switch (downcast<CSSPrimitiveValue>(*value).valueID()) {
+ case CSSValueHigh:
+ return supportsHighDynamicRange;
+ case CSSValueStandard:
+ return true;
+ default:
+ return false; // Any unknown value should not be considered a match.
+ }
+}
+
static bool gridEvaluate(CSSValue* value, const CSSToLengthConversionData&, Frame&, MediaFeaturePrefix op)
{
return zeroEvaluate(value, op);
Modified: trunk/Source/WebCore/css/MediaQueryExpression.cpp (252761 => 252762)
--- trunk/Source/WebCore/css/MediaQueryExpression.cpp 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebCore/css/MediaQueryExpression.cpp 2019-11-22 05:17:02 UTC (rev 252762)
@@ -57,7 +57,8 @@
|| (mediaFeature == MediaFeatureNames::prefersColorScheme)
#endif
|| mediaFeature == MediaFeatureNames::prefersReducedMotion
- || (mediaFeature == MediaFeatureNames::prefersDarkInterface && (context.useSystemAppearance || isUASheetBehavior(context.mode)));
+ || (mediaFeature == MediaFeatureNames::prefersDarkInterface && (context.useSystemAppearance || isUASheetBehavior(context.mode)))
+ || mediaFeature == MediaFeatureNames::dynamicRange;
}
static inline bool featureWithValidDensity(const String& mediaFeature, const CSSPrimitiveValue& value)
Modified: trunk/Source/WebCore/page/Chrome.cpp (252761 => 252762)
--- trunk/Source/WebCore/page/Chrome.cpp 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebCore/page/Chrome.cpp 2019-11-22 05:17:02 UTC (rev 252762)
@@ -518,6 +518,8 @@
frame->document()->windowScreenDidChange(displayID);
}
+ m_page.setNeedsRecalcStyleInAllFrames();
+
#if PLATFORM(MAC) && ENABLE(GRAPHICS_CONTEXT_3D)
GraphicsContext3DManager::sharedManager().screenDidChange(displayID, this);
#endif
Modified: trunk/Source/WebCore/page/Settings.yaml (252761 => 252762)
--- trunk/Source/WebCore/page/Settings.yaml 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebCore/page/Settings.yaml 2019-11-22 05:17:02 UTC (rev 252762)
@@ -632,6 +632,10 @@
forcedPrefersReducedMotionAccessibilityValue:
type: ForcedAccessibilityValue
initial: defaultForcedPrefersReducedMotionAccessibilityValue
+forcedSupportsHighDynamicRangeValue:
+ type: ForcedAccessibilityValue
+ initial: defaultForcedSupportsHighDynamicRangeValue
+ onChange: setNeedsRecalcStyleInAllFrames
largeImageAsyncDecodingEnabled:
initial: true
Modified: trunk/Source/WebCore/page/SettingsBase.h (252761 => 252762)
--- trunk/Source/WebCore/page/SettingsBase.h 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebCore/page/SettingsBase.h 2019-11-22 05:17:02 UTC (rev 252762)
@@ -111,6 +111,7 @@
static const SettingsBase::ForcedAccessibilityValue defaultForcedColorsAreInvertedAccessibilityValue = ForcedAccessibilityValue::System;
static const SettingsBase::ForcedAccessibilityValue defaultForcedDisplayIsMonochromeAccessibilityValue = ForcedAccessibilityValue::System;
static const SettingsBase::ForcedAccessibilityValue defaultForcedPrefersReducedMotionAccessibilityValue = ForcedAccessibilityValue::System;
+ static const SettingsBase::ForcedAccessibilityValue defaultForcedSupportsHighDynamicRangeValue = ForcedAccessibilityValue::System;
WEBCORE_EXPORT static bool defaultTextAutosizingEnabled();
WEBCORE_EXPORT static float defaultMinimumZoomFontSize();
Modified: trunk/Source/WebCore/platform/PlatformScreen.h (252761 => 252762)
--- trunk/Source/WebCore/platform/PlatformScreen.h 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebCore/platform/PlatformScreen.h 2019-11-22 05:17:02 UTC (rev 252762)
@@ -75,6 +75,12 @@
WEBCORE_EXPORT bool screenSupportsExtendedColor(Widget* = nullptr);
+#if PLATFORM(MAC) || PLATFORM(IOS_FAMILY)
+bool screenSupportsHighDynamicRange(Widget* = nullptr);
+#else
+constexpr bool screenSupportsHighDynamicRange(Widget* = nullptr) { return false; }
+#endif
+
#if USE(CG)
WEBCORE_EXPORT CGColorSpaceRef screenColorSpace(Widget* = nullptr);
#endif
Modified: trunk/Source/WebCore/platform/ScreenProperties.h (252761 => 252762)
--- trunk/Source/WebCore/platform/ScreenProperties.h 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebCore/platform/ScreenProperties.h 2019-11-22 05:17:02 UTC (rev 252762)
@@ -45,6 +45,7 @@
bool screenSupportsExtendedColor { false };
bool screenHasInvertedColors { false };
bool screenIsMonochrome { false };
+ bool screenSupportsHighDynamicRange { false };
uint32_t displayMask { 0 };
IORegistryGPUID gpuID { 0 };
@@ -94,7 +95,7 @@
template<class Encoder>
void ScreenData::encode(Encoder& encoder) const
{
- encoder << screenAvailableRect << screenRect << screenDepth << screenDepthPerComponent << screenSupportsExtendedColor << screenHasInvertedColors << screenIsMonochrome << displayMask << gpuID;
+ encoder << screenAvailableRect << screenRect << screenDepth << screenDepthPerComponent << screenSupportsExtendedColor << screenHasInvertedColors << screenIsMonochrome << screenSupportsHighDynamicRange << displayMask << gpuID;
if (colorSpace) {
// Try to encode the name.
@@ -158,6 +159,11 @@
if (!screenIsMonochrome)
return WTF::nullopt;
+ Optional<bool> screenSupportsHighDynamicRange;
+ decoder >> screenSupportsHighDynamicRange;
+ if (!screenSupportsHighDynamicRange)
+ return WTF::nullopt;
+
Optional<uint32_t> displayMask;
decoder >> displayMask;
if (!displayMask)
@@ -199,7 +205,7 @@
}
}
- return { { WTFMove(*screenAvailableRect), WTFMove(*screenRect), WTFMove(cgColorSpace), WTFMove(*screenDepth), WTFMove(*screenDepthPerComponent), WTFMove(*screenSupportsExtendedColor), WTFMove(*screenHasInvertedColors), WTFMove(*screenIsMonochrome), WTFMove(*displayMask), WTFMove(*gpuID) } };
+ return { { WTFMove(*screenAvailableRect), WTFMove(*screenRect), WTFMove(cgColorSpace), WTFMove(*screenDepth), WTFMove(*screenDepthPerComponent), WTFMove(*screenSupportsExtendedColor), WTFMove(*screenHasInvertedColors), WTFMove(*screenIsMonochrome), WTFMove(*screenSupportsHighDynamicRange), WTFMove(*displayMask), WTFMove(*gpuID) } };
}
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/ios/PlatformScreenIOS.mm (252761 => 252762)
--- trunk/Source/WebCore/platform/ios/PlatformScreenIOS.mm 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebCore/platform/ios/PlatformScreenIOS.mm 2019-11-22 05:17:02 UTC (rev 252762)
@@ -38,6 +38,7 @@
#import "IntRect.h"
#import "WAKWindow.h"
#import "Widget.h"
+#import <pal/cocoa/MediaToolboxSoftLink.h>
#import <pal/ios/UIKitSoftLink.h>
#import <pal/spi/ios/MobileGestaltSPI.h>
#import <pal/spi/ios/UIKitSPI.h>
@@ -71,6 +72,15 @@
return MGGetBoolAnswer(kMGQHasExtendedColorDisplay);
}
+bool screenSupportsHighDynamicRange(Widget*)
+{
+#if USE(MEDIATOOLBOX)
+ if (PAL::canLoad_MediaToolbox_MTShouldPlayHDRVideo())
+ return PAL::softLink_MediaToolbox_MTShouldPlayHDRVideo(nullptr);
+#endif
+ return false;
+}
+
CGColorSpaceRef screenColorSpace(Widget* widget)
{
return screenSupportsExtendedColor(widget) ? extendedSRGBColorSpaceRef() : sRGBColorSpaceRef();
Modified: trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm (252761 => 252762)
--- trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm 2019-11-22 05:17:02 UTC (rev 252762)
@@ -36,6 +36,10 @@
#import <pal/spi/cg/CoreGraphicsSPI.h>
#import <wtf/ProcessPrivilege.h>
+#if USE(MEDIATOOLBOX)
+#import <pal/cocoa/MediaToolboxSoftLink.h>
+#endif
+
extern "C" {
bool CGDisplayUsesInvertedPolarity(void);
bool CGDisplayUsesForceToGray(void);
@@ -128,11 +132,17 @@
bool screenIsMonochrome = CGDisplayUsesForceToGray();
uint32_t displayMask = CGDisplayIDToOpenGLDisplayMask(displayID);
IORegistryGPUID gpuID = 0;
+ bool screenSupportsHighDynamicRange = false;
+#if USE(MEDIATOOLBOX)
+ if (PAL::canLoad_MediaToolbox_MTShouldPlayHDRVideo())
+ screenSupportsHighDynamicRange = PAL::softLink_MediaToolbox_MTShouldPlayHDRVideo((__bridge CFArrayRef)@[ @(displayID) ]);
+#endif
+
if (displayMask)
gpuID = gpuIDForDisplayMask(displayMask);
- screenProperties.screenDataMap.set(displayID, ScreenData { screenAvailableRect, screenRect, colorSpace, screenDepth, screenDepthPerComponent, screenSupportsExtendedColor, screenHasInvertedColors, screenIsMonochrome, displayMask, gpuID });
+ screenProperties.screenDataMap.set(displayID, ScreenData { screenAvailableRect, screenRect, colorSpace, screenDepth, screenDepthPerComponent, screenSupportsExtendedColor, screenHasInvertedColors, screenIsMonochrome, screenSupportsHighDynamicRange, displayMask, gpuID });
if (!screenProperties.primaryDisplayID)
screenProperties.primaryDisplayID = displayID;
@@ -348,6 +358,21 @@
return [screen(widget) canRepresentDisplayGamut:NSDisplayGamutP3];
}
+bool screenSupportsHighDynamicRange(Widget* widget)
+{
+ if (!screenProperties().screenDataMap.isEmpty())
+ return getScreenProperties(widget).screenSupportsHighDynamicRange;
+
+ ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
+#if USE(MEDIATOOLBOX)
+ if (PAL::canLoad_MediaToolbox_MTShouldPlayHDRVideo()) {
+ auto displayID = WebCore::displayID(screen(widget));
+ return PAL::softLink_MediaToolbox_MTShouldPlayHDRVideo((__bridge CFArrayRef)@[ @(displayID) ]);
+ }
+#endif
+ return false;
+}
+
FloatRect toUserSpace(const NSRect& rect, NSWindow *destination)
{
FloatRect userRect = rect;
Modified: trunk/Source/WebCore/testing/InternalSettings.cpp (252761 => 252762)
--- trunk/Source/WebCore/testing/InternalSettings.cpp 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebCore/testing/InternalSettings.cpp 2019-11-22 05:17:02 UTC (rev 252762)
@@ -1020,6 +1020,16 @@
settings().setForcedPrefersReducedMotionAccessibilityValue(internalSettingsToSettingsValue(value));
}
+InternalSettings::ForcedAccessibilityValue InternalSettings::forcedSupportsHighDynamicRangeValue() const
+{
+ return settingsToInternalSettingsValue(settings().forcedSupportsHighDynamicRangeValue());
+}
+
+void InternalSettings::setForcedSupportsHighDynamicRangeValue(InternalSettings::ForcedAccessibilityValue value)
+{
+ settings().setForcedSupportsHighDynamicRangeValue(internalSettingsToSettingsValue(value));
+}
+
bool InternalSettings::webAnimationsCSSIntegrationEnabled()
{
return RuntimeEnabledFeatures::sharedFeatures().webAnimationsCSSIntegrationEnabled();
Modified: trunk/Source/WebCore/testing/InternalSettings.h (252761 => 252762)
--- trunk/Source/WebCore/testing/InternalSettings.h 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebCore/testing/InternalSettings.h 2019-11-22 05:17:02 UTC (rev 252762)
@@ -122,6 +122,8 @@
void setForcedDisplayIsMonochromeAccessibilityValue(ForcedAccessibilityValue);
ForcedAccessibilityValue forcedPrefersReducedMotionAccessibilityValue() const;
void setForcedPrefersReducedMotionAccessibilityValue(ForcedAccessibilityValue);
+ ForcedAccessibilityValue forcedSupportsHighDynamicRangeValue() const;
+ void setForcedSupportsHighDynamicRangeValue(ForcedAccessibilityValue);
// RuntimeEnabledFeatures.
static void setIndexedDBWorkersEnabled(bool);
Modified: trunk/Source/WebCore/testing/InternalSettings.idl (252761 => 252762)
--- trunk/Source/WebCore/testing/InternalSettings.idl 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebCore/testing/InternalSettings.idl 2019-11-22 05:17:02 UTC (rev 252762)
@@ -112,6 +112,7 @@
attribute ForcedAccessibilityValue forcedColorsAreInvertedAccessibilityValue;
attribute ForcedAccessibilityValue forcedDisplayIsMonochromeAccessibilityValue;
attribute ForcedAccessibilityValue forcedPrefersReducedMotionAccessibilityValue;
+ attribute ForcedAccessibilityValue forcedSupportsHighDynamicRangeValue;
[MayThrowException] void setShouldManageAudioSessionCategory(boolean should);
[MayThrowException] void setCustomPasteboardDataEnabled(boolean enabled);
Modified: trunk/Source/WebKit/ChangeLog (252761 => 252762)
--- trunk/Source/WebKit/ChangeLog 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebKit/ChangeLog 2019-11-22 05:17:02 UTC (rev 252762)
@@ -1,3 +1,25 @@
+2019-11-21 Jer Noble <[email protected]>
+
+ Experimental support for HDR media query
+ https://bugs.webkit.org/show_bug.cgi?id=204422
+
+ Reviewed by Eric Carlson.
+
+ Notify the WebContent process of updated screen properties when the screen's
+ color space changes.
+
+ * UIProcess/Cocoa/WebViewImpl.h:
+ * UIProcess/Cocoa/WebViewImpl.mm:
+ (-[WKWindowVisibilityObserver startObserving:]):
+ (-[WKWindowVisibilityObserver stopObserving:]):
+ (-[WKWindowVisibilityObserver _screenDidChangeColorSpace:]):
+ (WebKit::WebViewImpl::screenDidChangeColorSpace):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::screenPropertiesDidChange):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::setScreenProperties):
+
2019-11-21 Brian Burg <[email protected]>
Unreviewed, sort WebKit's project file after changes in r252702 and r252637.
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h (252761 => 252762)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.h 2019-11-22 05:17:02 UTC (rev 252762)
@@ -255,6 +255,7 @@
void windowDidChangeScreen();
void windowDidChangeLayerHosting();
void windowDidChangeOcclusionState();
+ void screenDidChangeColorSpace();
bool shouldDelayWindowOrderingForEvent(NSEvent *);
bool windowResizeMouseLocationIsInVisibleScrollerThumb(CGPoint);
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (252761 => 252762)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2019-11-22 05:17:02 UTC (rev 252762)
@@ -263,6 +263,8 @@
[defaultNotificationCenter addObserver:self selector:@selector(_windowDidChangeLayerHosting:) name:@"_NSWindowDidChangeContentsHostedInLayerSurfaceNotification" object:window];
[defaultNotificationCenter addObserver:self selector:@selector(_windowDidChangeOcclusionState:) name:NSWindowDidChangeOcclusionStateNotification object:window];
+ [defaultNotificationCenter addObserver:self selector:@selector(_screenDidChangeColorSpace:) name:NSScreenColorSpaceDidChangeNotification object:nil];
+
[window addObserver:self forKeyPath:@"contentLayoutRect" options:NSKeyValueObservingOptionInitial context:keyValueObservingContext];
[window addObserver:self forKeyPath:@"titlebarAppearsTransparent" options:NSKeyValueObservingOptionInitial context:keyValueObservingContext];
}
@@ -288,6 +290,8 @@
[defaultNotificationCenter removeObserver:self name:@"_NSWindowDidChangeContentsHostedInLayerSurfaceNotification" object:window];
[defaultNotificationCenter removeObserver:self name:NSWindowDidChangeOcclusionStateNotification object:window];
+ [defaultNotificationCenter removeObserver:self name:NSScreenColorSpaceDidChangeNotification object:nil];
+
if (_impl->isEditable())
[[NSFontPanel sharedFontPanel] removeObserver:self forKeyPath:@"visible" context:keyValueObservingContext];
[window removeObserver:self forKeyPath:@"contentLayoutRect" context:keyValueObservingContext];
@@ -372,6 +376,11 @@
_impl->windowDidChangeOcclusionState();
}
+- (void)_screenDidChangeColorSpace:(NSNotification *)notification
+{
+ _impl->screenDidChangeColorSpace();
+}
+
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if (context != keyValueObservingContext) {
@@ -2117,6 +2126,11 @@
m_page->activityStateDidChange(WebCore::ActivityState::IsVisible);
}
+void WebViewImpl::screenDidChangeColorSpace()
+{
+ m_page->process().processPool().screenPropertiesStateChanged();
+}
+
bool WebViewImpl::mightBeginDragWhileInactive()
{
if ([m_view window].isKeyWindow)
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (252761 => 252762)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2019-11-22 05:17:02 UTC (rev 252762)
@@ -2075,6 +2075,11 @@
m_page->accessibilitySettingsDidChange();
}
+void WebPage::screenPropertiesDidChange()
+{
+ m_page->setNeedsRecalcStyleInAllFrames();
+}
+
void WebPage::setUseFixedLayout(bool fixed)
{
// Do not overwrite current settings if initially setting it to false.
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (252761 => 252762)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h 2019-11-22 05:17:02 UTC (rev 252762)
@@ -494,6 +494,7 @@
void clearHistory();
void accessibilitySettingsDidChange();
+ void screenPropertiesDidChange();
void scalePage(double scale, const WebCore::IntPoint& origin);
void scalePageInViewCoordinates(double scale, WebCore::IntPoint centerInViewCoordinates);
Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (252761 => 252762)
--- trunk/Source/WebKit/WebProcess/WebProcess.cpp 2019-11-22 05:09:36 UTC (rev 252761)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp 2019-11-22 05:17:02 UTC (rev 252762)
@@ -1798,6 +1798,8 @@
void WebProcess::setScreenProperties(const WebCore::ScreenProperties& properties)
{
WebCore::setScreenProperties(properties);
+ for (auto& page : m_pageMap.values())
+ page->screenPropertiesDidChange();
}
#endif