summaryrefslogtreecommitdiffstats
path: root/widget
diff options
context:
space:
mode:
authortrav90 <travawine@protonmail.ch>2018-04-06 11:02:43 -0500
committertrav90 <travawine@protonmail.ch>2018-04-06 11:02:43 -0500
commit5ddda9321c7d5b2971f0fb20711c8160a763511e (patch)
tree08b4ed017f86830ef86465b6e00f8056f6215d5e /widget
parent484a5de81ddd0b395a08c9a42b71389e0b3ea3fc (diff)
downloadUXP-5ddda9321c7d5b2971f0fb20711c8160a763511e.tar
UXP-5ddda9321c7d5b2971f0fb20711c8160a763511e.tar.gz
UXP-5ddda9321c7d5b2971f0fb20711c8160a763511e.tar.lz
UXP-5ddda9321c7d5b2971f0fb20711c8160a763511e.tar.xz
UXP-5ddda9321c7d5b2971f0fb20711c8160a763511e.zip
[GTK3] Invalidate widget style contexts after their ancestors are set
Although this is only known to affect buttons with builtin child widgets, it is difficult to audit all GTK widgets for similar situations, and so the same defense is applied to all widgets.
Diffstat (limited to 'widget')
-rw-r--r--widget/gtk/WidgetStyleCache.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/widget/gtk/WidgetStyleCache.cpp b/widget/gtk/WidgetStyleCache.cpp
index c25b426bd..7e5488b49 100644
--- a/widget/gtk/WidgetStyleCache.cpp
+++ b/widget/gtk/WidgetStyleCache.cpp
@@ -626,6 +626,20 @@ GetWidget(WidgetNodeType aWidgetType)
GtkWidget* widget = sWidgetStorage[aWidgetType];
if (!widget) {
widget = CreateWidget(aWidgetType);
+ // In GTK versions prior to 3.18, automatic invalidation of style contexts
+ // for widgets was delayed until the next resize event. Gecko however,
+ // typically uses the style context before the resize event runs and so an
+ // explicit invalidation may be required. This is necessary if a style
+ // property was retrieved before all changes were made to the style
+ // context. One such situation is where gtk_button_construct_child()
+ // retrieves the style property "image-spacing" during construction of the
+ // GtkButton, before its parent is set to provide inheritance of ancestor
+ // properties. More recent GTK versions do not need this, but do not
+ // re-resolve until required and so invalidation does not trigger
+ // unnecessary resolution in general.
+ GtkStyleContext* style = gtk_widget_get_style_context(widget);
+ gtk_style_context_invalidate(style);
+
sWidgetStorage[aWidgetType] = widget;
}
return widget;