cssanimatedstyle: Avoid some type checks and unnecessary work

This commit is contained in:
Timm Bäder
2019-01-19 18:05:13 +01:00
parent 51a0f98900
commit 5b3e0e11a2
3 changed files with 5 additions and 9 deletions

View File

@@ -186,14 +186,13 @@ transition_info_add (TransitionInfo infos[GTK_CSS_PROPERTY_N_PROPERTIES],
GtkStyleProperty *property,
guint index)
{
gtk_internal_return_if_fail (GTK_IS_STYLE_PROPERTY (property));
if (GTK_IS_CSS_SHORTHAND_PROPERTY (property))
{
GtkCssShorthandProperty *shorthand = GTK_CSS_SHORTHAND_PROPERTY (property);
GtkCssShorthandProperty *shorthand = (GtkCssShorthandProperty *) property;
guint len = _gtk_css_shorthand_property_get_n_subproperties (shorthand);
guint i;
for (i = 0; i < _gtk_css_shorthand_property_get_n_subproperties (shorthand); i++)
for (i = 0; i < len; i++)
{
GtkCssStyleProperty *prop = _gtk_css_shorthand_property_get_subproperty (shorthand, i);
@@ -228,9 +227,10 @@ transition_infos_set (TransitionInfo infos[GTK_CSS_PROPERTY_N_PROPERTIES],
prop_value = _gtk_css_array_value_get_nth (transitions, i);
if (g_ascii_strcasecmp (_gtk_css_ident_value_get (prop_value), "all") == 0)
{
const guint len = _gtk_css_style_property_get_n_properties ();
guint j;
for (j = 0; j < _gtk_css_style_property_get_n_properties (); j++)
for (j = 0; j < len; j++)
{
property = GTK_STYLE_PROPERTY (_gtk_css_style_property_lookup_by_id (j));
transition_info_add (infos, property, i);

View File

@@ -151,7 +151,6 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
GtkCssValue *value;
gtk_internal_return_val_if_fail (color != NULL, NULL);
gtk_internal_return_val_if_fail (provider == NULL || GTK_IS_STYLE_PROVIDER (provider), NULL);
switch (color->type)
{

View File

@@ -207,9 +207,6 @@ gtk_css_static_style_compute_value (GtkCssStaticStyle *style,
{
GtkCssValue *value;
gtk_internal_return_if_fail (GTK_IS_CSS_STATIC_STYLE (style));
gtk_internal_return_if_fail (GTK_IS_STYLE_PROVIDER (provider));
gtk_internal_return_if_fail (parent_style == NULL || GTK_IS_CSS_STYLE (parent_style));
gtk_internal_return_if_fail (id < GTK_CSS_PROPERTY_N_PROPERTIES);
/* http://www.w3.org/TR/css3-cascade/#cascade