cssstyle: Move function from vfunc to static func

compute_dependencies() is only used internally by GtkCssStaticStyle,
so there's no need to have it elsewhere.
This commit is contained in:
Benjamin Otte 2014-12-17 13:30:51 +01:00
parent cd056adb2f
commit 9645daf48f
4 changed files with 8 additions and 41 deletions

View File

@ -63,16 +63,6 @@ gtk_css_animated_style_get_section (GtkCssStyle *style,
return gtk_css_style_get_section (animated->style, id); return gtk_css_style_get_section (animated->style, id);
} }
static GtkBitmask *
gtk_css_animated_style_compute_dependencies (GtkCssStyle *style,
const GtkBitmask *parent_changes)
{
GtkCssAnimatedStyle *animated = GTK_CSS_ANIMATED_STYLE (style);
/* XXX: This misses dependencies due to animations */
return gtk_css_style_compute_dependencies (animated->style, parent_changes);
}
static void static void
gtk_css_animated_style_dispose (GObject *object) gtk_css_animated_style_dispose (GObject *object)
{ {
@ -111,7 +101,6 @@ gtk_css_animated_style_class_init (GtkCssAnimatedStyleClass *klass)
style_class->get_value = gtk_css_animated_style_get_value; style_class->get_value = gtk_css_animated_style_get_value;
style_class->get_section = gtk_css_animated_style_get_section; style_class->get_section = gtk_css_animated_style_get_section;
style_class->compute_dependencies = gtk_css_animated_style_compute_dependencies;
} }
static void static void

View File

@ -65,9 +65,14 @@ gtk_css_static_style_get_section (GtkCssStyle *style,
return g_ptr_array_index (sstyle->sections, id); return g_ptr_array_index (sstyle->sections, id);
} }
/* Compute the bitmask of potentially changed properties if the parent has changed
* the passed in ones.
* This is for example needed when changes in the "color" property will affect
* all properties using "currentColor" as a color.
*/
static GtkBitmask * static GtkBitmask *
gtk_css_static_style_compute_dependencies (GtkCssStyle *style, gtk_css_static_style_compute_dependencies (GtkCssStaticStyle *style,
const GtkBitmask *parent_changes) const GtkBitmask *parent_changes)
{ {
GtkCssStaticStyle *sstyle = GTK_CSS_STATIC_STYLE (style); GtkCssStaticStyle *sstyle = GTK_CSS_STATIC_STYLE (style);
GtkBitmask *changes; GtkBitmask *changes;
@ -125,7 +130,6 @@ gtk_css_static_style_class_init (GtkCssStaticStyleClass *klass)
style_class->get_value = gtk_css_static_style_get_value; style_class->get_value = gtk_css_static_style_get_value;
style_class->get_section = gtk_css_static_style_get_section; style_class->get_section = gtk_css_static_style_get_section;
style_class->compute_dependencies = gtk_css_static_style_compute_dependencies;
} }
static void static void
@ -225,7 +229,7 @@ gtk_css_static_style_new_update (GtkCssStaticStyle *style,
gtk_internal_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL); gtk_internal_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
gtk_internal_return_val_if_fail (matcher != NULL, NULL); gtk_internal_return_val_if_fail (matcher != NULL, NULL);
changes = gtk_css_style_compute_dependencies (GTK_CSS_STYLE (style), parent_changes); changes = gtk_css_static_style_compute_dependencies (style, parent_changes);
if (_gtk_bitmask_is_empty (changes)) if (_gtk_bitmask_is_empty (changes))
{ {
_gtk_bitmask_free (changes); _gtk_bitmask_free (changes);

View File

@ -46,18 +46,10 @@ gtk_css_style_real_get_section (GtkCssStyle *style,
return NULL; return NULL;
} }
static GtkBitmask *
gtk_css_style_real_compute_dependencies (GtkCssStyle *style,
const GtkBitmask *parent_changes)
{
return _gtk_bitmask_copy (parent_changes);
}
static void static void
gtk_css_style_class_init (GtkCssStyleClass *klass) gtk_css_style_class_init (GtkCssStyleClass *klass)
{ {
klass->get_section = gtk_css_style_real_get_section; klass->get_section = gtk_css_style_real_get_section;
klass->compute_dependencies = gtk_css_style_real_compute_dependencies;
} }
static void static void
@ -102,15 +94,6 @@ gtk_css_style_get_difference (GtkCssStyle *style,
return result; return result;
} }
GtkBitmask *
gtk_css_style_compute_dependencies (GtkCssStyle *style,
const GtkBitmask *parent_changes)
{
gtk_internal_return_val_if_fail (GTK_IS_CSS_STYLE (style), _gtk_bitmask_new ());
return GTK_CSS_STYLE_GET_CLASS (style)->compute_dependencies (style, parent_changes);
}
void void
gtk_css_style_print (GtkCssStyle *style, gtk_css_style_print (GtkCssStyle *style,
GString *string) GString *string)

View File

@ -54,13 +54,6 @@ struct _GtkCssStyleClass
* Optional: default impl will just return NULL */ * Optional: default impl will just return NULL */
GtkCssSection * (* get_section) (GtkCssStyle *style, GtkCssSection * (* get_section) (GtkCssStyle *style,
guint id); guint id);
/* Compute the bitmask of potentially changed properties if the parent has changed
* the passed in ones.
* This is for example needed when changes in the "color" property will affect
* all properties using "currentColor" as a color.
* Optional: The default impl just returns the parent changes unchanged */
GtkBitmask * (* compute_dependencies) (GtkCssStyle *style,
const GtkBitmask *parent_changes);
}; };
GType gtk_css_style_get_type (void) G_GNUC_CONST; GType gtk_css_style_get_type (void) G_GNUC_CONST;
@ -71,8 +64,6 @@ GtkCssSection * gtk_css_style_get_section (GtkCssStyle
guint id); guint id);
GtkBitmask * gtk_css_style_get_difference (GtkCssStyle *style, GtkBitmask * gtk_css_style_get_difference (GtkCssStyle *style,
GtkCssStyle *other); GtkCssStyle *other);
GtkBitmask * gtk_css_style_compute_dependencies (GtkCssStyle *style,
const GtkBitmask *parent_changes);
char * gtk_css_style_to_string (GtkCssStyle *style); char * gtk_css_style_to_string (GtkCssStyle *style);
void gtk_css_style_print (GtkCssStyle *style, void gtk_css_style_print (GtkCssStyle *style,