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 --- 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 }; 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);