summaryrefslogtreecommitdiff
path: root/gtk/gtkcsstransformvalue.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-01-11 20:09:56 -0500
committerTimm Bäder <mail@baedert.org>2020-01-18 08:49:52 +0100
commitf5182f1c3508a138c8d2e11c0cfaf979e5daf98e (patch)
tree67abcdd574d76a23af94590f35734a013e6674a7 /gtk/gtkcsstransformvalue.c
parent1efa39672b94ba12f42f386d0eedb7ed6d7c3d03 (diff)
downloadgtk+-f5182f1c3508a138c8d2e11c0cfaf979e5daf98e.tar.gz
css: Mark transform value as computed
This is not very useful, since transitions generate a ton of transforms anyway.
Diffstat (limited to 'gtk/gtkcsstransformvalue.c')
-rw-r--r--gtk/gtkcsstransformvalue.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/gtk/gtkcsstransformvalue.c b/gtk/gtkcsstransformvalue.c
index 5064734af4..e190c450b3 100644
--- a/gtk/gtkcsstransformvalue.c
+++ b/gtk/gtkcsstransformvalue.c
@@ -931,6 +931,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
GtkCssValue *value;
GArray *array;
guint i;
+ gboolean computed = TRUE;
if (gtk_css_parser_try_ident (parser, "none"))
return _gtk_css_transform_value_new_none ();
@@ -967,6 +968,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
goto fail;
transform.type = GTK_CSS_TRANSFORM_PERSPECTIVE;
+ computed = computed && gtk_css_value_is_computed (transform.perspective.depth);
}
else if (gtk_css_parser_has_function (parser, "rotate") ||
gtk_css_parser_has_function (parser, "rotateZ"))
@@ -978,6 +980,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.rotate.x = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform.rotate.y = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform.rotate.z = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
+ computed = computed && gtk_css_value_is_computed (transform.rotate.angle);
}
else if (gtk_css_parser_has_function (parser, "rotate3d"))
{
@@ -991,6 +994,10 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
}
transform.type = GTK_CSS_TRANSFORM_ROTATE;
+ computed = computed && gtk_css_value_is_computed (transform.rotate.angle) &&
+ gtk_css_value_is_computed (transform.rotate.x) &&
+ gtk_css_value_is_computed (transform.rotate.y) &&
+ gtk_css_value_is_computed (transform.rotate.z);
}
else if (gtk_css_parser_has_function (parser, "rotateX"))
{
@@ -1001,6 +1008,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.rotate.x = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.rotate.y = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform.rotate.z = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
+ computed = computed && gtk_css_value_is_computed (transform.rotate.angle);
}
else if (gtk_css_parser_has_function (parser, "rotateY"))
{
@@ -1011,6 +1019,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.rotate.x = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform.rotate.y = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.rotate.z = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
+ computed = computed && gtk_css_value_is_computed (transform.rotate.angle);
}
else if (gtk_css_parser_has_function (parser, "scale"))
{
@@ -1030,6 +1039,8 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
else
transform.scale.y = gtk_css_value_ref (values[0]);
transform.scale.z = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
+ computed = computed && gtk_css_value_is_computed (transform.scale.x) &&
+ gtk_css_value_is_computed (transform.scale.y);
}
else if (gtk_css_parser_has_function (parser, "scale3d"))
{
@@ -1047,6 +1058,9 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.scale.x = values[0];
transform.scale.y = values[1];
transform.scale.z = values[2];
+ computed = computed && gtk_css_value_is_computed (transform.scale.x) &&
+ gtk_css_value_is_computed (transform.scale.y) &&
+ gtk_css_value_is_computed (transform.scale.z);
}
else if (gtk_css_parser_has_function (parser, "scaleX"))
{
@@ -1056,6 +1070,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.type = GTK_CSS_TRANSFORM_SCALE;
transform.scale.y = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.scale.z = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
+ computed = computed && gtk_css_value_is_computed (transform.scale.x);
}
else if (gtk_css_parser_has_function (parser, "scaleY"))
{
@@ -1065,6 +1080,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.type = GTK_CSS_TRANSFORM_SCALE;
transform.scale.x = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.scale.z = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
+ computed = computed && gtk_css_value_is_computed (transform.scale.y);
}
else if (gtk_css_parser_has_function (parser, "scaleZ"))
{
@@ -1074,6 +1090,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.type = GTK_CSS_TRANSFORM_SCALE;
transform.scale.x = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.scale.y = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
+ computed = computed && gtk_css_value_is_computed (transform.scale.z);
}
else if (gtk_css_parser_has_function (parser, "skew"))
{
@@ -1089,6 +1106,8 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.type = GTK_CSS_TRANSFORM_SKEW;
transform.skew.x = values[0];
transform.skew.y = values[1];
+ computed = computed && gtk_css_value_is_computed (transform.skew.x) &&
+ gtk_css_value_is_computed (transform.skew.y);
}
else if (gtk_css_parser_has_function (parser, "skewX"))
{
@@ -1096,6 +1115,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
goto fail;
transform.type = GTK_CSS_TRANSFORM_SKEW_X;
+ computed = computed && gtk_css_value_is_computed (transform.skew_x.skew);
}
else if (gtk_css_parser_has_function (parser, "skewY"))
{
@@ -1103,6 +1123,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
goto fail;
transform.type = GTK_CSS_TRANSFORM_SKEW_Y;
+ computed = computed && gtk_css_value_is_computed (transform.skew_y.skew);
}
else if (gtk_css_parser_has_function (parser, "translate"))
{
@@ -1122,6 +1143,8 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
else
transform.translate.y = _gtk_css_number_value_new (0, GTK_CSS_PX);
transform.translate.z = _gtk_css_number_value_new (0, GTK_CSS_PX);
+ computed = computed && gtk_css_value_is_computed (transform.translate.x) &&
+ gtk_css_value_is_computed (transform.translate.y);
}
else if (gtk_css_parser_has_function (parser, "translate3d"))
{
@@ -1139,6 +1162,9 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.translate.x = values[0];
transform.translate.y = values[1];
transform.translate.z = values[2];
+ computed = computed && gtk_css_value_is_computed (transform.translate.x) &&
+ gtk_css_value_is_computed (transform.translate.y) &&
+ gtk_css_value_is_computed (transform.translate.z);
}
else if (gtk_css_parser_has_function (parser, "translateX"))
{
@@ -1148,6 +1174,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.type = GTK_CSS_TRANSFORM_TRANSLATE;
transform.translate.y = _gtk_css_number_value_new (0, GTK_CSS_PX);
transform.translate.z = _gtk_css_number_value_new (0, GTK_CSS_PX);
+ computed = computed && gtk_css_value_is_computed (transform.translate.x);
}
else if (gtk_css_parser_has_function (parser, "translateY"))
{
@@ -1157,6 +1184,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.type = GTK_CSS_TRANSFORM_TRANSLATE;
transform.translate.x = _gtk_css_number_value_new (0, GTK_CSS_PX);
transform.translate.z = _gtk_css_number_value_new (0, GTK_CSS_PX);
+ computed = computed && gtk_css_value_is_computed (transform.translate.y);
}
else if (gtk_css_parser_has_function (parser, "translateZ"))
{
@@ -1166,6 +1194,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.type = GTK_CSS_TRANSFORM_TRANSLATE;
transform.translate.x = _gtk_css_number_value_new (0, GTK_CSS_PX);
transform.translate.y = _gtk_css_number_value_new (0, GTK_CSS_PX);
+ computed = computed && gtk_css_value_is_computed (transform.translate.z);
}
else
{
@@ -1182,6 +1211,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
}
value = gtk_css_transform_value_alloc (array->len);
+ value->is_computed = computed;
memcpy (value->transforms, array->data, sizeof (GtkCssTransform) * array->len);
g_array_free (array, TRUE);