Merge branch 'matthiasc/for-main' into 'main'

css: Add some more variables tests

See merge request GNOME/gtk!7268
This commit is contained in:
Matthias Clasen 2024-05-20 10:21:21 +00:00
commit 5b5ba36999
6 changed files with 19 additions and 8 deletions

View File

@ -629,7 +629,6 @@ gtk_css_animated_style_set_animated_custom_value (GtkCssAnimatedStyle *animated,
gtk_css_variable_set_add (style->variables, id, value);
context.provider = animated->provider;
context.style = animated->style;
context.parent_style = animated->parent_style;
context.provider = animated->provider;

View File

@ -39,6 +39,7 @@
#include "gtkstyleproviderprivate.h"
#include "gtkcssdimensionvalueprivate.h"
static void gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
guint id,
GtkCssValue *specified,
@ -174,7 +175,7 @@ G_DEFINE_TYPE (GtkCssStaticStyle, gtk_css_static_style, GTK_TYPE_CSS_STYLE)
static GtkCssSection *
gtk_css_static_style_get_section (GtkCssStyle *style,
guint id)
guint id)
{
GtkCssStaticStyle *sstyle = GTK_CSS_STATIC_STYLE (style);

View File

@ -860,10 +860,9 @@ GtkCssValues *gtk_css_values_ref (GtkCssValues *values)
static void
gtk_css_values_free (GtkCssValues *values)
{
int i;
GtkCssValue **v = GET_VALUES (values);
for (i = 0; i < N_VALUES (values->type); i++)
for (int i = 0; i < N_VALUES (values->type); i++)
{
if (v[i])
gtk_css_value_unref (v[i]);
@ -888,14 +887,13 @@ gtk_css_values_copy (GtkCssValues *values)
{
GtkCssValues *copy;
GtkCssValue **v, **v2;
int i;
copy = gtk_css_values_new (TYPE_INDEX(values->type));
copy = gtk_css_values_new (TYPE_INDEX (values->type));
v = GET_VALUES (values);
v2 = GET_VALUES (copy);
for (i = 0; i < N_VALUES (values->type); i++)
for (int i = 0; i < N_VALUES (values->type); i++)
{
if (v[i])
v2[i] = gtk_css_value_ref (v[i]);
@ -909,7 +907,7 @@ gtk_css_values_new (GtkCssValuesType type)
{
GtkCssValues *values;
values = (GtkCssValues *)g_malloc0 (VALUES_SIZE(type));
values = (GtkCssValues *) g_malloc0 (VALUES_SIZE (type));
values->ref_count = 1;
values->type = type;

View File

@ -81,6 +81,7 @@ struct _GtkCssValues {
struct _GtkCssCoreValues {
GtkCssValues base;
GtkCssValue *color;
GtkCssValue *dpi;
GtkCssValue *font_size;
@ -89,6 +90,7 @@ struct _GtkCssCoreValues {
struct _GtkCssBackgroundValues {
GtkCssValues base;
GtkCssValue *background_color;
GtkCssValue *box_shadow;
GtkCssValue *background_clip;
@ -102,6 +104,7 @@ struct _GtkCssBackgroundValues {
struct _GtkCssBorderValues {
GtkCssValues base;
GtkCssValue *border_top_style;
GtkCssValue *border_top_width;
GtkCssValue *border_left_style;
@ -126,6 +129,7 @@ struct _GtkCssBorderValues {
struct _GtkCssIconValues {
GtkCssValues base;
GtkCssValue *icon_size;
GtkCssValue *icon_shadow;
GtkCssValue *icon_style;
@ -134,6 +138,7 @@ struct _GtkCssIconValues {
struct _GtkCssOutlineValues {
GtkCssValues base;
GtkCssValue *outline_style;
GtkCssValue *outline_width;
GtkCssValue *outline_offset;
@ -142,6 +147,7 @@ struct _GtkCssOutlineValues {
struct _GtkCssFontValues {
GtkCssValues base;
GtkCssValue *font_family;
GtkCssValue *font_style;
GtkCssValue *font_weight;
@ -157,6 +163,7 @@ struct _GtkCssFontValues {
struct _GtkCssFontVariantValues {
GtkCssValues base;
GtkCssValue *text_decoration_line;
GtkCssValue *text_decoration_color; // NULL if currentColor
GtkCssValue *text_decoration_style;
@ -172,6 +179,7 @@ struct _GtkCssFontVariantValues {
struct _GtkCssAnimationValues {
GtkCssValues base;
GtkCssValue *animation_name;
GtkCssValue *animation_duration;
GtkCssValue *animation_timing_function;
@ -184,6 +192,7 @@ struct _GtkCssAnimationValues {
struct _GtkCssTransitionValues {
GtkCssValues base;
GtkCssValue *transition_property;
GtkCssValue *transition_duration;
GtkCssValue *transition_timing_function;
@ -192,6 +201,7 @@ struct _GtkCssTransitionValues {
struct _GtkCssSizeValues {
GtkCssValues base;
GtkCssValue *margin_top;
GtkCssValue *margin_left;
GtkCssValue *margin_bottom;
@ -207,6 +217,7 @@ struct _GtkCssSizeValues {
struct _GtkCssOtherValues {
GtkCssValues base;
GtkCssValue *icon_source;
GtkCssValue *icon_transform;
GtkCssValue *icon_filter;

View File

@ -6,6 +6,7 @@
label {
color: var(--color1);
background-color: var(--color2, green);
--extra-color: mix(var(--color1,), var(--color2, var(--color1)), var(--factor, 0.2));
}
@keyframes aaaa {

View File

@ -12,6 +12,7 @@
label {
background-color: var(--color2, green);
color: var(--color1);
--extra-color: mix(var(--color1,), var(--color2, var(--color1)), var(--factor, 0.2));
}
:root {