Title: [199659] trunk
Revision
199659
Author
carlo...@webkit.org
Date
2016-04-18 01:44:55 -0700 (Mon, 18 Apr 2016)

Log 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):

Modified Paths

Diff

Modified: trunk/ChangeLog (199658 => 199659)


--- trunk/ChangeLog	2016-04-18 08:31:11 UTC (rev 199658)
+++ trunk/ChangeLog	2016-04-18 08:44:55 UTC (rev 199659)
@@ -1,3 +1,12 @@
+2016-04-18  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [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.
+
 2016-04-13  Konstantin Tokarev  <annu...@yandex.ru>
 
         FindWebP should not be misguided by pkg-config when cross-compiling.

Modified: trunk/ManualTests/gtk/theme.html (199658 => 199659)


--- trunk/ManualTests/gtk/theme.html	2016-04-18 08:31:11 UTC (rev 199658)
+++ trunk/ManualTests/gtk/theme.html	2016-04-18 08:44:55 UTC (rev 199659)
@@ -37,6 +37,7 @@
     <tr>
       <td><select><option>A</option><option selected>B</option><option>C</option></td>
       <td><select><option>Combo option 1</option><option>Combo option 2</option><option>Combo option 3</option></td>
+      <td><select disabled><option>Disabled option 1</option><option>Disabled option 2</option><option>Disabled option 3</option></td>
     </tr>
   </table>
 

Modified: trunk/Source/WebCore/ChangeLog (199658 => 199659)


--- trunk/Source/WebCore/ChangeLog	2016-04-18 08:31:11 UTC (rev 199658)
+++ trunk/Source/WebCore/ChangeLog	2016-04-18 08:44:55 UTC (rev 199659)
@@ -1,3 +1,16 @@
+2016-04-18  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [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.
+
+        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):
+
 2016-04-18  Manuel Rego Casasnovas  <r...@igalia.com>
 
         [css-grid] Fix positioned items with content alignment

Modified: trunk/Source/WebCore/rendering/RenderThemeGtk.cpp (199658 => 199659)


--- trunk/Source/WebCore/rendering/RenderThemeGtk.cpp	2016-04-18 08:31:11 UTC (rev 199658)
+++ trunk/Source/WebCore/rendering/RenderThemeGtk.cpp	2016-04-18 08:44:55 UTC (rev 199659)
@@ -773,13 +773,37 @@
 }
 #endif // GTK_CHECK_VERSION(3, 20, 0)
 
-void RenderThemeGtk::adjustMenuListStyle(StyleResolver&, RenderStyle& style, const Element*) const
+static Color menuListColor(const Element* element)
 {
+#if GTK_CHECK_VERSION(3, 20, 0)
+    RenderThemeGadget::Info info { RenderThemeGadget::Type::Generic, "combobox", element->isDisabledFormControl() ? GTK_STATE_FLAG_INSENSITIVE : GTK_STATE_FLAG_NORMAL, { } };
+    auto comboGadget = RenderThemeGadget::create(info);
+    Vector<RenderThemeGadget::Info> children {
+        { RenderThemeGadget::Type::Generic, "button", info.state, { "combo" } }
+    };
+    info.name = "box";
+    info.classList = { "horizontal", "linked" };
+    return RenderThemeBoxGadget(info, children, comboGadget.get()).child(0)->color();
+#else
+    GRefPtr<GtkStyleContext> parentStyleContext = createStyleContext(ComboBox);
+    GRefPtr<GtkStyleContext> buttonStyleContext = createStyleContext(ComboBoxButton, parentStyleContext.get());
+    gtk_style_context_set_state(buttonStyleContext.get(), element->isDisabledFormControl() ? GTK_STATE_FLAG_INSENSITIVE : GTK_STATE_FLAG_NORMAL);
+
+    GdkRGBA gdkRGBAColor;
+    gtk_style_context_get_color(buttonStyleContext.get(), gtk_style_context_get_state(buttonStyleContext.get()), &gdkRGBAColor);
+    return gdkRGBAColor;
+#endif // GTK_CHECK_VERSION(3, 20, 0)
+}
+
+void RenderThemeGtk::adjustMenuListStyle(StyleResolver&, RenderStyle& style, const Element* element) const
+{
     // The tests check explicitly that select menu buttons ignore line height.
     style.setLineHeight(RenderStyle::initialLineHeight());
 
     // We cannot give a proper rendering when border radius is active, unfortunately.
     style.resetBorderRadius();
+
+    style.setColor(menuListColor(element));
 }
 
 void RenderThemeGtk::adjustMenuListButtonStyle(StyleResolver& styleResolver, RenderStyle& style, const Element* e) const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to