зеркало из https://github.com/mozilla/gecko-dev.git
bug 1280951 copy tooltip style context and cache that instead of widget r=stransky+263117
MozReview-Commit-ID: 6thXro9uYHn --HG-- extra : rebase_source : 9b43f563bb433753e18d0f98d1541fcdae828ba3
This commit is contained in:
Родитель
fb0436ba41
Коммит
4cd71ef94b
|
@ -144,8 +144,6 @@ CreateWidget(WidgetNodeType aWidgetType)
|
|||
return CreateMenuItemWidget(MOZ_GTK_MENUBAR);
|
||||
case MOZ_GTK_MENUITEM:
|
||||
return CreateMenuItemWidget(MOZ_GTK_MENUPOPUP);
|
||||
case MOZ_GTK_TOOLTIP:
|
||||
return CreateTooltipWidget();
|
||||
default:
|
||||
/* Not implemented */
|
||||
return nullptr;
|
||||
|
@ -166,8 +164,9 @@ GetWidget(WidgetNodeType aWidgetType)
|
|||
GtkStyleContext*
|
||||
CreateStyleForWidget(GtkWidget* aWidget, GtkStyleContext* aParentStyle)
|
||||
{
|
||||
GtkWidgetPath* path =
|
||||
gtk_widget_path_copy(gtk_style_context_get_path(aParentStyle));
|
||||
GtkWidgetPath* path = aParentStyle ?
|
||||
gtk_widget_path_copy(gtk_style_context_get_path(aParentStyle)) :
|
||||
gtk_widget_path_new();
|
||||
|
||||
// Work around https://bugzilla.gnome.org/show_bug.cgi?id=767312
|
||||
// which exists in GTK+ 3.20.
|
||||
|
@ -276,13 +275,9 @@ GetCssNodeStyleInternal(WidgetNodeType aNodeType)
|
|||
return gtk_widget_get_style_context(widget);
|
||||
}
|
||||
|
||||
if (style) {
|
||||
sStyleStorage[aNodeType] = style;
|
||||
return style;
|
||||
}
|
||||
|
||||
MOZ_ASSERT_UNREACHABLE("missing style context for node type");
|
||||
return nullptr;
|
||||
MOZ_ASSERT(style, "missing style context for node type");
|
||||
sStyleStorage[aNodeType] = style;
|
||||
return style;
|
||||
}
|
||||
|
||||
static GtkStyleContext*
|
||||
|
@ -322,6 +317,20 @@ GetWidgetStyleInternal(WidgetNodeType aNodeType)
|
|||
case MOZ_GTK_PROGRESS_TROUGH:
|
||||
return GetWidgetStyleWithClass(MOZ_GTK_PROGRESSBAR,
|
||||
GTK_STYLE_CLASS_TROUGH);
|
||||
case MOZ_GTK_TOOLTIP: {
|
||||
GtkStyleContext* style = sStyleStorage[aNodeType];
|
||||
if (style)
|
||||
return style;
|
||||
|
||||
// The tooltip style class is added first in CreateTooltipWidget() so
|
||||
// that gtk_widget_path_append_for_widget() in CreateStyleForWidget()
|
||||
// will find it.
|
||||
GtkWidget* tooltipWindow = CreateTooltipWidget();
|
||||
style = CreateStyleForWidget(tooltipWindow, nullptr);
|
||||
gtk_widget_destroy(tooltipWindow); // Release GtkWindow self-reference.
|
||||
sStyleStorage[aNodeType] = style;
|
||||
return style;
|
||||
}
|
||||
default:
|
||||
GtkWidget* widget = GetWidget(aNodeType);
|
||||
MOZ_ASSERT(widget);
|
||||
|
|
Загрузка…
Ссылка в новой задаче