Bug 1613130 [Linux] Use GtkWindow as a fallback if a particular GtkWidget is missing, r=jhorak

Differential Revision: https://phabricator.services.mozilla.com/D61633

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Martin Stransky 2020-02-05 15:29:23 +00:00
Родитель 0c932bb6d4
Коммит 7e1d1d675d
1 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -25,6 +25,7 @@ static GtkStyleContext* GetCssNodeStyleInternal(WidgetNodeType aNodeType);
static GtkWidget* CreateWindowWidget() { static GtkWidget* CreateWindowWidget() {
GtkWidget* widget = gtk_window_new(GTK_WINDOW_POPUP); GtkWidget* widget = gtk_window_new(GTK_WINDOW_POPUP);
MOZ_RELEASE_ASSERT(widget, "We're missing GtkWindow widget!");
gtk_widget_set_name(widget, "MozillaGtkWidget"); gtk_widget_set_name(widget, "MozillaGtkWidget");
return widget; return widget;
} }
@ -757,8 +758,12 @@ GtkWidget* GetWidget(WidgetNodeType aAppearance) {
if (!widget) { if (!widget) {
widget = CreateWidget(aAppearance); widget = CreateWidget(aAppearance);
// Some widgets (MOZ_GTK_COMBOBOX_SEPARATOR for instance) may not be // Some widgets (MOZ_GTK_COMBOBOX_SEPARATOR for instance) may not be
// available or implemented. // available or implemented. Use GtkWindow as a fallback to avoid
if (!widget) return nullptr; // potential crashes.
if (!widget) {
NS_WARNING(nsPrintfCString("Missing GtkWidget %d\n", aAppearance).get());
widget = CreateWindowWidget();
}
// In GTK versions prior to 3.18, automatic invalidation of style contexts // In GTK versions prior to 3.18, automatic invalidation of style contexts
// for widgets was delayed until the next resize event. Gecko however, // for widgets was delayed until the next resize event. Gecko however,
// typically uses the style context before the resize event runs and so an // typically uses the style context before the resize event runs and so an