+2018-11-14 Timothy Hatcher <timothy@apple.com>
+
+ Update prefers-color-scheme media query matching based on GitHub issue #3278.
+ https://bugs.webkit.org/show_bug.cgi?id=191654
+ rdar://problem/46074307
+
+ Reviewed by Simon Fraser.
+
+ * css-dark-mode/prefers-color-scheme-expected.txt: Rebaseline.
+ * css-dark-mode/prefers-color-scheme.html: Updates to better match the spec.
+
2018-11-14 Devin Rousso <drousso@apple.com>
Web Inspector: Canvas: send a call stack with each action instead of an array of call frames
<script src="../resources/testharnessreport.js"></script>
<style>
-#test1 {
+div {
background-color: red;
color: text;
}
}
}
+@media (prefers-color-scheme: no-preference) {
+ /* This is valid, but should not apply for us since there is no option for no user preference. */
+ #test1 {
+ background-color: cyan;
+ }
+}
+
@media (prefers-color-scheme: foo) {
/* This is invalid and should not apply. */
#test1 {
}
@media (prefers-color-scheme) {
- /* This is invalid and should not apply. */
- #test1 {
- background-color: orange;
+ /* This is valid and should always apply for us, since there is always a user preference currently. */
+ #test2 {
+ background-color: lime;
}
}
</style>
<div id="test1"></div>
+<div id="test2"></div>
<script>
function test_prop(id, prop, expected) {
}, "Element colors are correct in light color scheme");
test(function() {
+ // Styled background-color in media query should be lime green.
+ test_prop("test2", "background-color", "rgb(0, 255, 0)");
+
+ // The semantic text color should be black.
+ test_prop("test2", "color", "rgb(0, 0, 0)");
+}, "Element colors are correct in light color scheme with boolean context query");
+
+test(function() {
if (window.internals)
internals.settings.setUseDarkAppearance(true);
}, "Dark color scheme enabled");
// The semantic text color should be black, and not change.
test_prop("test1", "color", "rgb(0, 0, 0)");
}, "Element colors are correct in dark color scheme");
+
+test(function() {
+ // Styled background-color in media query should be lime green.
+ test_prop("test2", "background-color", "rgb(0, 255, 0)");
+
+ // The semantic text color should be black.
+ test_prop("test2", "color", "rgb(0, 0, 0)");
+}, "Element colors are correct in dark color scheme with boolean context query");
</script>
+2018-11-14 Timothy Hatcher <timothy@apple.com>
+
+ Update prefers-color-scheme media query matching based on GitHub issue #3278.
+ https://bugs.webkit.org/show_bug.cgi?id=191654
+ rdar://problem/46074307
+
+ Reviewed by Simon Fraser.
+
+ Test: css-dark-mode/prefers-color-scheme.html
+
+ * css/MediaQueryEvaluator.cpp:
+ (WebCore::prefersColorSchemeEvaluate): Return true when there is no value. Return false
+ for `no-preference` since there is no macOS option for no user preference.
+ * css/MediaQueryExpression.cpp:
+ (WebCore::isFeatureValidWithoutValue): Added prefers-color-scheme.
+
2018-11-14 Devin Rousso <drousso@apple.com>
Web Inspector: Canvas: send a call stack with each action instead of an array of call frames
|| mediaFeature == MediaFeatureNames::pointer
|| mediaFeature == MediaFeatureNames::prefersReducedMotion
|| (mediaFeature == MediaFeatureNames::prefersDarkInterface && (context.useSystemAppearance || isUASheetBehavior(context.mode)))
+#if ENABLE(DARK_MODE_CSS)
+ || (mediaFeature == MediaFeatureNames::prefersColorScheme && RuntimeEnabledFeatures::sharedFeatures().darkModeCSSEnabled())
+#endif
|| mediaFeature == MediaFeatureNames::devicePixelRatio
|| mediaFeature == MediaFeatureNames::resolution
#if ENABLE(APPLICATION_MANIFEST)