diff options
-rw-r--r-- | gtk/gtkcssbordervalue.c | 6 | ||||
-rw-r--r-- | gtk/gtkcsscornervalue.c | 8 | ||||
-rw-r--r-- | gtk/gtkcssinheritvalue.c | 17 | ||||
-rw-r--r-- | gtk/gtkcssnumbervalue.c | 4 | ||||
-rw-r--r-- | gtk/gtkcsspositionvalue.c | 8 | ||||
-rw-r--r-- | gtk/gtkcsstypes.c | 8 | ||||
-rw-r--r-- | gtk/gtkcsstypesprivate.h | 6 |
7 files changed, 35 insertions, 22 deletions
diff --git a/gtk/gtkcssbordervalue.c b/gtk/gtkcssbordervalue.c index 085e3f2e40..dab46319ae 100644 --- a/gtk/gtkcssbordervalue.c +++ b/gtk/gtkcssbordervalue.c @@ -48,11 +48,10 @@ gtk_css_value_border_compute (GtkCssValue *value, GtkCssDependencies *dependencies) { GtkCssValue *computed; + GtkCssDependencies child_deps; gboolean changed = FALSE; guint i; - *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING; - computed = _gtk_css_border_value_new (NULL, NULL, NULL, NULL); computed->fill = value->fill; @@ -60,7 +59,8 @@ gtk_css_value_border_compute (GtkCssValue *value, { if (value->values[i]) { - computed->values[i] = _gtk_css_value_compute (value->values[i], property_id, context, NULL); + computed->values[i] = _gtk_css_value_compute (value->values[i], property_id, context, &child_deps); + *dependencies = _gtk_css_dependencies_union (*dependencies, child_deps); changed |= (computed->values[i] != value->values[i]); } } diff --git a/gtk/gtkcsscornervalue.c b/gtk/gtkcsscornervalue.c index 8710243aff..d26dffd1d7 100644 --- a/gtk/gtkcsscornervalue.c +++ b/gtk/gtkcsscornervalue.c @@ -43,11 +43,11 @@ gtk_css_value_corner_compute (GtkCssValue *corner, GtkCssDependencies *dependencies) { GtkCssValue *x, *y; + GtkCssDependencies x_deps, y_deps; - *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING; - - x = _gtk_css_value_compute (corner->x, property_id, context, NULL); - y = _gtk_css_value_compute (corner->y, property_id, context, NULL); + x = _gtk_css_value_compute (corner->x, property_id, context, &x_deps); + y = _gtk_css_value_compute (corner->y, property_id, context, &y_deps); + *dependencies = _gtk_css_dependencies_union (x_deps, y_deps); if (x == corner->x && y == corner->y) { _gtk_css_value_unref (x); diff --git a/gtk/gtkcssinheritvalue.c b/gtk/gtkcssinheritvalue.c index 58964be240..d70200d038 100644 --- a/gtk/gtkcssinheritvalue.c +++ b/gtk/gtkcssinheritvalue.c @@ -41,15 +41,18 @@ gtk_css_value_inherit_compute (GtkCssValue *value, { GtkStyleContext *parent = gtk_style_context_get_parent (context); - *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING; - if (parent) - return _gtk_css_value_ref (_gtk_style_context_peek_property (parent, property_id)); + { + *dependencies = GTK_CSS_EQUALS_PARENT; + return _gtk_css_value_ref (_gtk_style_context_peek_property (parent, property_id)); + } else - return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)), - property_id, - context, - NULL); + { + return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)), + property_id, + context, + dependencies); + } } static gboolean diff --git a/gtk/gtkcssnumbervalue.c b/gtk/gtkcssnumbervalue.c index 535c20587f..db9e154a77 100644 --- a/gtk/gtkcssnumbervalue.c +++ b/gtk/gtkcssnumbervalue.c @@ -74,8 +74,6 @@ gtk_css_value_number_compute (GtkCssValue *number, break; } - *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING; - switch (number->unit) { default: @@ -107,12 +105,14 @@ gtk_css_value_number_compute (GtkCssValue *number, GTK_CSS_PX); break; case GTK_CSS_EM: + *dependencies = GTK_CSS_DEPENDS_ON_FONT_SIZE; return _gtk_css_number_value_new (number->value * _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_FONT_SIZE), 100), GTK_CSS_PX); break; case GTK_CSS_EX: /* for now we pretend ex is half of em */ + *dependencies = GTK_CSS_DEPENDS_ON_FONT_SIZE; return _gtk_css_number_value_new (number->value * 0.5 * _gtk_css_number_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_FONT_SIZE), 100), GTK_CSS_PX); diff --git a/gtk/gtkcsspositionvalue.c b/gtk/gtkcsspositionvalue.c index 6a6cbe3828..e69147a995 100644 --- a/gtk/gtkcsspositionvalue.c +++ b/gtk/gtkcsspositionvalue.c @@ -43,9 +43,11 @@ gtk_css_value_position_compute (GtkCssValue *position, GtkCssDependencies *dependencies) { GtkCssValue *x, *y; + GtkCssDependencies x_deps, y_deps; - x = _gtk_css_value_compute (position->x, property_id, context, NULL); - y = _gtk_css_value_compute (position->y, property_id, context, NULL); + x = _gtk_css_value_compute (position->x, property_id, context, &x_deps); + y = _gtk_css_value_compute (position->y, property_id, context, &y_deps); + *dependencies = _gtk_css_dependencies_union (x_deps, y_deps); if (x == position->x && y == position->y) { _gtk_css_value_unref (x); @@ -53,8 +55,6 @@ gtk_css_value_position_compute (GtkCssValue *position, return _gtk_css_value_ref (position); } - *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING; - return _gtk_css_position_value_new (x, y); } diff --git a/gtk/gtkcsstypes.c b/gtk/gtkcsstypes.c index b69b0fecca..e67dceac56 100644 --- a/gtk/gtkcsstypes.c +++ b/gtk/gtkcsstypes.c @@ -82,3 +82,11 @@ _gtk_css_change_for_child (GtkCssChange match) return gtk_css_change_translate (match, table, G_N_ELEMENTS (table)); } +GtkCssDependencies +_gtk_css_dependencies_union (GtkCssDependencies first, + GtkCssDependencies second) +{ + return (first & ~GTK_CSS_EQUALS_PARENT) | ((first & GTK_CSS_EQUALS_PARENT) ? GTK_CSS_DEPENDS_ON_PARENT : 0) + | (second & ~GTK_CSS_EQUALS_PARENT) | ((second & GTK_CSS_EQUALS_PARENT) ? GTK_CSS_DEPENDS_ON_PARENT : 0); +} + diff --git a/gtk/gtkcsstypesprivate.h b/gtk/gtkcsstypesprivate.h index dfc9527e0d..a77bd8cc70 100644 --- a/gtk/gtkcsstypesprivate.h +++ b/gtk/gtkcsstypesprivate.h @@ -170,8 +170,10 @@ typedef enum /*< skip >*/ { GTK_CSS_MS, } GtkCssUnit; -GtkCssChange _gtk_css_change_for_sibling (GtkCssChange match); -GtkCssChange _gtk_css_change_for_child (GtkCssChange match); +GtkCssChange _gtk_css_change_for_sibling (GtkCssChange match); +GtkCssChange _gtk_css_change_for_child (GtkCssChange match); +GtkCssDependencies _gtk_css_dependencies_union (GtkCssDependencies first, + GtkCssDependencies second); G_END_DECLS |