Diff
Modified: trunk/ChangeLog (244765 => 244766)
--- trunk/ChangeLog 2019-04-30 09:04:15 UTC (rev 244765)
+++ trunk/ChangeLog 2019-04-30 09:06:23 UTC (rev 244766)
@@ -1,3 +1,15 @@
+2019-04-30 Carlos Garcia Campos <[email protected]>
+
+ [GTK] Support prefers-color-scheme media query
+ https://bugs.webkit.org/show_bug.cgi?id=196685
+
+ Reviewed by Michael Catanzaro.
+
+ Enable DARK_MODE_CSS. Supported color schemes feature is not supported for now. I'm not sure we will be able to
+ suport it, because it requires to change the theme too many times, which is very slow in GTK.
+
+ * Source/cmake/OptionsGTK.cmake:
+
2019-04-29 Don Olmstead <[email protected]>
[CMake] Add WEBKIT_EXECUTABLE macro
Modified: trunk/LayoutTests/ChangeLog (244765 => 244766)
--- trunk/LayoutTests/ChangeLog 2019-04-30 09:04:15 UTC (rev 244765)
+++ trunk/LayoutTests/ChangeLog 2019-04-30 09:06:23 UTC (rev 244766)
@@ -1,5 +1,23 @@
2019-04-30 Carlos Garcia Campos <[email protected]>
+ [GTK] Support prefers-color-scheme media query
+ https://bugs.webkit.org/show_bug.cgi?id=196685
+
+ Reviewed by Michael Catanzaro.
+
+ Unskip css-dark-mode tests and add platform specific results for some of the tests using the supported color
+ scheme feature.
+
+ * platform/gtk/TestExpectations:
+ * platform/gtk/css-dark-mode/color-scheme-css-expected.txt: Added.
+ * platform/gtk/css-dark-mode/color-scheme-meta-expected.txt: Added.
+ * platform/gtk/css-dark-mode/default-colors-expected.txt: Added.
+ * platform/gtk/css-dark-mode/older-syntax/supported-color-schemes-css-expected.txt: Added.
+ * platform/gtk/css-dark-mode/older-syntax/supported-color-schemes-meta-expected.txt: Added.
+ * platform/gtk/css-dark-mode/prefers-color-scheme-expected.txt: Added.
+
+2019-04-30 Carlos Garcia Campos <[email protected]>
+
Unreviewed GTK gardening. Rebaseline tests after r244635.
* platform/gtk/css3/selectors3/html/css3-modsel-24-expected.png:
Modified: trunk/LayoutTests/platform/gtk/TestExpectations (244765 => 244766)
--- trunk/LayoutTests/platform/gtk/TestExpectations 2019-04-30 09:04:15 UTC (rev 244765)
+++ trunk/LayoutTests/platform/gtk/TestExpectations 2019-04-30 09:06:23 UTC (rev 244766)
@@ -754,9 +754,6 @@
# ENABLE(CSS_PAINTING_API) is disabled.
webkit.org/b/190710 fast/css-custom-paint [ Skip ]
-# ENABLE(DARK_MODE_CSS) is disabled.
-css-dark-mode [ Skip ]
-
# ENABLE(WEBVTT_REGIONS) is disabled
webkit.org/b/109570 media/track/regions-webvtt [ Skip ]
webkit.org/b/109570 media/track/w3c [ Skip ]
@@ -3937,6 +3934,9 @@
webkit.org/b/191506 fast/css-grid-layout/grid-item-scroll-position.html [ Pass ]
+css-dark-mode [ Pass ]
+css-dark-mode/older-systems [ Skip ]
+
#////////////////////////////////////////////////////////////////////////////////////////
# End of PASSING tests. See top of file where to put new expectations.
#////////////////////////////////////////////////////////////////////////////////////////
Added: trunk/LayoutTests/platform/gtk/css-dark-mode/color-scheme-css-expected.txt (0 => 244766)
--- trunk/LayoutTests/platform/gtk/css-dark-mode/color-scheme-css-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/gtk/css-dark-mode/color-scheme-css-expected.txt 2019-04-30 09:06:23 UTC (rev 244766)
@@ -0,0 +1,28 @@
+
+PASS Element colors are correct in light color scheme with only light supported color scheme
+PASS Dark color scheme enabled
+FAIL Element colors are correct in dark color scheme with only light supported color scheme assert_equals: expected "rgb(0, 0, 0)" but got "rgb(255, 255, 255)"
+PASS Light color scheme enabled
+PASS Color schemes changed to light and dark
+PASS Element colors are correct in light color scheme with light and dark supported color scheme
+PASS Dark color scheme enabled
+PASS Element colors are correct in dark color scheme with light and dark supported color scheme
+PASS Light color scheme enabled
+PASS Color schemes changed to dark
+FAIL Element colors are correct in light color scheme with only dark supported color scheme assert_equals: expected "rgb(255, 255, 255)" but got "rgb(0, 0, 0)"
+PASS Dark color scheme enabled
+PASS Element colors are correct in dark color scheme with only dark supported color scheme
+PASS Color schemes changed to light and a bogus value
+FAIL Element colors are correct in dark color scheme with only light supported color scheme assert_equals: expected "rgb(0, 0, 0)" but got "rgb(255, 255, 255)"
+PASS Color schemes changed to auto value
+FAIL Element colors are correct in dark color scheme with implicit light supported color scheme assert_equals: expected "rgb(0, 0, 0)" but got "rgb(255, 255, 255)"
+PASS Color schemes changed to light and dark via <meta> element
+PASS Element colors are correct in dark color scheme with light and dark supported color scheme via <meta> element
+PASS Color schemes changed to light value
+FAIL Element colors are correct in dark color scheme with explicit light, overriding <meta> element assert_equals: expected "rgb(0, 0, 0)" but got "rgb(255, 255, 255)"
+PASS Remove test meta element
+PASS Color schemes changed to light and dark
+PASS Element colors are correct in dark color scheme with light and dark supported color scheme
+PASS Color schemes changed to a bogus value and dark
+PASS Element colors are correct in dark color scheme with dark supported color scheme
+
Added: trunk/LayoutTests/platform/gtk/css-dark-mode/color-scheme-meta-expected.txt (0 => 244766)
--- trunk/LayoutTests/platform/gtk/css-dark-mode/color-scheme-meta-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/gtk/css-dark-mode/color-scheme-meta-expected.txt 2019-04-30 09:06:23 UTC (rev 244766)
@@ -0,0 +1,25 @@
+
+PASS Element colors are correct in light color scheme with only light color scheme
+PASS Dark color scheme enabled
+FAIL Element colors are correct in dark color scheme with only light color scheme assert_equals: expected "rgb(0, 0, 0)" but got "rgb(255, 255, 255)"
+PASS Light color scheme enabled
+PASS Color schemes changed to light and dark
+PASS Element colors are correct in light color scheme with light and dark color scheme
+PASS Dark color scheme enabled
+PASS Element colors are correct in dark color scheme with light and dark color scheme
+PASS Light color scheme enabled
+PASS Color schemes changed to dark
+FAIL Element colors are correct in light color scheme with only dark color scheme assert_equals: expected "rgb(255, 255, 255)" but got "rgb(0, 0, 0)"
+PASS Dark color scheme enabled
+PASS Element colors are correct in dark color scheme with only dark color scheme
+PASS Color schemes changed to light and a bogus value
+FAIL Element colors are correct in dark color scheme with only light color scheme assert_equals: expected "rgb(0, 0, 0)" but got "rgb(255, 255, 255)"
+PASS Color schemes changed to empty value
+FAIL Element colors are correct in dark color scheme with implicit light color scheme assert_equals: expected "rgb(0, 0, 0)" but got "rgb(255, 255, 255)"
+PASS Color schemes changed to light,dark
+FAIL Element colors are in light color scheme since comma is not an allowed seperator assert_equals: expected "rgb(0, 0, 0)" but got "rgb(255, 255, 255)"
+PASS Color schemes changed to foo\vdark
+FAIL Element colors are in light color scheme since vertical tab is not an allowed seperator assert_equals: expected "rgb(0, 0, 0)" but got "rgb(255, 255, 255)"
+PASS Color schemes changed to a bogus value and dark
+PASS Element colors are correct in dark color scheme with dark color scheme
+
Added: trunk/LayoutTests/platform/gtk/css-dark-mode/default-colors-expected.txt (0 => 244766)
--- trunk/LayoutTests/platform/gtk/css-dark-mode/default-colors-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/gtk/css-dark-mode/default-colors-expected.txt 2019-04-30 09:06:23 UTC (rev 244766)
@@ -0,0 +1,10 @@
+
+PASS Body text color is black, since the page isn't in dark mode
+FAIL View base background color is white, since the page isn't in dark mode assert_equals: expected "rgb(255, 255, 255)" but got "rgb(246, 245, 244)"
+PASS Set dark appearance
+FAIL Body text color is black, since the page hasn't set a supported color scheme assert_equals: expected "rgb(0, 0, 0)" but got "rgb(255, 255, 255)"
+FAIL View base background color is white, since the page hasn't set a supported color scheme assert_equals: expected "rgb(255, 255, 255)" but got "rgb(246, 245, 244)"
+PASS Set prefers-color-schemes: light dark on the body
+PASS Body text color is white
+FAIL View base background color is a dark grey assert_equals: expected "rgb(30, 30, 30)" but got "rgb(53, 53, 53)"
+
Added: trunk/LayoutTests/platform/gtk/css-dark-mode/older-syntax/supported-color-schemes-css-expected.txt (0 => 244766)
--- trunk/LayoutTests/platform/gtk/css-dark-mode/older-syntax/supported-color-schemes-css-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/gtk/css-dark-mode/older-syntax/supported-color-schemes-css-expected.txt 2019-04-30 09:06:23 UTC (rev 244766)
@@ -0,0 +1,28 @@
+
+PASS Element colors are correct in light color scheme with only light supported color scheme
+PASS Dark color scheme enabled
+FAIL Element colors are correct in dark color scheme with only light supported color scheme assert_equals: expected "rgb(0, 0, 0)" but got "rgb(255, 255, 255)"
+PASS Light color scheme enabled
+PASS Supported color schemes changed to light and dark
+PASS Element colors are correct in light color scheme with light and dark supported color scheme
+PASS Dark color scheme enabled
+PASS Element colors are correct in dark color scheme with light and dark supported color scheme
+PASS Light color scheme enabled
+PASS Supported color schemes changed to dark
+FAIL Element colors are correct in light color scheme with only dark supported color scheme assert_equals: expected "rgb(255, 255, 255)" but got "rgb(0, 0, 0)"
+PASS Dark color scheme enabled
+PASS Element colors are correct in dark color scheme with only dark supported color scheme
+PASS Supported color schemes changed to light and a bogus value
+FAIL Element colors are correct in dark color scheme with only light supported color scheme assert_equals: expected "rgb(0, 0, 0)" but got "rgb(255, 255, 255)"
+PASS Supported color schemes changed to auto value
+FAIL Element colors are correct in dark color scheme with implicit light supported color scheme assert_equals: expected "rgb(0, 0, 0)" but got "rgb(255, 255, 255)"
+PASS Supported color schemes changed to light and dark via <meta> element
+PASS Element colors are correct in dark color scheme with light and dark supported color scheme via <meta> element
+PASS Supported color schemes changed to light value
+FAIL Element colors are correct in dark color scheme with explicit light, overriding <meta> element assert_equals: expected "rgb(0, 0, 0)" but got "rgb(255, 255, 255)"
+PASS Remove test meta element
+PASS Supported color schemes changed to light and dark
+PASS Element colors are correct in dark color scheme with light and dark supported color scheme
+PASS Supported color schemes changed to a bogus value and dark
+PASS Element colors are correct in dark color scheme with dark supported color scheme
+
Added: trunk/LayoutTests/platform/gtk/css-dark-mode/older-syntax/supported-color-schemes-meta-expected.txt (0 => 244766)
--- trunk/LayoutTests/platform/gtk/css-dark-mode/older-syntax/supported-color-schemes-meta-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/gtk/css-dark-mode/older-syntax/supported-color-schemes-meta-expected.txt 2019-04-30 09:06:23 UTC (rev 244766)
@@ -0,0 +1,23 @@
+
+PASS Element colors are correct in light color scheme with only light color scheme
+PASS Dark color scheme enabled
+FAIL Element colors are correct in dark color scheme with only light color scheme assert_equals: expected "rgb(0, 0, 0)" but got "rgb(255, 255, 255)"
+PASS Light color scheme enabled
+PASS Supported color schemes changed to light and dark
+PASS Element colors are correct in light color scheme with light and dark color scheme
+PASS Dark color scheme enabled
+PASS Element colors are correct in dark color scheme with light and dark color scheme
+PASS Light color scheme enabled
+PASS Supported color schemes changed to dark
+FAIL Element colors are correct in light color scheme with only dark color scheme assert_equals: expected "rgb(255, 255, 255)" but got "rgb(0, 0, 0)"
+PASS Dark color scheme enabled
+PASS Element colors are correct in dark color scheme with only dark color scheme
+PASS Supported color schemes changed to light and a bogus value
+FAIL Element colors are correct in dark color scheme with only light color scheme assert_equals: expected "rgb(0, 0, 0)" but got "rgb(255, 255, 255)"
+PASS Supported color schemes changed to empty value
+FAIL Element colors are correct in dark color scheme with implicit light color scheme assert_equals: expected "rgb(0, 0, 0)" but got "rgb(255, 255, 255)"
+PASS Supported color schemes changed to light,dark
+FAIL Element colors are in light color scheme since comma is not an allowed seperator assert_equals: expected "rgb(0, 0, 0)" but got "rgb(255, 255, 255)"
+PASS Supported color schemes changed to a bogus value and dark
+PASS Element colors are correct in dark color scheme with dark color scheme
+
Added: trunk/LayoutTests/platform/gtk/css-dark-mode/prefers-color-scheme-expected.txt (0 => 244766)
--- trunk/LayoutTests/platform/gtk/css-dark-mode/prefers-color-scheme-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/gtk/css-dark-mode/prefers-color-scheme-expected.txt 2019-04-30 09:06:23 UTC (rev 244766)
@@ -0,0 +1,7 @@
+
+PASS Element colors are correct in light color scheme
+PASS Element colors are correct in light color scheme with boolean context query
+PASS Dark color scheme enabled
+FAIL Element colors are correct in dark color scheme assert_equals: expected "rgb(0, 0, 0)" but got "rgb(255, 255, 255)"
+FAIL Element colors are correct in dark color scheme with boolean context query assert_equals: expected "rgb(0, 0, 0)" but got "rgb(255, 255, 255)"
+
Modified: trunk/Source/WebCore/ChangeLog (244765 => 244766)
--- trunk/Source/WebCore/ChangeLog 2019-04-30 09:04:15 UTC (rev 244765)
+++ trunk/Source/WebCore/ChangeLog 2019-04-30 09:06:23 UTC (rev 244766)
@@ -1,3 +1,19 @@
+2019-04-30 Carlos Garcia Campos <[email protected]>
+
+ [GTK] Support prefers-color-scheme media query
+ https://bugs.webkit.org/show_bug.cgi?id=196685
+
+ Reviewed by Michael Catanzaro.
+
+ Change the gtk-application-prefer-dark-theme setting when tests change the useDarkModeAppearance setting.
+
+ * PlatformGTK.cmake:
+ * testing/InternalSettings.cpp:
+ (WebCore::InternalSettings::resetToConsistentState):
+ (WebCore::InternalSettings::setUseDarkAppearanceInternal):
+ (WebCore::InternalSettings::setUseDarkAppearance):
+ * testing/InternalSettings.h:
+
2019-04-29 Truitt Savell <[email protected]>
Unreviewed, rolling out r244755.
Modified: trunk/Source/WebCore/PlatformGTK.cmake (244765 => 244766)
--- trunk/Source/WebCore/PlatformGTK.cmake 2019-04-30 09:04:15 UTC (rev 244765)
+++ trunk/Source/WebCore/PlatformGTK.cmake 2019-04-30 09:06:23 UTC (rev 244766)
@@ -215,6 +215,9 @@
${WebCore_SYSTEM_INCLUDE_DIRECTORIES}
)
+list(APPEND WebCoreTestSupport_LIBRARIES PRIVATE ${GTK_LIBRARIES})
+list(APPEND WebCoreTestSupport_INCLUDE_DIRECTORIES ${GTK_INCLUDE_DIRS})
+
add_definitions(-DBUILDING_WEBKIT)
if (ENABLE_SMOOTH_SCROLLING)
Modified: trunk/Source/WebCore/testing/InternalSettings.cpp (244765 => 244766)
--- trunk/Source/WebCore/testing/InternalSettings.cpp 2019-04-30 09:04:15 UTC (rev 244765)
+++ trunk/Source/WebCore/testing/InternalSettings.cpp 2019-04-30 09:06:23 UTC (rev 244766)
@@ -51,6 +51,10 @@
#include "SoupNetworkSession.h"
#endif
+#if PLATFORM(GTK)
+#include <gtk/gtk.h>
+#endif
+
namespace WebCore {
InternalSettings::Backup::Backup(Settings& settings)
@@ -276,7 +280,7 @@
m_page->setPageScaleFactor(1, { 0, 0 });
m_page->mainFrame().setPageAndTextZoomFactors(1, 1);
m_page->setCanStartMedia(true);
- m_page->setUseDarkAppearance(false);
+ setUseDarkAppearanceInternal(false);
settings().setForcePendingWebGLPolicy(false);
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
@@ -529,11 +533,27 @@
#endif
}
+void InternalSettings::setUseDarkAppearanceInternal(bool useDarkAppearance)
+{
+#if PLATFORM(GTK)
+ // GTK doesn't allow to change the theme from the web process, but tests need to do it, so
+ // we do it here only for tests.
+ if (auto* settings = gtk_settings_get_default()) {
+ gboolean preferDarkTheme;
+ g_object_get(settings, "gtk-application-prefer-dark-theme", &preferDarkTheme, nullptr);
+ if (preferDarkTheme != useDarkAppearance)
+ g_object_set(settings, "gtk-application-prefer-dark-theme", useDarkAppearance, nullptr);
+ }
+#endif
+ ASSERT(m_page);
+ m_page->setUseDarkAppearance(useDarkAppearance);
+}
+
ExceptionOr<void> InternalSettings::setUseDarkAppearance(bool useDarkAppearance)
{
if (!m_page)
return Exception { InvalidAccessError };
- m_page->setUseDarkAppearance(useDarkAppearance);
+ setUseDarkAppearanceInternal(useDarkAppearance);
return { };
}
Modified: trunk/Source/WebCore/testing/InternalSettings.h (244765 => 244766)
--- trunk/Source/WebCore/testing/InternalSettings.h 2019-04-30 09:04:15 UTC (rev 244765)
+++ trunk/Source/WebCore/testing/InternalSettings.h 2019-04-30 09:06:23 UTC (rev 244766)
@@ -137,6 +137,8 @@
Settings& settings() const;
static const char* supplementName();
+ void setUseDarkAppearanceInternal(bool);
+
class Backup {
public:
explicit Backup(Settings&);
Modified: trunk/Source/cmake/OptionsGTK.cmake (244765 => 244766)
--- trunk/Source/cmake/OptionsGTK.cmake 2019-04-30 09:04:15 UTC (rev 244765)
+++ trunk/Source/cmake/OptionsGTK.cmake 2019-04-30 09:06:23 UTC (rev 244766)
@@ -150,6 +150,7 @@
# we need a value different from the default defined in WebKitFeatures.cmake.
# Changing these options is completely unsupported.
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CONTENT_EXTENSIONS PRIVATE ON)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DARK_MODE_CSS PRIVATE ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DOWNLOAD_ATTRIBUTE PRIVATE ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ENCRYPTED_MEDIA PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_FTPDIR PRIVATE OFF)