From 1fa4b9f58ca5e3662dabb849becb38099ee6c63b Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 8 May 2019 17:28:50 +0200 Subject: [PATCH] rendernode: Parse repeat nodes --- gsk/gskrendernodeparser.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/gsk/gskrendernodeparser.c b/gsk/gskrendernodeparser.c index ea640c01e8..b9962931c7 100644 --- a/gsk/gskrendernodeparser.c +++ b/gsk/gskrendernodeparser.c @@ -903,6 +903,39 @@ parse_blend_node (GtkCssParser *parser) return result; } +static GskRenderNode * +parse_repeat_node (GtkCssParser *parser) +{ + GskRenderNode *child = NULL; + graphene_rect_t bounds = GRAPHENE_RECT_INIT (0, 0, 0, 0); + graphene_rect_t child_bounds = GRAPHENE_RECT_INIT (0, 0, 0, 0); + const Declaration declarations[] = { + { "child", parse_node, &child }, + { "bounds", parse_rect, &bounds }, + { "child-bounds", parse_rect, &child_bounds }, + }; + GskRenderNode *result; + guint parse_result; + + parse_result = parse_declarations (parser, declarations, G_N_ELEMENTS(declarations)); + if (child == NULL) + { + gtk_css_parser_error_syntax (parser, "Missing \"child\" property definition"); + return NULL; + } + + if (!(parse_result & (1 << 1))) + gsk_render_node_get_bounds (child, &bounds); + if (!(parse_result & (1 << 2))) + gsk_render_node_get_bounds (child, &child_bounds); + + result = gsk_repeat_node_new (&bounds, child, &child_bounds); + + gsk_render_node_unref (child); + + return result; +} + static GskRenderNode * parse_text_node (GtkCssParser *parser) { @@ -1091,8 +1124,8 @@ parse_node (GtkCssParser *parser, { "blur", parse_blur_node }, { "debug", parse_debug_node }, { "blend", parse_blend_node }, -#if 0 { "repeat", parse_repeat_node }, +#if 0 { "cairo", parse_cairo_node }, #endif