Open
Bug 1320883
Opened 8 years ago
Updated 2 years ago
Get infobar colors from WidgetCache
Categories
(Core :: Widget: Gtk, defect, P3)
Core
Widget: Gtk
Tracking
()
NEW
People
(Reporter: stransky, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: tpi:+)
Attachments
(1 file)
4.63 KB,
patch
|
karlt
:
review-
|
Details | Diff | Splinter Review |
Recent infobar text color implementation at nsLookAndFeel::Init() is incorrect, Gtk does not use GtkLabel inside the content area (at least not on 3.20).
We should just match css node "infobar" with ".info" class.
Reporter | ||
Comment 1•8 years ago
|
||
I see that Gtk < 3.20 uses "GtkInfoBar" css node name.
Reporter | ||
Comment 2•8 years ago
|
||
(In reply to Martin Stránský from comment #0)
> Recent infobar text color implementation at nsLookAndFeel::Init() is
> incorrect, Gtk does not use GtkLabel inside the content area (at least not
> on 3.20).
I was wrong, gtk3-demo actually uses the GtkLabel inside the infobar. I wonder why it does not worked for me when I tested it with various themes yesterday. Anyway, we may use the styles to get the colors.
Reporter | ||
Comment 3•8 years ago
|
||
Style path for Gtk+ > 3.20:
------------------------------------
infobar {
border-width: 0;
border-style: none;
}
.info,
.question,
.warning,
.error {
background-color: @infobar_bg_color;
color: @infobar_fg_color;
text-shadow: none;
border-color: darker(@infobar_bg_color);
}
Style path for Gtk+ < 3.20:
------------------------------------
GtkInfoBar {
border-width: 0;
border-style: none;
}
[...]
.info {
background-color: @info_bg_color;
color: @info_fg_color;
border-color: darker(@info_bg_color);
}
Reporter | ||
Updated•8 years ago
|
Summary: [nsLookAndFeel] Fix infobar colors for Gtk 3.20+ → Get infobar colors from WidgetCache
Reporter | ||
Comment 4•8 years ago
|
||
Attachment #8815235 -
Flags: review?(karlt)
Comment 5•8 years ago
|
||
Comment on attachment 8815235 [details] [diff] [review]
patch
Removing the gtk_style_context_save() is good, thanks, but the label needs to
be retained to get the correct text color with some themes.
I expect removing gtk_style_context_add_class(style, GTK_STYLE_CLASS_INFO) is
good too, as that is on the wrong widget, and I guess the root node already
has this.
Using MOZ_GTK_INFO_BAR would be good, but creating the correct hierarchy could
be a bit trickier than gtk_info_bar_get_content_area() because the hierarchy
changed sometime between 3.8 and 3.18 to add a GtkRevealer (see
gtkinfobar.ui). It might be easiest not to use WidgetStyleCache for
MOZ_GTK_INFO_BAR from nsLookAndFeel for now, if that is working.
A label will be used for text as indicated at
https://developer.gnome.org/gtk3/stable/GtkInfoBar.html#GtkInfoBar.description
and so some themes set the color only on the label (bug 1206516).
Although Adwaita sets the color on the root node (with .info), the label will
inherit the "color" property.
>+ GtkWidget* infobarWidget = CreateInfoBarWidget();
>+ style = CreateStyleForWidget(infobarWidget, nullptr);
>+ gtk_widget_destroy(infobarWidget); // Release GtkWindow self-reference.
Pass MOZ_GTK_WINDOW as the second argument to CreateStyleForWidget so that
properties inherit from the window, as happens with widgets.
(CreateStyleForWidget() does not notice that the GtkInfoBar has a parent
widget.)
gtk_info_bar_new() is simpler for the first argument, not
having the need for an additional destroy to remove it from the window
container.
Attachment #8815235 -
Flags: review?(karlt) → review-
Updated•8 years ago
|
Priority: -- → P3
Whiteboard: tpi:+
Reporter | ||
Updated•5 years ago
|
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•