Add support for prefers-color-scheme media query
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Oct 2018 23:43:02 +0000 (23:43 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Oct 2018 23:43:02 +0000 (23:43 +0000)
commit39cf796f6955ad27190012e485522ee61b97b5c6
tree31819451e6b1f436ca3d90508b6cd6ecc7302ef9
parent0cf40ae217add1a99525725f34d181ea14e7a646
Add support for prefers-color-scheme media query
https://bugs.webkit.org/show_bug.cgi?id=190499
rdar://problem/45212025

Reviewed by Dean Jackson.

Source/JavaScriptCore:

* Configurations/FeatureDefines.xcconfig: Added ENABLE_DARK_MODE_CSS.

Source/WebCore:

Test: css-dark-mode/prefers-color-scheme.html

* Configurations/FeatureDefines.xcconfig: Added ENABLE_DARK_MODE_CSS.
* css/CSSValueKeywords.in: Added light and dark.
* css/MediaFeatureNames.h: Added prefers-color-scheme.
* css/MediaQueryEvaluator.cpp:
(WebCore::prefersColorSchemeEvaluate): Added.
* css/MediaQueryExpression.cpp:
(WebCore::featureWithValidIdent): Added prefers-color-scheme.
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setDarkModeCSSEnabled): Added.
(WebCore::RuntimeEnabledFeatures::darkModeCSSEnabled const): Added.
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::resetToConsistentState): Reset setUseDarkAppearance.
(WebCore::InternalSettings::setUseDarkAppearance): Added.
* testing/InternalSettings.h: Added setUseDarkAppearance.
* testing/InternalSettings.idl: Ditto.

Source/WebCore/PAL:

* Configurations/FeatureDefines.xcconfig: Added ENABLE_DARK_MODE_CSS.

Source/WebKit:

* Configurations/FeatureDefines.xcconfig: Added ENABLE_DARK_MODE_CSS.
* Shared/WebPreferences.yaml: Added DarkModeCSSEnabled as experimental.

Source/WebKitLegacy/mac:

* Configurations/FeatureDefines.xcconfig: Added ENABLE_DARK_MODE_CSS.

Source/WTF:

* wtf/FeatureDefines.h: Added ENABLE_DARK_MODE_CSS.

Tools:

* Scripts/webkitperl/FeatureList.pm: Added ENABLE_DARK_MODE_CSS as dark-mode-css.
* TestWebKitAPI/Configurations/FeatureDefines.xcconfig: Added ENABLE_DARK_MODE_CSS.

LayoutTests:

* css-dark-mode/prefers-color-scheme-expected.txt: Added.
* css-dark-mode/prefers-color-scheme.html: Added.
* platform/gtk/TestExpectations: Skip css-dark-mode.
* platform/ios/TestExpectations: Skip css-dark-mode.
* platform/mac-wk1/TestExpectations: Skip css-dark-mode.
* platform/win/TestExpectations: Skip css-dark-mode.
* platform/wincairo/TestExpectations: Skip css-dark-mode.
* platform/wpe/TestExpectations: Skip css-dark-mode.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237156 268f45cc-cd09-0410-ab3c-d52691b4dbfc
37 files changed:
LayoutTests/ChangeLog
LayoutTests/css-dark-mode/prefers-color-scheme-expected.txt [new file with mode: 0644]
LayoutTests/css-dark-mode/prefers-color-scheme.html [new file with mode: 0644]
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/ios/TestExpectations
LayoutTests/platform/mac-highsierra/css-dark-mode/prefers-color-scheme-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-sierra/css-dark-mode/prefers-color-scheme-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-wk1/TestExpectations
LayoutTests/platform/win/TestExpectations
LayoutTests/platform/wincairo/TestExpectations
LayoutTests/platform/wpe/TestExpectations
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig
Source/WTF/ChangeLog
Source/WTF/wtf/FeatureDefines.h
Source/WebCore/ChangeLog
Source/WebCore/Configurations/FeatureDefines.xcconfig
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/MediaFeatureNames.h
Source/WebCore/css/MediaQueryEvaluator.cpp
Source/WebCore/css/MediaQueryExpression.cpp
Source/WebCore/page/RuntimeEnabledFeatures.h
Source/WebCore/testing/InternalSettings.cpp
Source/WebCore/testing/InternalSettings.h
Source/WebCore/testing/InternalSettings.idl
Source/WebKit/ChangeLog
Source/WebKit/Configurations/FeatureDefines.xcconfig
Source/WebKit/Shared/WebPreferences.yaml
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/Configurations/FeatureDefines.xcconfig
Source/cmake/tools/vsprops/FeatureDefines.props
Source/cmake/tools/vsprops/FeatureDefinesCairo.props
Tools/ChangeLog
Tools/Scripts/webkitperl/FeatureList.pm
Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig