From: Matthias Clasen Date: Sun, 2 Feb 2020 15:34:45 +0000 (+0100) Subject: css: Fix an oversight in style change computation X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1^2~18^2~20^2~116 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=621120d1d30588624d7c08ab8036fb9ec3d75330;p=gtk4.git css: Fix an oversight in style change computation Take the 'color == NULL means currentColor' trick into account when computing the changes between two styles. --- diff --git a/gtk/gtkcssstylechange.c b/gtk/gtkcssstylechange.c index 5a7263128d..3792b0fe51 100644 --- a/gtk/gtkcssstylechange.c +++ b/gtk/gtkcssstylechange.c @@ -24,56 +24,79 @@ static void compute_change (GtkCssStyleChange *change) { + gboolean color_changed = FALSE; + if (change->old_style->core != change->new_style->core) - gtk_css_core_values_compute_changes_and_affects (change->old_style, - change->new_style, - &change->changes, - &change->affects); + { + gtk_css_core_values_compute_changes_and_affects (change->old_style, + change->new_style, + &change->changes, + &change->affects); + color_changed = _gtk_bitmask_get (change->changes, GTK_CSS_PROPERTY_COLOR); + } + if (change->old_style->background != change->new_style->background) gtk_css_background_values_compute_changes_and_affects (change->old_style, change->new_style, &change->changes, &change->affects); - if (change->old_style->border != change->new_style->border) + + if (change->old_style->border != change->new_style->border || + (color_changed && (change->old_style->border->border_top_color == NULL || + change->old_style->border->border_right_color == NULL || + change->old_style->border->border_bottom_color == NULL || + change->old_style->border->border_left_color == NULL))) gtk_css_border_values_compute_changes_and_affects (change->old_style, change->new_style, &change->changes, &change->affects); + if (change->old_style->icon != change->new_style->icon) gtk_css_icon_values_compute_changes_and_affects (change->old_style, change->new_style, &change->changes, &change->affects); - if (change->old_style->outline != change->new_style->outline) + + if (change->old_style->outline != change->new_style->outline || + (color_changed && change->old_style->outline->outline_color == NULL)) gtk_css_outline_values_compute_changes_and_affects (change->old_style, change->new_style, &change->changes, &change->affects); - if (change->old_style->font != change->new_style->font) + + if (change->old_style->font != change->new_style->font || + (color_changed && (change->old_style->font->caret_color == NULL || + change->old_style->font->secondary_caret_color == NULL))) gtk_css_font_values_compute_changes_and_affects (change->old_style, change->new_style, &change->changes, &change->affects); - if (change->old_style->font_variant != change->new_style->font_variant) + + if (change->old_style->font_variant != change->new_style->font_variant || + (color_changed && change->old_style->font_variant->text_decoration_color == NULL)) gtk_css_font_variant_values_compute_changes_and_affects (change->old_style, change->new_style, &change->changes, &change->affects); + if (change->old_style->animation != change->new_style->animation) gtk_css_animation_values_compute_changes_and_affects (change->old_style, change->new_style, &change->changes, &change->affects); + if (change->old_style->transition != change->new_style->transition) gtk_css_transition_values_compute_changes_and_affects (change->old_style, change->new_style, &change->changes, &change->affects); + if (change->old_style->size != change->new_style->size) gtk_css_size_values_compute_changes_and_affects (change->old_style, change->new_style, &change->changes, &change->affects); + if (change->old_style->other != change->new_style->other) gtk_css_other_values_compute_changes_and_affects (change->old_style, change->new_style,