mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-10 02:08:38 +09:00
[GTK3] Use WidgetCache to get colors at nsLookAndFeel
This commit is contained in:
parent
6a029bbbad
commit
9461197f53
4 changed files with 38 additions and 46 deletions
|
|
@ -754,6 +754,27 @@ GetWidgetRootStyle(WidgetNodeType aNodeType)
|
|||
style = CreateStyleForWidget(gtk_radio_menu_item_new(nullptr),
|
||||
MOZ_GTK_MENUPOPUP);
|
||||
break;
|
||||
case MOZ_GTK_TOOLTIP:
|
||||
if (gtk_check_version(3, 20, 0) != nullptr) {
|
||||
// The tooltip style class is added first in CreateTooltipWidget()
|
||||
// and transfered to style in CreateStyleForWidget().
|
||||
GtkWidget* tooltipWindow = CreateTooltipWidget();
|
||||
style = CreateStyleForWidget(tooltipWindow, nullptr);
|
||||
gtk_widget_destroy(tooltipWindow); // Release GtkWindow self-reference.
|
||||
} else {
|
||||
// We create this from the path because GtkTooltipWindow is not public.
|
||||
style = CreateCSSNode("tooltip", nullptr, GTK_TYPE_TOOLTIP);
|
||||
gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
|
||||
}
|
||||
break;
|
||||
case MOZ_GTK_TOOLTIP_BOX:
|
||||
style = CreateStyleForWidget(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0),
|
||||
MOZ_GTK_TOOLTIP);
|
||||
break;
|
||||
case MOZ_GTK_TOOLTIP_BOX_LABEL:
|
||||
style = CreateStyleForWidget(gtk_label_new(nullptr),
|
||||
MOZ_GTK_TOOLTIP_BOX);
|
||||
break;
|
||||
default:
|
||||
GtkWidget* widget = GetWidget(aNodeType);
|
||||
MOZ_ASSERT(widget);
|
||||
|
|
@ -844,11 +865,6 @@ GetCssNodeStyleInternal(WidgetNodeType aNodeType)
|
|||
style = CreateChildCSSNode("progress",
|
||||
MOZ_GTK_PROGRESS_TROUGH);
|
||||
break;
|
||||
case MOZ_GTK_TOOLTIP:
|
||||
// We create this from the path because GtkTooltipWindow is not public.
|
||||
style = CreateCSSNode("tooltip", nullptr, GTK_TYPE_TOOLTIP);
|
||||
gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
|
||||
break;
|
||||
case MOZ_GTK_GRIPPER:
|
||||
// TODO - create from CSS node
|
||||
return GetWidgetStyleWithClass(MOZ_GTK_GRIPPER,
|
||||
|
|
@ -980,20 +996,6 @@ 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;
|
||||
}
|
||||
case MOZ_GTK_GRIPPER:
|
||||
return GetWidgetStyleWithClass(MOZ_GTK_GRIPPER,
|
||||
GTK_STYLE_CLASS_GRIP);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue