void _gtk_css_computed_values_compute_value (GtkCssComputedValues *values, GtkStyleProviderPrivate *provider, GtkCssComputedValues *parent_values, guint id, GtkCssValue *specified, GtkCssSection *section) { GtkCssDependencies dependencies; GtkCssValue *value; gtk_internal_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values)); gtk_internal_return_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider)); gtk_internal_return_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values)); /* http://www.w3.org/TR/css3-cascade/#cascade * Then, for every element, the value for each property can be found * by following this pseudo-algorithm: * 1) Identify all declarations that apply to the element */ if (specified == NULL) { GtkCssStyleProperty *prop = _gtk_css_style_property_lookup_by_id (id); if (_gtk_css_style_property_is_inherit (prop)) specified = _gtk_css_inherit_value_new (); else specified = _gtk_css_initial_value_new (); } else _gtk_css_value_ref (specified); value = _gtk_css_value_compute (specified, id, provider, values, parent_values, &dependencies); _gtk_css_computed_values_set_value (values, id, value, dependencies, section); _gtk_css_value_unref (value); _gtk_css_value_unref (specified); }
static GtkCssValue * gtk_css_value_unset_compute (GtkCssValue *value, guint property_id, GtkStyleProviderPrivate *provider, GtkCssStyle *style, GtkCssStyle *parent_style) { GtkCssStyleProperty *property; GtkCssValue *unset_value; property = _gtk_css_style_property_lookup_by_id (property_id); if (_gtk_css_style_property_is_inherit (property)) unset_value = _gtk_css_inherit_value_get (); else unset_value = _gtk_css_initial_value_get (); return _gtk_css_value_compute (unset_value, property_id, provider, style, parent_style); }
void _gtk_css_computed_values_compute_value (GtkCssComputedValues *values, GtkStyleProviderPrivate *provider, int scale, GtkCssComputedValues *parent_values, guint id, GtkCssValue *specified, GtkCssSection *section) { GtkCssDependencies dependencies; GtkCssValue *value; gtk_internal_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values)); gtk_internal_return_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider)); gtk_internal_return_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values)); /* http://www.w3.org/TR/css3-cascade/#cascade * Then, for every element, the value for each property can be found * by following this pseudo-algorithm: * 1) Identify all declarations that apply to the element */ if (specified == NULL) { GtkCssStyleProperty *prop = _gtk_css_style_property_lookup_by_id (id); if (_gtk_css_style_property_is_inherit (prop)) specified = _gtk_css_inherit_value_new (); else specified = _gtk_css_initial_value_new (); } else _gtk_css_value_ref (specified); value = _gtk_css_value_compute (specified, id, provider, scale, values, parent_values, &dependencies); if (values->values == NULL) values->values = g_ptr_array_new_full (_gtk_css_style_property_get_n_properties (), (GDestroyNotify)_gtk_css_value_unref); if (id >= values->values->len) g_ptr_array_set_size (values->values, id + 1); if (g_ptr_array_index (values->values, id)) _gtk_css_value_unref (g_ptr_array_index (values->values, id)); g_ptr_array_index (values->values, id) = _gtk_css_value_ref (value); if (dependencies & (GTK_CSS_DEPENDS_ON_PARENT | GTK_CSS_EQUALS_PARENT)) values->depends_on_parent = _gtk_bitmask_set (values->depends_on_parent, id, TRUE); if (dependencies & (GTK_CSS_EQUALS_PARENT)) values->equals_parent = _gtk_bitmask_set (values->equals_parent, id, TRUE); if (dependencies & (GTK_CSS_DEPENDS_ON_COLOR)) values->depends_on_color = _gtk_bitmask_set (values->depends_on_color, id, TRUE); if (dependencies & (GTK_CSS_DEPENDS_ON_FONT_SIZE)) values->depends_on_font_size = _gtk_bitmask_set (values->depends_on_font_size, id, TRUE); if (values->sections && values->sections->len > id && g_ptr_array_index (values->sections, id)) { gtk_css_section_unref (g_ptr_array_index (values->sections, id)); g_ptr_array_index (values->sections, id) = NULL; } if (section) { if (values->sections == NULL) values->sections = g_ptr_array_new_with_free_func (maybe_unref_section); if (values->sections->len <= id) g_ptr_array_set_size (values->sections, id + 1); g_ptr_array_index (values->sections, id) = gtk_css_section_ref (section); } _gtk_css_value_unref (value); _gtk_css_value_unref (specified); }