diff --git a/gsk/gskrendernodeparser.c b/gsk/gskrendernodeparser.c index 26bcab7619..e6ee8383c1 100644 --- a/gsk/gskrendernodeparser.c +++ b/gsk/gskrendernodeparser.c @@ -1172,10 +1172,16 @@ create_default_texture (void) return texture; } +static GskRenderNode * +create_default_render_node_with_bounds (const graphene_rect_t *rect) +{ + return gsk_color_node_new (&GDK_RGBA("FF00CC"), rect); +} + static GskRenderNode * create_default_render_node (void) { - return gsk_color_node_new (&GDK_RGBA("FF00CC"), &GRAPHENE_RECT_INIT (0, 0, 50, 50)); + return create_default_render_node_with_bounds (&GRAPHENE_RECT_INIT (0, 0, 50, 50)); } static GskPath * @@ -2254,10 +2260,14 @@ parse_fill_node (GtkCssParser *parser, GskRenderNode *result; parse_declarations (parser, context, declarations, G_N_ELEMENTS (declarations)); - if (child == NULL) - child = create_default_render_node (); if (path == NULL) path = create_default_path (); + if (child == NULL) + { + graphene_rect_t bounds; + gsk_path_get_bounds (path, &bounds); + child = create_default_render_node_with_bounds (&bounds); + } result = gsk_fill_node_new (child, path, rule); @@ -2311,8 +2321,6 @@ parse_stroke_node (GtkCssParser *parser, GskRenderNode *result; parse_declarations (parser, context, declarations, G_N_ELEMENTS (declarations)); - if (child == NULL) - child = create_default_render_node (); if (path == NULL) path = create_default_path (); @@ -2327,6 +2335,13 @@ parse_stroke_node (GtkCssParser *parser, } gsk_stroke_set_dash_offset (stroke, dash_offset); + if (child == NULL) + { + graphene_rect_t bounds; + gsk_path_get_stroke_bounds (path, stroke, &bounds); + child = create_default_render_node_with_bounds (&bounds); + } + result = gsk_stroke_node_new (child, path, stroke); gsk_path_unref (path); diff --git a/testsuite/gsk/nodeparser/empty-fill.ref.node b/testsuite/gsk/nodeparser/empty-fill.ref.node index 5840c61804..233a990899 100644 --- a/testsuite/gsk/nodeparser/empty-fill.ref.node +++ b/testsuite/gsk/nodeparser/empty-fill.ref.node @@ -1,6 +1,6 @@ fill { child: color { - bounds: 0 0 50 50; + bounds: 1.22359 0 47.5528 45.2254; color: rgb(255,0,204); } path: "\ diff --git a/testsuite/gsk/nodeparser/empty-stroke.ref.node b/testsuite/gsk/nodeparser/empty-stroke.ref.node index d49b2ce908..c32daa6885 100644 --- a/testsuite/gsk/nodeparser/empty-stroke.ref.node +++ b/testsuite/gsk/nodeparser/empty-stroke.ref.node @@ -1,6 +1,6 @@ stroke { child: color { - bounds: 0 0 50 50; + bounds: -2.77641 -4 55.5528 53.2254; color: rgb(255,0,204); } path: "\