Diff
Modified: trunk/LayoutTests/ChangeLog (270822 => 270823)
--- trunk/LayoutTests/ChangeLog 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/LayoutTests/ChangeLog 2020-12-15 06:28:57 UTC (rev 270823)
@@ -1,3 +1,28 @@
+2020-12-14 Chris Fleizach <[email protected]>
+
+ AX: implement prefers-contrast: more
+ https://bugs.webkit.org/show_bug.cgi?id=215507
+ <rdar://problem/67077492>
+
+ Reviewed by Dean Jackson.
+
+ * TestExpectations:
+ * fast/media/mq-prefers-contrast-forced-value.html: Added.
+ * fast/media/mq-prefers-contrast-live-update-for-listener-expected.txt: Added.
+ * fast/media/mq-prefers-contrast-live-update-for-listener.html: Added.
+ * fast/media/mq-prefers-contrast-live-update.html: Added.
+ * fast/media/mq-prefers-contrast-matchMedia-expected.html: Added.
+ * fast/media/mq-prefers-contrast-matchMedia.html: Added.
+ * fast/media/mq-prefers-contrast.html: Added.
+ * platform/ios-simulator/fast/media/mq-prefers-contrast-expected.html: Added.
+ * platform/ios-simulator/fast/media/mq-prefers-contrast-forced-value-expected.html: Added.
+ * platform/ios-simulator/fast/media/mq-prefers-contrast-live-update-expected.html: Added.
+ * platform/ios-wk2/TestExpectations:
+ * platform/mac-wk2/TestExpectations:
+ * platform/mac/fast/media/mq-prefers-contrast-expected.html: Added.
+ * platform/mac/fast/media/mq-prefers-contrast-forced-value-expected.html: Added.
+ * platform/mac/fast/media/mq-prefers-contrast-live-update-expected.html: Added.
+
2020-12-14 Diego Pino Garcia <[email protected]>
[GLIB] Unreviewed test gardening. Update baseline after r270801.
Modified: trunk/LayoutTests/TestExpectations (270822 => 270823)
--- trunk/LayoutTests/TestExpectations 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/LayoutTests/TestExpectations 2020-12-15 06:28:57 UTC (rev 270823)
@@ -218,6 +218,8 @@
fast/media/mq-inverted-colors-live-update-in-subframes.html [ Skip ]
fast/media/mq-monochrome-live-update.html [ Skip ]
fast/media/mq-prefers-reduced-motion-live-update.html [ Skip ]
+fast/media/mq-prefers-contrast.html [ Skip ]
+fast/media/mq-prefers-contrast-live-update.html [ Skip ]
http/tests/loading/basic-auth-remove-credentials.html [ Skip ]
http/tests/security/strip-referrer-to-origin-for-third-party-redirects-in-private-mode.html [ Skip ]
http/tests/security/strip-referrer-to-origin-for-third-party-requests-in-private-mode.html [ Skip ]
Added: trunk/LayoutTests/fast/media/mq-prefers-contrast-forced-value.html (0 => 270823)
--- trunk/LayoutTests/fast/media/mq-prefers-contrast-forced-value.html (rev 0)
+++ trunk/LayoutTests/fast/media/mq-prefers-contrast-forced-value.html 2020-12-15 06:28:57 UTC (rev 270823)
@@ -0,0 +1,32 @@
+<html>
+<head>
+<title>CSS4 media query test: prefers-contrast.</title>
+<style type="text/css">
+p { color: black; }
+</style>
+<script>
+window.addEventListener("load", function () {
+ if (!window.internals)
+ return;
+
+ window.internals.settings.forcedPrefersContrastAccessibilityValue = "on";
+ if (window.matchMedia("(prefers-contrast)").matches)
+ document.getElementById("a").style.color = "green";
+ if (window.matchMedia("(prefers-contrast: more)").matches)
+ document.getElementById("b").style.color = "green";
+
+ window.internals.settings.forcedPrefersContrastAccessibilityValue = "off";
+ if (!window.matchMedia("(prefers-contrast)").matches)
+ document.getElementById("c").style.color = "green";
+ if (window.matchMedia("(prefers-contrast: no-preference)").matches)
+ document.getElementById("d").style.color = "green";
+}, false);
+</script>
+</head>
+<body>
+ <p id="a">This text should be green.</p>
+ <p id="b">This text should be green.</p>
+ <p id="c">This text should be green.</p>
+ <p id="d">This text should be green.</p>
+</body>
+</html>
Added: trunk/LayoutTests/fast/media/mq-prefers-contrast-live-update-for-listener-expected.txt (0 => 270823)
--- trunk/LayoutTests/fast/media/mq-prefers-contrast-live-update-for-listener-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/media/mq-prefers-contrast-live-update-for-listener-expected.txt 2020-12-15 06:28:57 UTC (rev 270823)
@@ -0,0 +1,11 @@
+This tests listeners on MediaQueryList get called when contrast settings are turned on when there are no relevant style rules
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS didCallListener is true
+PASS matchMedia("(prefers-contrast)").matches is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/media/mq-prefers-contrast-live-update-for-listener.html (0 => 270823)
--- trunk/LayoutTests/fast/media/mq-prefers-contrast-live-update-for-listener.html (rev 0)
+++ trunk/LayoutTests/fast/media/mq-prefers-contrast-live-update-for-listener.html 2020-12-15 06:28:57 UTC (rev 270823)
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+
+description('This tests listeners on MediaQueryList get called when contrast settings are turned on when there are no relevant style rules');
+
+jsTestIsAsync = true;
+
+if (window.testRunner)
+ testRunner.waitUntilDone();
+
+let didCallListener = false;
+let timer;
+
+window._onload_ = () => {
+ requestAnimationFrame(() => {
+ window.matchMedia('(prefers-contrast)').addListener((e) => {
+ didCallListener = true;
+ finalize();
+ });
+
+ if (!window.internals || !testRunner.runUIScript) {
+ testFailed('This test requires runUIScript');
+ finishJSTest();
+ return;
+ }
+
+ window.internals.settings.forcedPrefersContrastAccessibilityValue = "on";
+ testRunner.runUIScript(`
+ uiController.simulateAccessibilitySettingsChangeNotification(() => {
+ uiController.uiScriptComplete("Done");
+ })`, () => {
+ if (!didCallListener)
+ timer = setTimeout(finalize, 1000);
+ });
+ });
+}
+
+function finalize() {
+ if (timer)
+ clearTimeout(timer);
+
+ shouldBeTrue('didCallListener');
+ shouldBeTrue('matchMedia("(prefers-contrast)").matches');
+ finishJSTest();
+}
+
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/fast/media/mq-prefers-contrast-live-update.html (0 => 270823)
--- trunk/LayoutTests/fast/media/mq-prefers-contrast-live-update.html (rev 0)
+++ trunk/LayoutTests/fast/media/mq-prefers-contrast-live-update.html 2020-12-15 06:28:57 UTC (rev 270823)
@@ -0,0 +1,50 @@
+<html>
+<head>
+<title>CSS4 media query test: prefers-contrast.</title>
+<style type="text/css">
+p { color: black; }
+
+@media (prefers-contrast) {
+ #a { color: green; }
+}
+</style>
+<script>
+if (window.testRunner)
+ testRunner.waitUntilDone();
+
+function getUIScript()
+{
+ return `
+ (function() {
+ uiController.simulateAccessibilitySettingsChangeNotification(function() {
+ uiController.uiScriptComplete("Done");
+ });
+ })();`
+}
+
+function runTest()
+{
+ if (!window.internals)
+ return;
+
+ var element = document.getElementById("a");
+
+ window.internals.settings.forcedPrefersContrastAccessibilityValue = "on";
+ document.getElementById("before").textContent = window.getComputedStyle(element).color;
+ if (testRunner.runUIScript) {
+ testRunner.runUIScript(getUIScript(), function(result) {
+ document.getElementById("after").textContent = window.getComputedStyle(element).color;
+ testRunner.notifyDone();
+ });
+ }
+}
+
+window.addEventListener("load", runTest, false);
+</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>
Added: trunk/LayoutTests/fast/media/mq-prefers-contrast-matchMedia-expected.html (0 => 270823)
--- trunk/LayoutTests/fast/media/mq-prefers-contrast-matchMedia-expected.html (rev 0)
+++ trunk/LayoutTests/fast/media/mq-prefers-contrast-matchMedia-expected.html 2020-12-15 06:28:57 UTC (rev 270823)
@@ -0,0 +1,10 @@
+<html>
+<head>
+<title>CSS4 media query test: prefers-contrast using matchMedia and addListener.</title>
+</head>
+<body>
+ <p>Initial value of query.matches: <span id="before">false</span> - should be false</p>
+ <p>Updated value of query.matches: <span id="after">true</span> - should be true</p>
+ <p>Note the updated value will only be filled if the listener fires.</p>
+</body>
+</html>
Added: trunk/LayoutTests/fast/media/mq-prefers-contrast-matchMedia.html (0 => 270823)
--- trunk/LayoutTests/fast/media/mq-prefers-contrast-matchMedia.html (rev 0)
+++ trunk/LayoutTests/fast/media/mq-prefers-contrast-matchMedia.html 2020-12-15 06:28:57 UTC (rev 270823)
@@ -0,0 +1,48 @@
+<html>
+<head>
+<title>CSS4 media query test: prefers-contrast using matchMedia and addListener.</title>
+<script>
+
+function runTest()
+{
+ if (!window.internals)
+ return;
+
+ var query = window.matchMedia("(prefers-contrast)");
+ query.addListener(() => {
+ document.getElementById("after").textContent = query.matches ? "true" : "false";
+ queryFired = true;
+ checkDone();
+ });
+
+ document.getElementById("before").textContent = query.matches ? "true" : "false";
+ window.internals.settings.forcedPrefersContrastAccessibilityValue = "on";
+ testRunner.runUIScript(`
+ (function() {
+ uiController.simulateAccessibilitySettingsChangeNotification(function() {
+ uiController.uiScriptComplete("Done");
+ });
+ })();`, function (result) {
+ scriptRan = true;
+ checkDone();
+ }
+ );
+}
+
+let queryFired = false;
+let scriptRan = false;
+
+function checkDone() {
+ if (queryFired && scriptRan)
+ testRunner.notifyDone();
+}
+
+window.addEventListener("load", runTest, false);
+</script>
+</head>
+<body>
+ <p>Initial value of query.matches: <span id="before">unknown</span> - should be false</p>
+ <p>Updated value of query.matches: <span id="after">unknown</span> - should be true</p>
+ <p>Note the updated value will only be filled if the listener fires.</p>
+</body>
+</html>
Added: trunk/LayoutTests/fast/media/mq-prefers-contrast.html (0 => 270823)
--- trunk/LayoutTests/fast/media/mq-prefers-contrast.html (rev 0)
+++ trunk/LayoutTests/fast/media/mq-prefers-contrast.html 2020-12-15 06:28:57 UTC (rev 270823)
@@ -0,0 +1,39 @@
+<html>
+<head>
+<title>CSS4 media query test: prefers-contrast.</title>
+<style type="text/css">
+#a { color: black; }
+#b { color: black; }
+#c { color: black; }
+#d { color: black; }
+
+@media (prefers-contrast) {
+#a { color: green; }
+}
+
+@media (prefers-contrast: more) {
+#b { color: green; }
+}
+
+@media (prefers-contrast: less) {
+#c { color: green; }
+}
+
+@media (prefers-contrast: no-preference) {
+#d { color: green; }
+}
+</style>
+<script>
+window.addEventListener("load", function () {
+ if (window.matchMedia("(prefers-contrast)").matches)
+ document.getElementById("c").style.color = "green";
+}, false);
+</script>
+</head>
+<body>
+ <p id="a">This text should be green if the user requested contrast. Black otherwise.</p>
+ <p id="b">This text should be green if the user requested contrast. Black otherwise.</p>
+ <p id="c">This text should be green if the user requested contrast. Black otherwise.</p>
+ <p id="d">This text should be green if the user has not requested contrast. Black otherwise.</p>
+</body>
+</html>
Added: trunk/LayoutTests/platform/ios-simulator/fast/media/mq-prefers-contrast-expected.html (0 => 270823)
--- trunk/LayoutTests/platform/ios-simulator/fast/media/mq-prefers-contrast-expected.html (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator/fast/media/mq-prefers-contrast-expected.html 2020-12-15 06:28:57 UTC (rev 270823)
@@ -0,0 +1,33 @@
+<html>
+<head>
+<title>CSS4 media query test: prefers-contrast.</title>
+<style type="text/css">
+#a { color: black; }
+#b { color: black; }
+#c { color: black; }
+#d { color: black; }
+
+@media (prefers-contrast) {
+#a { color: green; }
+}
+
+@media (prefers-contrast: more) {
+#b { color: green; }
+}
+
+@media (prefers-contrast: less) {
+#c { color: green; }
+}
+
+@media (prefers-contrast: no-preference) {
+#d { color: green; }
+}
+</style>
+</head>
+<body>
+ <p id="a">This text should be green if the user requested contrast. Black otherwise.</p>
+ <p id="b">This text should be green if the user requested contrast. Black otherwise.</p>
+ <p id="c">This text should be green if the user requested contrast. Black otherwise.</p>
+ <p id="d">This text should be green if the user has not requested contrast. Black otherwise.</p>
+</body>
+</html>
Added: trunk/LayoutTests/platform/ios-simulator/fast/media/mq-prefers-contrast-forced-value-expected.html (0 => 270823)
--- trunk/LayoutTests/platform/ios-simulator/fast/media/mq-prefers-contrast-forced-value-expected.html (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator/fast/media/mq-prefers-contrast-forced-value-expected.html 2020-12-15 06:28:57 UTC (rev 270823)
@@ -0,0 +1,14 @@
+<html>
+<head>
+<title>CSS4 media query test: prefers-contrast.</title>
+<style type="text/css">
+p { color: green; }
+</style>
+</head>
+<body>
+ <p id="a">This text should be green.</p>
+ <p id="b">This text should be green.</p>
+ <p id="c">This text should be green.</p>
+ <p id="d">This text should be green.</p>
+</body>
+</html>
Added: trunk/LayoutTests/platform/ios-simulator/fast/media/mq-prefers-contrast-live-update-expected.html (0 => 270823)
--- trunk/LayoutTests/platform/ios-simulator/fast/media/mq-prefers-contrast-live-update-expected.html (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator/fast/media/mq-prefers-contrast-live-update-expected.html 2020-12-15 06:28:57 UTC (rev 270823)
@@ -0,0 +1,17 @@
+<html>
+<head>
+<title>CSS4 media query test: prefers-contrast.</title>
+<style type="text/css">
+p { color: black; }
+
+@media (prefers-contrast) {
+ #a { color: green; }
+}
+</style>
+</head>
+<body>
+ <p id="a"></p>
+ <p>Before was: <span id="before">rgb(0, 0, 0)</span> - should be rgb(0, 0, 0)</p>
+ <p>After was: <span id="after">rgb(0, 128, 0)</span> - should be rgb(0, 128, 0)</p>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/ios-wk2/TestExpectations (270822 => 270823)
--- trunk/LayoutTests/platform/ios-wk2/TestExpectations 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/LayoutTests/platform/ios-wk2/TestExpectations 2020-12-15 06:28:57 UTC (rev 270823)
@@ -37,6 +37,8 @@
fast/media/mq-inverted-colors-live-update-in-subframes.html [ Pass ]
fast/media/mq-monochrome-live-update.html [ Pass ]
fast/media/mq-prefers-reduced-motion-live-update.html [ Pass ]
+fast/media/mq-prefers-contrast.html [ Pass ]
+fast/media/mq-prefers-contrast-live-update.html [ Pass ]
fast/repaint/placeholder-after-caps-lock-hidden.html [ Pass ]
@@ -1893,4 +1895,4 @@
webkit.org/b/219403 imported/w3c/web-platform-tests/webrtc/RTCPeerConnection-candidate-in-sdp.https.html [ Pass Failure ]
-webkit.org/b/219438 [ Release ] ast/canvas/canvas-overflow-hidden-animation.html [ Pass ImageOnlyFailure ]
\ No newline at end of file
+webkit.org/b/219438 [ Release ] ast/canvas/canvas-overflow-hidden-animation.html [ Pass ImageOnlyFailure ]
Added: trunk/LayoutTests/platform/mac/fast/media/mq-prefers-contrast-expected.html (0 => 270823)
--- trunk/LayoutTests/platform/mac/fast/media/mq-prefers-contrast-expected.html (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/media/mq-prefers-contrast-expected.html 2020-12-15 06:28:57 UTC (rev 270823)
@@ -0,0 +1,33 @@
+<html>
+<head>
+<title>CSS4 media query test: prefers-contrast.</title>
+<style type="text/css">
+#a { color: black; }
+#b { color: black; }
+#c { color: black; }
+#d { color: black; }
+
+@media (prefers-contrast) {
+#a { color: green; }
+}
+
+@media (prefers-contrast: more) {
+#b { color: green; }
+}
+
+@media (prefers-contrast: less) {
+#c { color: green; }
+}
+
+@media (prefers-contrast: no-preference) {
+#d { color: green; }
+}
+</style>
+</head>
+<body>
+ <p id="a">This text should be green if the user requested contrast. Black otherwise.</p>
+ <p id="b">This text should be green if the user requested contrast. Black otherwise.</p>
+ <p id="c">This text should be green if the user requested contrast. Black otherwise.</p>
+ <p id="d">This text should be green if the user has not requested contrast. Black otherwise.</p>
+</body>
+</html>
Added: trunk/LayoutTests/platform/mac/fast/media/mq-prefers-contrast-forced-value-expected.html (0 => 270823)
--- trunk/LayoutTests/platform/mac/fast/media/mq-prefers-contrast-forced-value-expected.html (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/media/mq-prefers-contrast-forced-value-expected.html 2020-12-15 06:28:57 UTC (rev 270823)
@@ -0,0 +1,14 @@
+<html>
+<head>
+<title>CSS4 media query test: prefers-contrast.</title>
+<style type="text/css">
+p { color: green; }
+</style>
+</head>
+<body>
+ <p id="a">This text should be green.</p>
+ <p id="b">This text should be green.</p>
+ <p id="c">This text should be green.</p>
+ <p id="d">This text should be green.</p>
+</body>
+</html>
Added: trunk/LayoutTests/platform/mac/fast/media/mq-prefers-contrast-live-update-expected.html (0 => 270823)
--- trunk/LayoutTests/platform/mac/fast/media/mq-prefers-contrast-live-update-expected.html (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/media/mq-prefers-contrast-live-update-expected.html 2020-12-15 06:28:57 UTC (rev 270823)
@@ -0,0 +1,17 @@
+<html>
+<head>
+<title>CSS4 media query test: prefers-contrast.</title>
+<style type="text/css">
+p { color: black; }
+
+@media (prefers-contrast) {
+ #a { color: green; }
+}
+</style>
+</head>
+<body>
+ <p id="a"></p>
+ <p>Before was: <span id="before">rgb(0, 0, 0)</span> - should be rgb(0, 0, 0)</p>
+ <p>After was: <span id="after">rgb(0, 128, 0)</span> - should be rgb(0, 128, 0)</p>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (270822 => 270823)
--- trunk/LayoutTests/platform/mac-wk2/TestExpectations 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations 2020-12-15 06:28:57 UTC (rev 270823)
@@ -39,6 +39,8 @@
fast/media/mq-inverted-colors-live-update-in-subframes.html [ Pass ]
fast/media/mq-monochrome-live-update.html [ Pass ]
fast/media/mq-prefers-reduced-motion-live-update.html [ Pass ]
+fast/media/mq-prefers-contrast-live-update.html [ Pass ]
+fast/media/mq-prefers-contrast.html [ Pass ]
http/tests/ssl/applepay [ Pass ]
@@ -1316,4 +1318,4 @@
webkit.org/b/219322 fast/layoutformattingcontext/table-simple-border-collapse2.html [ ImageOnlyFailure ]
webkit.org/b/218995 fast/lists/001.html [ Skip ]
-webkit.org/b/218995 fast/lists/001-vertical.html [ Skip ]
\ No newline at end of file
+webkit.org/b/218995 fast/lists/001-vertical.html [ Skip ]
Modified: trunk/Source/WebCore/ChangeLog (270822 => 270823)
--- trunk/Source/WebCore/ChangeLog 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/ChangeLog 2020-12-15 06:28:57 UTC (rev 270823)
@@ -1,3 +1,52 @@
+2020-12-14 Chris Fleizach <[email protected]>
+
+ AX: implement prefers-contrast: more
+ https://bugs.webkit.org/show_bug.cgi?id=215507
+ <rdar://problem/67077492>
+
+ Reviewed by Dean Jackson.
+
+ Implement prefers-contrast as defined in
+ https://drafts.csswg.org/mediaqueries-5/#prefers-contrast
+
+ Tests: fast/media/mq-prefers-contrast-forced-value.html
+ fast/media/mq-prefers-contrast-live-update-for-listener.html
+ fast/media/mq-prefers-contrast-live-update.html
+ fast/media/mq-prefers-contrast-matchMedia.html
+ fast/media/mq-prefers-contrast.html
+
+ * css/CSSValueKeywords.in:
+ * css/MediaFeatureNames.h:
+ * css/MediaQueryEvaluator.cpp:
+ (WebCore::isAccessibilitySettingsDependent):
+ (WebCore::prefersContrastEvaluate):
+ * css/MediaQueryExpression.cpp:
+ (WebCore::featureWithValidIdent):
+ (WebCore::isFeatureValidWithoutValue):
+ * page/Settings.yaml:
+ * platform/Theme.cpp:
+ (WebCore::Theme::userPrefersContrast const):
+ * platform/Theme.h:
+ * platform/ios/ThemeIOS.h:
+ * platform/ios/ThemeIOS.mm:
+ (WebCore::ThemeIOS::userPrefersContrast const):
+ * platform/mac/ThemeMac.h:
+ * platform/mac/ThemeMac.mm:
+ (WebCore::ThemeMac::userPrefersContrast const):
+ * testing/InternalSettings.cpp:
+ (WebCore::InternalSettings::Backup::Backup):
+ (WebCore::InternalSettings::Backup::restoreTo):
+ (WebCore::InternalSettings::forcedPrefersContrastAccessibilityValue const):
+ (WebCore::InternalSettings::setForcedPrefersContrastAccessibilityValue):
+ * testing/InternalSettings.h:
+ * testing/InternalSettings.idl:
+ * testing/Internals.cpp:
+ (WebCore::Internals::userPrefersContrast const):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+ * testing/Internals.mm:
+ (WebCore::Internals::userPrefersContrast const):
+
2020-12-14 Peng Liu <[email protected]>
[Media in GPU Process][MSE] VP9 stream playback is not smooth
Modified: trunk/Source/WebCore/PAL/ChangeLog (270822 => 270823)
--- trunk/Source/WebCore/PAL/ChangeLog 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/PAL/ChangeLog 2020-12-15 06:28:57 UTC (rev 270823)
@@ -1,3 +1,13 @@
+2020-12-14 Chris Fleizach <[email protected]>
+
+ AX: implement prefers-contrast: more
+ https://bugs.webkit.org/show_bug.cgi?id=215507
+ <rdar://problem/67077492>
+
+ Reviewed by Dean Jackson.
+
+ * pal/ios/UIKitSoftLink.h:
+
2020-12-14 Tim Horton <[email protected]>
Adopt symbol image API instead of SPI in WKPDFHUDView
Modified: trunk/Source/WebCore/PAL/pal/ios/UIKitSoftLink.h (270822 => 270823)
--- trunk/Source/WebCore/PAL/pal/ios/UIKitSoftLink.h 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/PAL/pal/ios/UIKitSoftLink.h 2020-12-15 06:28:57 UTC (rev 270823)
@@ -66,6 +66,7 @@
SOFT_LINK_FUNCTION_FOR_HEADER(PAL, UIKit, UIAccessibilityIsGrayscaleEnabled, BOOL, (void), ())
SOFT_LINK_FUNCTION_FOR_HEADER(PAL, UIKit, UIAccessibilityIsInvertColorsEnabled, BOOL, (void), ())
SOFT_LINK_FUNCTION_FOR_HEADER(PAL, UIKit, UIAccessibilityIsReduceMotionEnabled, BOOL, (void), ())
+SOFT_LINK_FUNCTION_FOR_HEADER(PAL, UIKit, UIAccessibilityDarkerSystemColorsEnabled, BOOL, (void), ())
SOFT_LINK_FUNCTION_FOR_HEADER(PAL, UIKit, UIAccessibilityPostNotification, void, (UIAccessibilityNotifications n, id argument), (n, argument))
SOFT_LINK_FUNCTION_FOR_HEADER(PAL, UIKit, UIGraphicsGetCurrentContext, CGContextRef, (void), ())
SOFT_LINK_FUNCTION_FOR_HEADER(PAL, UIKit, UIGraphicsPopContext, void, (void), ())
Modified: trunk/Source/WebCore/PAL/pal/ios/UIKitSoftLink.mm (270822 => 270823)
--- trunk/Source/WebCore/PAL/pal/ios/UIKitSoftLink.mm 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/PAL/pal/ios/UIKitSoftLink.mm 2020-12-15 06:28:57 UTC (rev 270823)
@@ -66,6 +66,7 @@
SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, UIKit, UIAccessibilityIsGrayscaleEnabled, BOOL, (void), ())
SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, UIKit, UIAccessibilityIsInvertColorsEnabled, BOOL, (void), ())
SOFT_LINK_FUNCTION_FOR_SOURCE_WITH_EXPORT(PAL, UIKit, UIAccessibilityIsReduceMotionEnabled, BOOL, (void), (), PAL_EXPORT)
+SOFT_LINK_FUNCTION_FOR_SOURCE_WITH_EXPORT(PAL, UIKit, UIAccessibilityDarkerSystemColorsEnabled, BOOL, (void), (), PAL_EXPORT)
SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, UIKit, UIAccessibilityPostNotification, void, (UIAccessibilityNotifications n, id argument), (n, argument))
SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, UIKit, UIGraphicsGetCurrentContext, CGContextRef, (void), ())
SOFT_LINK_FUNCTION_FOR_SOURCE(PAL, UIKit, UIGraphicsPopContext, void, (void), ())
Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (270822 => 270823)
--- trunk/Source/WebCore/css/CSSValueKeywords.in 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in 2020-12-15 06:28:57 UTC (rev 270823)
@@ -1414,6 +1414,12 @@
reduce
no-preference
+// prefers-contrast
+forced
+more
+less
+// no-preference
+
#if defined(ENABLE_DARK_MODE_CSS) && ENABLE_DARK_MODE_CSS
// prefers-color-scheme
light
Modified: trunk/Source/WebCore/css/MediaFeatureNames.h (270822 => 270823)
--- trunk/Source/WebCore/css/MediaFeatureNames.h 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/css/MediaFeatureNames.h 2020-12-15 06:28:57 UTC (rev 270823)
@@ -77,6 +77,7 @@
macro(monochrome, "monochrome") \
macro(orientation, "orientation") \
macro(pointer, "pointer") \
+ macro(prefersContrast, "prefers-contrast") \
macro(prefersDarkInterface, "prefers-dark-interface") \
macro(prefersReducedMotion, "prefers-reduced-motion") \
macro(resolution, "resolution") \
Modified: trunk/Source/WebCore/css/MediaQueryEvaluator.cpp (270822 => 270823)
--- trunk/Source/WebCore/css/MediaQueryEvaluator.cpp 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/css/MediaQueryEvaluator.cpp 2020-12-15 06:28:57 UTC (rev 270823)
@@ -83,7 +83,8 @@
|| mediaFeature == MediaFeatureNames::maxMonochrome
|| mediaFeature == MediaFeatureNames::minMonochrome
|| mediaFeature == MediaFeatureNames::monochrome
- || mediaFeature == MediaFeatureNames::prefersReducedMotion;
+ || mediaFeature == MediaFeatureNames::prefersReducedMotion
+ || mediaFeature == MediaFeatureNames::prefersContrast;
}
static bool isViewportDependent(const AtomString& mediaFeature)
@@ -820,6 +821,30 @@
}
#endif
+static bool prefersContrastEvaluate(CSSValue* value, const CSSToLengthConversionData&, Frame& frame, MediaFeaturePrefix)
+{
+ bool userPrefersContrast = false;
+
+ switch (frame.settings().forcedPrefersContrastAccessibilityValue()) {
+ case ForcedAccessibilityValue::On:
+ userPrefersContrast = true;
+ break;
+ case ForcedAccessibilityValue::Off:
+ break;
+ case ForcedAccessibilityValue::System:
+#if PLATFORM(MAC) || PLATFORM(IOS_FAMILY)
+ userPrefersContrast = Theme::singleton().userPrefersContrast();
+#endif
+ break;
+ }
+
+ if (!value)
+ return userPrefersContrast;
+
+ // Apple platforms: less and forced are ignored and only "more" is mapped to the user's preference.
+ return downcast<CSSPrimitiveValue>(*value).valueID() == (userPrefersContrast ? CSSValueMore : CSSValueNoPreference);
+}
+
static bool prefersReducedMotionEvaluate(CSSValue* value, const CSSToLengthConversionData&, Frame& frame, MediaFeaturePrefix)
{
bool userPrefersReducedMotion = false;
Modified: trunk/Source/WebCore/css/MediaQueryExpression.cpp (270822 => 270823)
--- trunk/Source/WebCore/css/MediaQueryExpression.cpp 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/css/MediaQueryExpression.cpp 2020-12-15 06:28:57 UTC (rev 270823)
@@ -56,6 +56,7 @@
#if ENABLE(DARK_MODE_CSS)
|| (mediaFeature == MediaFeatureNames::prefersColorScheme)
#endif
+ || mediaFeature == MediaFeatureNames::prefersContrast
|| mediaFeature == MediaFeatureNames::prefersReducedMotion
|| (mediaFeature == MediaFeatureNames::prefersDarkInterface && (context.useSystemAppearance || isUASheetBehavior(context.mode)))
|| mediaFeature == MediaFeatureNames::dynamicRange;
@@ -165,6 +166,7 @@
|| mediaFeature == MediaFeatureNames::animation
|| mediaFeature == MediaFeatureNames::invertedColors
|| mediaFeature == MediaFeatureNames::pointer
+ || mediaFeature == MediaFeatureNames::prefersContrast
|| mediaFeature == MediaFeatureNames::prefersReducedMotion
|| (mediaFeature == MediaFeatureNames::prefersDarkInterface && (context.useSystemAppearance || isUASheetBehavior(context.mode)))
#if ENABLE(DARK_MODE_CSS)
Modified: trunk/Source/WebCore/page/Settings.yaml (270822 => 270823)
--- trunk/Source/WebCore/page/Settings.yaml 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/page/Settings.yaml 2020-12-15 06:28:57 UTC (rev 270823)
@@ -185,6 +185,13 @@
WebCore:
default: false
+ForcedPrefersContrastAccessibilityValue:
+ type: uint32_t
+ refinedType: ForcedAccessibilityValue
+ defaultValue:
+ WebCore:
+ default: ForcedAccessibilityValue::System
+
ForcedColorsAreInvertedAccessibilityValue:
type: uint32_t
refinedType: ForcedAccessibilityValue
Modified: trunk/Source/WebCore/platform/Theme.cpp (270822 => 270823)
--- trunk/Source/WebCore/platform/Theme.cpp 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/platform/Theme.cpp 2020-12-15 06:28:57 UTC (rev 270823)
@@ -71,6 +71,12 @@
return false;
}
+bool Theme::userPrefersContrast() const
+{
+ return false;
+}
+
+
LengthBox Theme::controlBorder(ControlPart part, const FontCascade&, const LengthBox& zoomedBox, float) const
{
switch (part) {
Modified: trunk/Source/WebCore/platform/Theme.h (270822 => 270823)
--- trunk/Source/WebCore/platform/Theme.h 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/platform/Theme.h 2020-12-15 06:28:57 UTC (rev 270823)
@@ -77,6 +77,7 @@
virtual void drawNamedImage(const String&, GraphicsContext&, const FloatRect&) const;
+ virtual bool userPrefersContrast() const;
virtual bool userPrefersReducedMotion() const;
protected:
Modified: trunk/Source/WebCore/platform/ios/ThemeIOS.h (270822 => 270823)
--- trunk/Source/WebCore/platform/ios/ThemeIOS.h 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/platform/ios/ThemeIOS.h 2020-12-15 06:28:57 UTC (rev 270823)
@@ -34,6 +34,7 @@
class ThemeIOS final : public ThemeCocoa {
private:
bool userPrefersReducedMotion() const final;
+ bool userPrefersContrast() const final;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/ios/ThemeIOS.mm (270822 => 270823)
--- trunk/Source/WebCore/platform/ios/ThemeIOS.mm 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/platform/ios/ThemeIOS.mm 2020-12-15 06:28:57 UTC (rev 270823)
@@ -46,6 +46,11 @@
return PAL::softLink_UIKit_UIAccessibilityIsReduceMotionEnabled();
}
+bool ThemeIOS::userPrefersContrast() const
+{
+ return PAL::softLink_UIKit_UIAccessibilityDarkerSystemColorsEnabled();
}
+}
+
#endif // PLATFORM(IOS_FAMILY)
Modified: trunk/Source/WebCore/platform/mac/ThemeMac.h (270822 => 270823)
--- trunk/Source/WebCore/platform/mac/ThemeMac.h 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/platform/mac/ThemeMac.h 2020-12-15 06:28:57 UTC (rev 270823)
@@ -61,6 +61,7 @@
void inflateControlPaintRect(ControlPart, const ControlStates&, FloatRect&, float zoomFactor) const final;
bool userPrefersReducedMotion() const final;
+ bool userPrefersContrast() const final;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/mac/ThemeMac.mm (270822 => 270823)
--- trunk/Source/WebCore/platform/mac/ThemeMac.mm 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/platform/mac/ThemeMac.mm 2020-12-15 06:28:57 UTC (rev 270823)
@@ -971,6 +971,11 @@
return [[NSWorkspace sharedWorkspace] accessibilityDisplayShouldReduceMotion];
}
+bool ThemeMac::userPrefersContrast() const
+{
+ return [[NSWorkspace sharedWorkspace] accessibilityDisplayShouldIncreaseContrast];
+}
+
#if HAVE(LARGE_CONTROL_SIZE)
bool ThemeMac::supportsLargeFormControls()
Modified: trunk/Source/WebCore/testing/InternalSettings.cpp (270822 => 270823)
--- trunk/Source/WebCore/testing/InternalSettings.cpp 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/testing/InternalSettings.cpp 2020-12-15 06:28:57 UTC (rev 270823)
@@ -58,6 +58,7 @@
, m_pdfImageCachingPolicy(settings.pdfImageCachingPolicy())
, m_forcedColorsAreInvertedAccessibilityValue(settings.forcedColorsAreInvertedAccessibilityValue())
, m_forcedDisplayIsMonochromeAccessibilityValue(settings.forcedDisplayIsMonochromeAccessibilityValue())
+ , m_forcedPrefersContrastAccessibilityValue(settings.forcedPrefersContrastAccessibilityValue())
, m_forcedPrefersReducedMotionAccessibilityValue(settings.forcedPrefersReducedMotionAccessibilityValue())
, m_fontLoadTimingOverride(settings.fontLoadTimingOverride())
, m_frameFlattening(settings.frameFlattening())
@@ -116,6 +117,7 @@
settings.setPdfImageCachingPolicy(m_pdfImageCachingPolicy);
settings.setForcedColorsAreInvertedAccessibilityValue(m_forcedColorsAreInvertedAccessibilityValue);
settings.setForcedDisplayIsMonochromeAccessibilityValue(m_forcedDisplayIsMonochromeAccessibilityValue);
+ settings.setForcedPrefersContrastAccessibilityValue(m_forcedPrefersContrastAccessibilityValue);
settings.setForcedPrefersReducedMotionAccessibilityValue(m_forcedPrefersReducedMotionAccessibilityValue);
settings.setFontLoadTimingOverride(m_fontLoadTimingOverride);
settings.setFrameFlattening(m_frameFlattening);
@@ -395,6 +397,16 @@
settings().setForcedDisplayIsMonochromeAccessibilityValue(value);
}
+InternalSettings::ForcedAccessibilityValue InternalSettings::forcedPrefersContrastAccessibilityValue() const
+{
+ return settings().forcedPrefersContrastAccessibilityValue();
+}
+
+void InternalSettings::setForcedPrefersContrastAccessibilityValue(InternalSettings::ForcedAccessibilityValue value)
+{
+ settings().setForcedPrefersContrastAccessibilityValue(value);
+}
+
InternalSettings::ForcedAccessibilityValue InternalSettings::forcedPrefersReducedMotionAccessibilityValue() const
{
return settings().forcedPrefersReducedMotionAccessibilityValue();
Modified: trunk/Source/WebCore/testing/InternalSettings.h (270822 => 270823)
--- trunk/Source/WebCore/testing/InternalSettings.h 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/testing/InternalSettings.h 2020-12-15 06:28:57 UTC (rev 270823)
@@ -82,6 +82,8 @@
void setForcedColorsAreInvertedAccessibilityValue(ForcedAccessibilityValue);
ForcedAccessibilityValue forcedDisplayIsMonochromeAccessibilityValue() const;
void setForcedDisplayIsMonochromeAccessibilityValue(ForcedAccessibilityValue);
+ ForcedAccessibilityValue forcedPrefersContrastAccessibilityValue() const;
+ void setForcedPrefersContrastAccessibilityValue(ForcedAccessibilityValue);
ForcedAccessibilityValue forcedPrefersReducedMotionAccessibilityValue() const;
void setForcedPrefersReducedMotionAccessibilityValue(ForcedAccessibilityValue);
ForcedAccessibilityValue forcedSupportsHighDynamicRangeValue() const;
@@ -152,6 +154,7 @@
WebCore::PDFImageCachingPolicy m_pdfImageCachingPolicy;
WebCore::ForcedAccessibilityValue m_forcedColorsAreInvertedAccessibilityValue;
WebCore::ForcedAccessibilityValue m_forcedDisplayIsMonochromeAccessibilityValue;
+ WebCore::ForcedAccessibilityValue m_forcedPrefersContrastAccessibilityValue;
WebCore::ForcedAccessibilityValue m_forcedPrefersReducedMotionAccessibilityValue;
WebCore::FontLoadTimingOverride m_fontLoadTimingOverride;
WebCore::FrameFlattening m_frameFlattening;
Modified: trunk/Source/WebCore/testing/InternalSettings.idl (270822 => 270823)
--- trunk/Source/WebCore/testing/InternalSettings.idl 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/testing/InternalSettings.idl 2020-12-15 06:28:57 UTC (rev 270823)
@@ -60,6 +60,7 @@
[MayThrowException] undefined setSystemLayoutDirection(SystemLayoutDirection direction);
attribute ForcedAccessibilityValue forcedColorsAreInvertedAccessibilityValue;
attribute ForcedAccessibilityValue forcedDisplayIsMonochromeAccessibilityValue;
+ attribute ForcedAccessibilityValue forcedPrefersContrastAccessibilityValue;
attribute ForcedAccessibilityValue forcedPrefersReducedMotionAccessibilityValue;
attribute ForcedAccessibilityValue forcedSupportsHighDynamicRangeValue;
Modified: trunk/Source/WebCore/testing/Internals.cpp (270822 => 270823)
--- trunk/Source/WebCore/testing/Internals.cpp 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/testing/Internals.cpp 2020-12-15 06:28:57 UTC (rev 270823)
@@ -4868,6 +4868,11 @@
return false;
}
+bool Internals::userPrefersContrast() const
+{
+ return false;
+}
+
#if ENABLE(VIDEO)
double Internals::privatePlayerVolume(const HTMLMediaElement&)
{
Modified: trunk/Source/WebCore/testing/Internals.h (270822 => 270823)
--- trunk/Source/WebCore/testing/Internals.h 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/testing/Internals.h 2020-12-15 06:28:57 UTC (rev 270823)
@@ -745,6 +745,7 @@
enum class UserInterfaceLayoutDirection : uint8_t { LTR, RTL };
void setUserInterfaceLayoutDirection(UserInterfaceLayoutDirection);
+ bool userPrefersContrast() const;
bool userPrefersReducedMotion() const;
void reportBacktrace();
Modified: trunk/Source/WebCore/testing/Internals.idl (270822 => 270823)
--- trunk/Source/WebCore/testing/Internals.idl 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/testing/Internals.idl 2020-12-15 06:28:57 UTC (rev 270823)
@@ -771,8 +771,9 @@
undefined setUserInterfaceLayoutDirection(UserInterfaceLayoutDirection userInterfaceLayoutDirection);
undefined setBaseWritingDirection(BaseWritingDirection direction);
+ boolean userPrefersContrast();
boolean userPrefersReducedMotion();
-
+
undefined reportBacktrace();
[Conditional=POINTER_LOCK] boolean pageHasPendingPointerLock();
Modified: trunk/Source/WebCore/testing/Internals.mm (270822 => 270823)
--- trunk/Source/WebCore/testing/Internals.mm 2020-12-15 06:16:26 UTC (rev 270822)
+++ trunk/Source/WebCore/testing/Internals.mm 2020-12-15 06:28:57 UTC (rev 270823)
@@ -53,6 +53,15 @@
return WTF::userVisibleString(url.href());
}
+bool Internals::userPrefersContrast() const
+{
+#if PLATFORM(IOS_FAMILY)
+ return PAL::softLink_UIKit_UIAccessibilityDarkerSystemColorsEnabled();
+#else
+ return [[NSWorkspace sharedWorkspace] accessibilityDisplayShouldIncreaseContrast];
+#endif
+}
+
bool Internals::userPrefersReducedMotion() const
{
#if PLATFORM(IOS_FAMILY)