Title: [200015] releases/WebKitGTK/webkit-2.12
Revision
200015
Author
[email protected]
Date
2016-04-25 08:30:00 -0700 (Mon, 25 Apr 2016)

Log Message

Merge r199659 - [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: releases/WebKitGTK/webkit-2.12/ChangeLog (200014 => 200015)


--- releases/WebKitGTK/webkit-2.12/ChangeLog	2016-04-25 15:23:48 UTC (rev 200014)
+++ releases/WebKitGTK/webkit-2.12/ChangeLog	2016-04-25 15:30:00 UTC (rev 200015)
@@ -1,3 +1,12 @@
+2016-04-18  Carlos Garcia Campos  <[email protected]>
+
+        [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-14  Carlos Garcia Campos  <[email protected]>
 
         Unreviewed. Update OptionsGTK.cmake and NEWS for 2.12.1 release.

Modified: releases/WebKitGTK/webkit-2.12/ManualTests/gtk/theme.html (200014 => 200015)


--- releases/WebKitGTK/webkit-2.12/ManualTests/gtk/theme.html	2016-04-25 15:23:48 UTC (rev 200014)
+++ releases/WebKitGTK/webkit-2.12/ManualTests/gtk/theme.html	2016-04-25 15:30:00 UTC (rev 200015)
@@ -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: releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog (200014 => 200015)


--- releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog	2016-04-25 15:23:48 UTC (rev 200014)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/ChangeLog	2016-04-25 15:30:00 UTC (rev 200015)
@@ -1,3 +1,16 @@
+2016-04-18  Carlos Garcia Campos  <[email protected]>
+
+        [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-15  Myles C. Maxfield  <[email protected]>
 
         ASSERT when loading github.com

Modified: releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderThemeGtk.cpp (200014 => 200015)


--- releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderThemeGtk.cpp	2016-04-25 15:23:48 UTC (rev 200014)
+++ releases/WebKitGTK/webkit-2.12/Source/WebCore/rendering/RenderThemeGtk.cpp	2016-04-25 15:30:00 UTC (rev 200015)
@@ -773,13 +773,37 @@
 }
 #endif // GTK_CHECK_VERSION(3, 20, 0)
 
-void RenderThemeGtk::adjustMenuListStyle(StyleResolver&, RenderStyle& style, 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, 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, Element* e) const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to