aboutsummaryrefslogtreecommitdiff
path: root/deb_patches/silence-gtk-style-assertions.patch
blob: 36ec8e3ae52e2899f293063ba6dfc8c48b6c35cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
Description: silence GTK style-related assertions caused by the lack of a "selection" CSS node on GtkTextView in the version of gtk3 in xenial.
 These assertions were caused by the fix for https://bugzilla.mozilla.org/1654323.
Author: Olivier Tilloy <olivier.tilloy@canonical.com>

--- a/widget/gtk/nsLookAndFeel.cpp
+++ b/widget/gtk/nsLookAndFeel.cpp
@@ -1216,7 +1216,7 @@ void nsLookAndFeel::EnsureInit() {
           &color);
       mTextSelectedText = GDK_RGBA_TO_NS_RGBA(color);
     };
-    GrabSelectionColors(selectionStyle);
+    GrabSelectionColors(selectionStyle ? selectionStyle : style);
     if (mTextSelectedBackground == mTextSelectedText) {
       // Some old distros/themes don't properly use the .selection style, so
       // fall back to the regular text view style.
@@ -1413,6 +1413,7 @@ bool nsLookAndFeel::WidgetUsesImage(Widg
       GTK_STATE_FLAG_BACKDROP, GTK_STATE_FLAG_INSENSITIVE};
 
   GtkStyleContext* style = GetStyleContext(aNodeType);
+  if (!style) return false;
 
   GValue value = G_VALUE_INIT;
   for (GtkStateFlags state : sFlagsToCheck) {
--- a/widget/gtk/WidgetStyleCache.cpp
+++ b/widget/gtk/WidgetStyleCache.cpp
@@ -933,7 +933,7 @@ static GtkStyleContext* GetWidgetRootSty
     default:
       GtkWidget* widget = GetWidget(aNodeType);
       MOZ_ASSERT(widget);
-      return gtk_widget_get_style_context(widget);
+      return (widget ? gtk_widget_get_style_context(widget) : nullptr);
   }
 
   MOZ_ASSERT(style);
@@ -1356,6 +1356,7 @@ GtkStyleContext* GetStyleContext(WidgetN
     style = GetCssNodeStyleInternal(aNodeType);
     StyleContextSetScale(style, aScale);
   }
+  if (!style) return nullptr;
   bool stateChanged = false;
   bool stateHasDirection = gtk_get_minor_version() >= 8;
   GtkStateFlags oldState = gtk_style_context_get_state(style);
bgstack15