bug 1365556 invalidate widget style contexts after their ancestors are set r=stransky+263117

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.

MozReview-Commit-ID: LMVXX3UYqR9

--HG--
extra : rebase_source : d327addad8d2b0e070c6ca86c6e38271c8431a23
This commit is contained in:
Karl Tomlinson 2017-08-01 09:17:46 +12:00
Родитель b2d75fa057
Коммит 7f6c7692a4
1 изменённых файлов: 14 добавлений и 0 удалений

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

@ -622,6 +622,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;