GtkLabel link CSS node ignores text-decoration property in GTK 3
Steps to reproduce
- Create a GtkLabel with a link
- Add a CSS provider that styles the
link
CSS node
Here is a self-contained example:
// gcc -o bug bug.c $(pkg-config --cflags --libs gtk+-3.0)
#include <gtk/gtk.h>
static void activate(GtkApplication* app) {
GtkWidget *window = gtk_application_window_new(app);
GtkWidget *label = gtk_label_new("a <a href='https://www.gnome.org'>link</a>");
gtk_label_set_use_markup(GTK_LABEL(label), TRUE);
GtkCssProvider *css = gtk_css_provider_new();
gtk_css_provider_load_from_data(css, "link { color: red; text-decoration: line-through wavy blue; }", -1, NULL);
GtkStyleContext *style = gtk_widget_get_style_context(label);
gtk_style_context_add_provider(style, GTK_STYLE_PROVIDER(css), GTK_STYLE_PROVIDER_PRIORITY_USER);
gtk_container_add(GTK_CONTAINER(window), label);
gtk_widget_show_all(window);
}
int main(void) {
g_autoptr(GtkApplication) app = gtk_application_new("org.example.App", G_APPLICATION_FLAGS_NONE);
g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);
return g_application_run (G_APPLICATION (app), 0, NULL);
}
Current behavior
The link's underline is always present and always the same color as the text, even if other properties from the CSS are applied to the node. (e.g. in the above example, only the color
property has any effect.)
Expected outcome
The link's underline should respect the text-decoration
property, as it does in GTK 4.
Version information
GTK 3.24.34 Fedora Linux 36.20220815.0 (Silverblue)