Changeset 232392 in webkit


Ignore:
Timestamp:
Jun 1, 2018 6:02:39 AM (6 years ago)
Author:
commit-queue@webkit.org
Message:

[GTK] Difficult to read combo box text in dark theme
https://bugs.webkit.org/show_bug.cgi?id=165072

Patch by Carlos Eduardo Ramalho <cadubentzen@gmail.com> on 2018-06-01
Reviewed by Carlos Garcia Campos.

Set listbox foreground color to theme color to fix hard-to-read
text color in combo box while using dark theme.

No new tests required. ManualTests/gtk/theme.html already covers it.
See the "Option Lists" section.

  • rendering/RenderTheme.cpp:

(WebCore::RenderTheme::adjustStyle):
Adjust style for ListboxPart as well.

  • rendering/RenderTheme.h: Add adjustListboxStyle()
  • rendering/RenderThemeGtk.cpp:

(WebCore::RenderThemeGtk::adjustListboxStyle const):
Set color to the theme foreground color.

  • rendering/RenderThemeGtk.h: adjustListboxStyle() overriden.
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r232390 r232392  
     12018-06-01  Carlos Eduardo Ramalho  <cadubentzen@gmail.com>
     2
     3        [GTK] Difficult to read combo box text in dark theme
     4        https://bugs.webkit.org/show_bug.cgi?id=165072
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Set listbox foreground color to theme color to fix hard-to-read
     9        text color in combo box while using dark theme.
     10
     11        No new tests required. ManualTests/gtk/theme.html already covers it.
     12        See the "Option Lists" section.
     13
     14        * rendering/RenderTheme.cpp:
     15        (WebCore::RenderTheme::adjustStyle):
     16        Adjust style for ListboxPart as well.
     17        * rendering/RenderTheme.h: Add adjustListboxStyle()
     18        * rendering/RenderThemeGtk.cpp:
     19        (WebCore::RenderThemeGtk::adjustListboxStyle const):
     20        Set color to the theme foreground color.
     21        * rendering/RenderThemeGtk.h: adjustListboxStyle() overriden.
     22
    1232018-06-01  Carlos Garcia Campos  <cgarcia@igalia.com>
    224
  • trunk/Source/WebCore/rendering/RenderTheme.cpp

    r232306 r232392  
    214214    case MenulistButtonPart:
    215215        return adjustMenuListButtonStyle(styleResolver, style, element);
     216    case ListboxPart:
     217        return adjustListboxStyle(styleResolver, style, element);
    216218    case MediaPlayButtonPart:
    217219    case MediaCurrentTimePart:
  • trunk/Source/WebCore/rendering/RenderTheme.h

    r231557 r232392  
    305305    virtual void adjustMenuListButtonStyle(StyleResolver&, RenderStyle&, const Element*) const;
    306306    virtual bool paintMenuListButtonDecorations(const RenderBox&, const PaintInfo&, const FloatRect&) { return true; }
     307
     308    virtual void adjustListboxStyle(StyleResolver&, RenderStyle&, const Element*) const { };
    307309
    308310    virtual bool paintPushButtonDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
  • trunk/Source/WebCore/rendering/RenderThemeGtk.cpp

    r232338 r232392  
    11361136}
    11371137
     1138void RenderThemeGtk::adjustListboxStyle(StyleResolver&, RenderStyle& style, const Element* element) const
     1139{
     1140    if (element)
     1141        style.setColor(styleColor(ListBox, element->isDisabledFormControl() ? GTK_STATE_FLAG_INSENSITIVE : GTK_STATE_FLAG_NORMAL, StyleColorForeground));
     1142}
     1143
    11381144bool RenderThemeGtk::paintTextArea(const RenderObject& o, const PaintInfo& i, const FloatRect& r)
    11391145{
  • trunk/Source/WebCore/rendering/RenderThemeGtk.h

    r232338 r232392  
    134134    bool paintMenuListButtonDecorations(const RenderBox&, const PaintInfo&, const FloatRect&) override;
    135135
     136    void adjustListboxStyle(StyleResolver&, RenderStyle&, const Element*) const override;
     137
    136138    void adjustSearchFieldResultsDecorationPartStyle(StyleResolver&, RenderStyle&, const Element*) const override;
    137139    bool paintSearchFieldResultsDecorationPart(const RenderBox&, const PaintInfo&, const IntRect&) override;
Note: See TracChangeset for help on using the changeset viewer.