Merge branch 'wip/alice/opacity' into 'main'

css: Allow percents in opacity

See merge request GNOME/gtk!7346
This commit is contained in:
Matthias Clasen 2024-06-05 20:53:55 +00:00
commit 888afe3e46
4 changed files with 12 additions and 3 deletions

View File

@ -240,9 +240,10 @@ parse_css_direction (GtkCssStyleProperty *property,
static GtkCssValue *
opacity_parse (GtkCssStyleProperty *property,
GtkCssParser *parser)
GtkCssParser *parser)
{
return gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
return gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER
| GTK_CSS_PARSE_PERCENT);
}
static GtkCssValue *

View File

@ -11857,7 +11857,7 @@ gtk_widget_create_render_node (GtkWidget *widget,
style = gtk_css_node_get_style (priv->cssnode);
css_opacity = gtk_css_number_value_get (style->other->opacity, 100);
css_opacity = gtk_css_number_value_get (style->other->opacity, 1);
opacity = CLAMP (css_opacity, 0.0, 1.0) * priv->user_alpha / 255.0;
if (opacity <= 0.0)

View File

@ -21,3 +21,7 @@ e {
f {
opacity: 0;
}
g {
opacity: 50%;
}

View File

@ -21,3 +21,7 @@ e {
f {
opacity: 0;
}
g {
opacity: 50%;
}