Changeset 244731 in webkit


Ignore:
Timestamp:
Apr 29, 2019 3:14:01 AM (5 years ago)
Author:
Carlos Garcia Campos
Message:

REGRESSION(r244635): [GTK] Wrong background color used in non-dark mode
https://bugs.webkit.org/show_bug.cgi?id=197276

Reviewed by Michael Catanzaro.

Since r244635, we are now getting the frame view background color from the theme. That's correct for dark mode,
but in non-dark mode we still want to use white backgrounds by default. This made a lot of tests to fail.

  • css/CSSValueKeywords.in: Add -webkit-control-background when HAVE(OS_DARK_MODE_SUPPORT).
  • css/html.css: Use -webkit-control-background instead of -apple-system-control-background.
  • page/FrameView.cpp:

(WebCore::FrameView::updateBackgroundRecursively): Use CSSValueWindow instead of CSSValueWindowframe.

  • rendering/RenderThemeGtk.cpp:

(WebCore::RenderThemeGtk::systemColor const): Only get the window background from the theme in dark mode. Handle
also CSSValueWebkitControlBackground.

  • rendering/RenderThemeMac.mm:

(WebCore::RenderThemeMac::systemColor const): Handle CSSValueWebkitControlBackground when HAVE(OS_DARK_MODE_SUPPORT).

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r244727 r244731  
     12019-04-25  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        REGRESSION(r244635): [GTK] Wrong background color used in non-dark mode
     4        https://bugs.webkit.org/show_bug.cgi?id=197276
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Since r244635, we are now getting the frame view background color from the theme. That's correct for dark mode,
     9        but in non-dark mode we still want to use white backgrounds by default. This made a lot of tests to fail.
     10
     11        * css/CSSValueKeywords.in: Add -webkit-control-background when HAVE(OS_DARK_MODE_SUPPORT).
     12        * css/html.css: Use -webkit-control-background instead of -apple-system-control-background.
     13        * page/FrameView.cpp:
     14        (WebCore::FrameView::updateBackgroundRecursively): Use CSSValueWindow instead of CSSValueWindowframe.
     15        * rendering/RenderThemeGtk.cpp:
     16        (WebCore::RenderThemeGtk::systemColor const): Only get the window background from the theme in dark mode. Handle
     17        also CSSValueWebkitControlBackground.
     18        * rendering/RenderThemeMac.mm:
     19        (WebCore::RenderThemeMac::systemColor const): Handle CSSValueWebkitControlBackground when HAVE(OS_DARK_MODE_SUPPORT).
     20
    1212019-04-28  Andy Estes  <aestes@apple.com>
    222
  • trunk/Source/WebCore/css/CSSValueKeywords.in

    r244408 r244731  
    268268-apple-system-indigo
    269269-apple-system-teal
     270#endif
     271#if defined(HAVE_OS_DARK_MODE_SUPPORT) && HAVE_OS_DARK_MODE_SUPPORT
     272-webkit-control-background
    270273#endif
    271274-webkit-focus-ring-color
  • trunk/Source/WebCore/css/html.css

    r243859 r244731  
    390390#if defined(HAVE_OS_DARK_MODE_SUPPORT) && HAVE_OS_DARK_MODE_SUPPORT
    391391    color: text;
    392     background-color: -apple-system-control-background;
     392    background-color: -webkit-control-background;
    393393#else
    394394    background-color: white;
     
    668668#if defined(HAVE_OS_DARK_MODE_SUPPORT) && HAVE_OS_DARK_MODE_SUPPORT
    669669    color: text;
    670     background-color: -apple-system-control-background;
     670    background-color: -webkit-control-background;
    671671#else
    672672    background-color: white;
     
    955955#if defined(HAVE_OS_DARK_MODE_SUPPORT) && HAVE_OS_DARK_MODE_SUPPORT
    956956    color: text;
    957     background-color: -apple-system-control-background;
     957    background-color: -webkit-control-background;
    958958#else
    959959    color: black;
  • trunk/Source/WebCore/page/FrameView.cpp

    r244635 r244731  
    30053005    static const auto cssValueControlBackground = CSSValueAppleSystemControlBackground;
    30063006#else
    3007     static const auto cssValueControlBackground = CSSValueWindowframe;
     3007    static const auto cssValueControlBackground = CSSValueWindow;
    30083008#endif
    30093009    Color baseBackgroundColor = backgroundColor.valueOr(RenderTheme::singleton().systemColor(cssValueControlBackground, styleColorOptions()));
  • trunk/Source/WebCore/rendering/RenderThemeGtk.cpp

    r244635 r244731  
    17811781    case CSSValueGraytext:
    17821782        return styleColor(Entry, GTK_STATE_FLAG_INSENSITIVE, StyleColorForeground);
     1783    case CSSValueWebkitControlBackground:
     1784        return styleColor(Entry, GTK_STATE_FLAG_ACTIVE, StyleColorBackground);
    17831785#if GTK_CHECK_VERSION(3, 20, 0)
    1784     case CSSValueWindowframe:
    1785         return styleColor(Window, GTK_STATE_FLAG_ACTIVE, StyleColorBackground);
     1786    case CSSValueWindow: {
     1787        // Only get window color from the theme in dark mode.
     1788        gboolean preferDarkTheme = FALSE;
     1789        if (auto* settings = gtk_settings_get_default())
     1790            g_object_get(settings, "gtk-application-prefer-dark-theme", &preferDarkTheme, nullptr);
     1791        if (preferDarkTheme)
     1792            return styleColor(Window, GTK_STATE_FLAG_ACTIVE, StyleColorBackground);
     1793        break;
     1794    }
    17861795#endif
    17871796    default:
    1788         return RenderTheme::systemColor(cssValueId, options);
    1789     }
     1797        break;
     1798    }
     1799
     1800    return RenderTheme::systemColor(cssValueId, options);
    17901801}
    17911802
  • trunk/Source/WebCore/rendering/RenderThemeMac.mm

    r244554 r244731  
    716716                return @selector(textBackgroundColor);
    717717            case CSSValueAppleSystemControlBackground:
     718#if HAVE(OS_DARK_MODE_SUPPORT)
     719            case CSSValueWebkitControlBackground:
     720#endif
    718721                return @selector(controlBackgroundColor);
    719722            case CSSValueAppleSystemAlternateSelectedText:
Note: See TracChangeset for help on using the changeset viewer.