Changeset 199659 in webkit


Ignore:
Timestamp:
Apr 18, 2016 1:44:55 AM (8 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK] Menu list button doesn't use the text color from the theme
https://bugs.webkit.org/show_bug.cgi?id=118234

Reviewed by Darin Adler.

.:

  • ManualTests/gtk/theme.html: Add a disabled combo test.

Source/WebCore:

Set the combo box color accroding to the theme when adjusting the menu list style like Mac port does.

  • rendering/RenderThemeGtk.cpp:

(WebCore::menuListColor):
(WebCore::RenderThemeGtk::adjustMenuListStyle):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r199518 r199659  
     12016-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Menu list button doesn't use the text color from the theme
     4        https://bugs.webkit.org/show_bug.cgi?id=118234
     5
     6        Reviewed by Darin Adler.
     7
     8        * ManualTests/gtk/theme.html: Add a disabled combo test.
     9
    1102016-04-13  Konstantin Tokarev  <annulen@yandex.ru>
    211
  • trunk/ManualTests/gtk/theme.html

    r199292 r199659  
    3838      <td><select><option>A</option><option selected>B</option><option>C</option></td>
    3939      <td><select><option>Combo option 1</option><option>Combo option 2</option><option>Combo option 3</option></td>
     40      <td><select disabled><option>Disabled option 1</option><option>Disabled option 2</option><option>Disabled option 3</option></td>
    4041    </tr>
    4142  </table>
  • trunk/Source/WebCore/ChangeLog

    r199657 r199659  
     12016-04-18  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Menu list button doesn't use the text color from the theme
     4        https://bugs.webkit.org/show_bug.cgi?id=118234
     5
     6        Reviewed by Darin Adler.
     7
     8        Set the combo box color accroding to the theme when adjusting the menu list style like Mac port does.
     9
     10        * rendering/RenderThemeGtk.cpp:
     11        (WebCore::menuListColor):
     12        (WebCore::RenderThemeGtk::adjustMenuListStyle):
     13
    1142016-04-18  Manuel Rego Casasnovas  <rego@igalia.com>
    215
  • trunk/Source/WebCore/rendering/RenderThemeGtk.cpp

    r199640 r199659  
    774774#endif // GTK_CHECK_VERSION(3, 20, 0)
    775775
    776 void RenderThemeGtk::adjustMenuListStyle(StyleResolver&, RenderStyle& style, const Element*) const
     776static Color menuListColor(const Element* element)
     777{
     778#if GTK_CHECK_VERSION(3, 20, 0)
     779    RenderThemeGadget::Info info { RenderThemeGadget::Type::Generic, "combobox", element->isDisabledFormControl() ? GTK_STATE_FLAG_INSENSITIVE : GTK_STATE_FLAG_NORMAL, { } };
     780    auto comboGadget = RenderThemeGadget::create(info);
     781    Vector<RenderThemeGadget::Info> children {
     782        { RenderThemeGadget::Type::Generic, "button", info.state, { "combo" } }
     783    };
     784    info.name = "box";
     785    info.classList = { "horizontal", "linked" };
     786    return RenderThemeBoxGadget(info, children, comboGadget.get()).child(0)->color();
     787#else
     788    GRefPtr<GtkStyleContext> parentStyleContext = createStyleContext(ComboBox);
     789    GRefPtr<GtkStyleContext> buttonStyleContext = createStyleContext(ComboBoxButton, parentStyleContext.get());
     790    gtk_style_context_set_state(buttonStyleContext.get(), element->isDisabledFormControl() ? GTK_STATE_FLAG_INSENSITIVE : GTK_STATE_FLAG_NORMAL);
     791
     792    GdkRGBA gdkRGBAColor;
     793    gtk_style_context_get_color(buttonStyleContext.get(), gtk_style_context_get_state(buttonStyleContext.get()), &gdkRGBAColor);
     794    return gdkRGBAColor;
     795#endif // GTK_CHECK_VERSION(3, 20, 0)
     796}
     797
     798void RenderThemeGtk::adjustMenuListStyle(StyleResolver&, RenderStyle& style, const Element* element) const
    777799{
    778800    // The tests check explicitly that select menu buttons ignore line height.
     
    781803    // We cannot give a proper rendering when border radius is active, unfortunately.
    782804    style.resetBorderRadius();
     805
     806    style.setColor(menuListColor(element));
    783807}
    784808
Note: See TracChangeset for help on using the changeset viewer.