Changeset 244766 in webkit


Ignore:
Timestamp:
Apr 30, 2019, 2:06:23 AM (7 years ago)
Author:
Carlos Garcia Campos
Message:

[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:

Source/WebCore:

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:

LayoutTests:

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.
Location:
trunk
Files:
8 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r244746 r244766  
     12019-04-30  Carlos Garcia Campos  <[email protected]>
     2
     3        [GTK] Support prefers-color-scheme media query
     4        https://bugs.webkit.org/show_bug.cgi?id=196685
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Enable DARK_MODE_CSS. Supported color schemes feature is not supported for now. I'm not sure we will be able to
     9        suport it, because it requires to change the theme too many times, which is very slow in GTK.
     10
     11        * Source/cmake/OptionsGTK.cmake:
     12
    1132019-04-29  Don Olmstead  <[email protected]>
    214
  • trunk/LayoutTests/ChangeLog

    r244765 r244766  
     12019-04-30  Carlos Garcia Campos  <[email protected]>
     2
     3        [GTK] Support prefers-color-scheme media query
     4        https://bugs.webkit.org/show_bug.cgi?id=196685
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Unskip css-dark-mode tests and add platform specific results for some of the tests using the supported color
     9        scheme feature.
     10
     11        * platform/gtk/TestExpectations:
     12        * platform/gtk/css-dark-mode/color-scheme-css-expected.txt: Added.
     13        * platform/gtk/css-dark-mode/color-scheme-meta-expected.txt: Added.
     14        * platform/gtk/css-dark-mode/default-colors-expected.txt: Added.
     15        * platform/gtk/css-dark-mode/older-syntax/supported-color-schemes-css-expected.txt: Added.
     16        * platform/gtk/css-dark-mode/older-syntax/supported-color-schemes-meta-expected.txt: Added.
     17        * platform/gtk/css-dark-mode/prefers-color-scheme-expected.txt: Added.
     18
    1192019-04-30  Carlos Garcia Campos  <[email protected]>
    220
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r244748 r244766  
    755755webkit.org/b/190710 fast/css-custom-paint [ Skip ]
    756756
    757 # ENABLE(DARK_MODE_CSS) is disabled.
    758 css-dark-mode [ Skip ]
    759 
    760757# ENABLE(WEBVTT_REGIONS) is disabled
    761758webkit.org/b/109570 media/track/regions-webvtt [ Skip ]
     
    39383935webkit.org/b/191506 fast/css-grid-layout/grid-item-scroll-position.html [ Pass ]
    39393936
     3937css-dark-mode [ Pass ]
     3938css-dark-mode/older-systems [ Skip ]
     3939
    39403940#////////////////////////////////////////////////////////////////////////////////////////
    39413941# End of PASSING tests. See top of file where to put new expectations.
  • trunk/Source/WebCore/ChangeLog

    r244762 r244766  
     12019-04-30  Carlos Garcia Campos  <[email protected]>
     2
     3        [GTK] Support prefers-color-scheme media query
     4        https://bugs.webkit.org/show_bug.cgi?id=196685
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Change the gtk-application-prefer-dark-theme setting when tests change the useDarkModeAppearance setting.
     9
     10        * PlatformGTK.cmake:
     11        * testing/InternalSettings.cpp:
     12        (WebCore::InternalSettings::resetToConsistentState):
     13        (WebCore::InternalSettings::setUseDarkAppearanceInternal):
     14        (WebCore::InternalSettings::setUseDarkAppearance):
     15        * testing/InternalSettings.h:
     16
    1172019-04-29  Truitt Savell  <[email protected]>
    218
  • trunk/Source/WebCore/PlatformGTK.cmake

    r244443 r244766  
    216216)
    217217
     218list(APPEND WebCoreTestSupport_LIBRARIES PRIVATE ${GTK_LIBRARIES})
     219list(APPEND WebCoreTestSupport_INCLUDE_DIRECTORIES ${GTK_INCLUDE_DIRS})
     220
    218221add_definitions(-DBUILDING_WEBKIT)
    219222
  • trunk/Source/WebCore/testing/InternalSettings.cpp

    r244682 r244766  
    5252#endif
    5353
     54#if PLATFORM(GTK)
     55#include <gtk/gtk.h>
     56#endif
     57
    5458namespace WebCore {
    5559
     
    277281    m_page->mainFrame().setPageAndTextZoomFactors(1, 1);
    278282    m_page->setCanStartMedia(true);
    279     m_page->setUseDarkAppearance(false);
     283    setUseDarkAppearanceInternal(false);
    280284
    281285    settings().setForcePendingWebGLPolicy(false);
     
    530534}
    531535
     536void InternalSettings::setUseDarkAppearanceInternal(bool useDarkAppearance)
     537{
     538#if PLATFORM(GTK)
     539    // GTK doesn't allow to change the theme from the web process, but tests need to do it, so
     540    // we do it here only for tests.
     541    if (auto* settings = gtk_settings_get_default()) {
     542        gboolean preferDarkTheme;
     543        g_object_get(settings, "gtk-application-prefer-dark-theme", &preferDarkTheme, nullptr);
     544        if (preferDarkTheme != useDarkAppearance)
     545            g_object_set(settings, "gtk-application-prefer-dark-theme", useDarkAppearance, nullptr);
     546    }
     547#endif
     548    ASSERT(m_page);
     549    m_page->setUseDarkAppearance(useDarkAppearance);
     550}
     551
    532552ExceptionOr<void> InternalSettings::setUseDarkAppearance(bool useDarkAppearance)
    533553{
    534554    if (!m_page)
    535555        return Exception { InvalidAccessError };
    536     m_page->setUseDarkAppearance(useDarkAppearance);
     556    setUseDarkAppearanceInternal(useDarkAppearance);
    537557    return { };
    538558}
  • trunk/Source/WebCore/testing/InternalSettings.h

    r244682 r244766  
    138138    static const char* supplementName();
    139139
     140    void setUseDarkAppearanceInternal(bool);
     141
    140142    class Backup {
    141143    public:
  • trunk/Source/cmake/OptionsGTK.cmake

    r244635 r244766  
    151151# Changing these options is completely unsupported.
    152152WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CONTENT_EXTENSIONS PRIVATE ON)
     153WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DARK_MODE_CSS PRIVATE ON)
    153154WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DOWNLOAD_ATTRIBUTE PRIVATE ON)
    154155WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_ENCRYPTED_MEDIA PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
Note: See TracChangeset for help on using the changeset viewer.