bug 1320860 adjust textarea style contexts for GTK 3.20 theming ABI changes r?stransky+263117 draft
authorKarl Tomlinson <karlt+@karlt.net>
Fri, 30 Dec 2016 13:44:55 +1300
changeset 455185 14d5661aab62ad112762cf841d04d4ac9571a24c
parent 455184 533194c7b0ea0fcbf94a18be503d4aee49b92577
child 540906 c61ee3e4b4dd84b60dd51265d59f44e723554e65
push id40148
push userktomlinson@mozilla.com
push dateTue, 03 Jan 2017 00:13:34 +0000
reviewersstransky
bugs1320860, 263117
milestone53.0a1
bug 1320860 adjust textarea style contexts for GTK 3.20 theming ABI changes r?stransky+263117 MozReview-Commit-ID: JTQO5bK5Yvv
widget/gtk/WidgetStyleCache.cpp
--- a/widget/gtk/WidgetStyleCache.cpp
+++ b/widget/gtk/WidgetStyleCache.cpp
@@ -868,29 +868,36 @@ GetCssNodeStyleInternal(WidgetNodeType a
       return GetWidgetStyleWithClass(MOZ_GTK_SPINBUTTON,
                                      GTK_STYLE_CLASS_ENTRY);
     case MOZ_GTK_SCROLLED_WINDOW:
       // TODO - create from CSS node
       return GetWidgetStyleWithClass(MOZ_GTK_SCROLLED_WINDOW,
                                      GTK_STYLE_CLASS_FRAME);
     case MOZ_GTK_TEXT_VIEW_TEXT:
     case MOZ_GTK_RESIZER:
-      // TODO - create from CSS node
-      style = GetWidgetStyleWithClass(MOZ_GTK_TEXT_VIEW, GTK_STYLE_CLASS_VIEW);
+      style = CreateChildCSSNode("text", MOZ_GTK_TEXT_VIEW);
       if (aNodeType == MOZ_GTK_RESIZER) {
         // The "grip" class provides the correct builtin icon from
         // gtk_render_handle().  The icon is drawn with shaded variants of
         // the background color, and so a transparent background would lead to
         // a transparent resizer.  gtk_render_handle() also uses the
         // background color to draw a background, and so this style otherwise
-        // matches MOZ_GTK_TEXT_VIEW_TEXT to match the background with
+        // matches what is used in GtkTextView to match the background with
         // textarea elements.
+        GdkRGBA color;
+        gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL,
+                                               &color);
+        if (color.alpha == 0.0) {
+          g_object_unref(style);
+          style = CreateStyleForWidget(gtk_text_view_new(),
+                                       MOZ_GTK_SCROLLED_WINDOW);
+        }
         gtk_style_context_add_class(style, GTK_STYLE_CLASS_GRIP);
       }
-      return style;
+      break;
     case MOZ_GTK_FRAME_BORDER:
       style = CreateChildCSSNode("border", MOZ_GTK_FRAME);
       break;
     case MOZ_GTK_TREEVIEW_VIEW:
       // TODO - create from CSS node
       return GetWidgetStyleWithClass(MOZ_GTK_TREEVIEW,
                                      GTK_STYLE_CLASS_VIEW);
     case MOZ_GTK_TREEVIEW_EXPANDER: