nodeparser: Change the serialization

Arrange things so that non-child parameters
are always printed before the children. This
greatly helps with readability, which really
suffers when there's hundreds of lines of indented
children between the node start and its parameters.

Update all affected tests.
This commit is contained in:
Matthias Clasen 2021-04-02 20:36:58 -04:00
parent f2edf40e48
commit efb5e793a4
12 changed files with 3480 additions and 32 deletions

View File

@ -2439,9 +2439,9 @@ render_node_print (Printer *p,
{
start_node (p, "cross-fade");
append_node_param (p, "end", gsk_cross_fade_node_get_end_child (node));
append_float_param (p, "progress", gsk_cross_fade_node_get_progress (node), 0.5f);
append_node_param (p, "start", gsk_cross_fade_node_get_start_child (node));
append_node_param (p, "end", gsk_cross_fade_node_get_end_child (node));
end_node (p);
}
@ -2456,8 +2456,8 @@ render_node_print (Printer *p,
start_node (p, "linear-gradient");
append_rect_param (p, "bounds", &node->bounds);
append_point_param (p, "end", gsk_linear_gradient_node_get_end (node));
append_point_param (p, "start", gsk_linear_gradient_node_get_start (node));
append_point_param (p, "end", gsk_linear_gradient_node_get_end (node));
append_stops_param (p, "stops", gsk_linear_gradient_node_get_color_stops (node, NULL),
gsk_linear_gradient_node_get_n_color_stops (node));
@ -2506,8 +2506,8 @@ render_node_print (Printer *p,
{
start_node (p, "opacity");
append_node_param (p, "child", gsk_opacity_node_get_child (node));
append_float_param (p, "opacity", gsk_opacity_node_get_opacity (node), 0.5f);
append_node_param (p, "child", gsk_opacity_node_get_child (node));
end_node (p);
}
@ -2535,8 +2535,8 @@ render_node_print (Printer *p,
{
start_node (p, "clip");
append_node_param (p, "child", gsk_clip_node_get_child (node));
append_rect_param (p, "clip", gsk_clip_node_get_clip (node));
append_node_param (p, "child", gsk_clip_node_get_child (node));
end_node (p);
}
@ -2546,8 +2546,8 @@ render_node_print (Printer *p,
{
start_node (p, "rounded-clip");
append_node_param (p, "child", gsk_rounded_clip_node_get_child (node));
append_rounded_rect_param (p, "clip", gsk_rounded_clip_node_get_clip (node));
append_node_param (p, "child", gsk_rounded_clip_node_get_child (node));
end_node (p);
@ -2559,9 +2559,9 @@ render_node_print (Printer *p,
GskTransform *transform = gsk_transform_node_get_transform (node);
start_node (p, "transform");
append_node_param (p, "child", gsk_transform_node_get_child (node));
if (gsk_transform_get_category (transform) != GSK_TRANSFORM_CATEGORY_IDENTITY)
append_transform_param (p, "transform", transform);
append_node_param (p, "child", gsk_transform_node_get_child (node));
end_node (p);
}
@ -2571,11 +2571,11 @@ render_node_print (Printer *p,
{
start_node (p, "color-matrix");
append_node_param (p, "child", gsk_color_matrix_node_get_child (node));
if (!graphene_matrix_is_identity (gsk_color_matrix_node_get_color_matrix (node)))
append_matrix_param (p, "matrix", gsk_color_matrix_node_get_color_matrix (node));
if (!graphene_vec4_equal (gsk_color_matrix_node_get_color_offset (node), graphene_vec4_zero ()))
append_vec4_param (p, "offset", gsk_color_matrix_node_get_color_offset (node));
append_node_param (p, "child", gsk_color_matrix_node_get_child (node));
end_node (p);
}
@ -2649,8 +2649,6 @@ render_node_print (Printer *p,
start_node (p, "shadow");
append_node_param (p, "child", gsk_shadow_node_get_child (node));
_indent (p);
g_string_append (p->str, "shadows: ");
for (i = 0; i < n_shadows; i ++)
@ -2678,6 +2676,7 @@ render_node_print (Printer *p,
g_string_append_c (p->str, ';');
g_string_append_c (p->str, '\n');
append_node_param (p, "child", gsk_shadow_node_get_child (node));
end_node (p);
}
@ -2917,9 +2916,9 @@ render_node_print (Printer *p,
if (!graphene_rect_equal (&node->bounds, &child->bounds))
append_rect_param (p, "bounds", &node->bounds);
append_node_param (p, "child", gsk_repeat_node_get_child (node));
if (!graphene_rect_equal (child_bounds, &child->bounds))
append_rect_param (p, "child-bounds", child_bounds);
append_node_param (p, "child", gsk_repeat_node_get_child (node));
end_node (p);
}
@ -2932,8 +2931,6 @@ render_node_print (Printer *p,
start_node (p, "blend");
append_node_param (p, "bottom", gsk_blend_node_get_bottom_child (node));
if (mode != GSK_BLEND_MODE_DEFAULT)
{
_indent (p);
@ -2946,6 +2943,7 @@ render_node_print (Printer *p,
}
}
}
append_node_param (p, "bottom", gsk_blend_node_get_bottom_child (node));
append_node_param (p, "top", gsk_blend_node_get_top_child (node));
end_node (p);

View File

@ -5,18 +5,18 @@ blend {
}
}
blend {
bottom: container {
}
mode: color-dodge;
bottom: container {
}
top: container {
}
}
blend {
mode: difference;
bottom: color {
bounds: 0 0 50 50;
color: rgb(255,0,204);
}
mode: difference;
top: color {
bounds: 0 0 50 50;
color: rgb(255,0,204);

View File

@ -1,10 +1,10 @@
cross-fade {
end: color {
bounds: 0 0 50 50;
color: rgb(255,0,204);
}
start: color {
bounds: 0 0 50 50;
color: rgb(170,255,0);
}
end: color {
bounds: 0 0 50 50;
color: rgb(255,0,204);
}
}

View File

@ -1,8 +1,4 @@
cross-fade {
end: color {
bounds: 5 5 10 10;
color: rgb(0,0,255);
}
progress: 0.2;
start: container {
color {
@ -14,4 +10,8 @@ cross-fade {
color: rgb(0,128,0);
}
}
end: color {
bounds: 5 5 10 10;
color: rgb(0,0,255);
}
}

View File

@ -1,7 +1,7 @@
clip {
clip: 0 0 50 50;
child: color {
bounds: 0 0 50 50;
color: rgb(255,0,204);
}
clip: 0 0 50 50;
}

View File

@ -1,10 +1,10 @@
cross-fade {
end: color {
bounds: 0 0 50 50;
color: rgb(255,0,204);
}
start: color {
bounds: 0 0 50 50;
color: rgb(170,255,0);
}
end: color {
bounds: 0 0 50 50;
color: rgb(255,0,204);
}
}

View File

@ -1,6 +1,6 @@
linear-gradient {
bounds: 0 0 50 50;
end: 0 50;
start: 0 0;
end: 0 50;
stops: 0 rgb(170,255,0), 1 rgb(255,0,204);
}

View File

@ -1,7 +1,7 @@
rounded-clip {
clip: 0 0 50 50;
child: color {
bounds: 0 0 50 50;
color: rgb(255,0,204);
}
clip: 0 0 50 50;
}

View File

@ -1,7 +1,7 @@
shadow {
shadows: rgb(0,0,0) 1 1;
child: color {
bounds: 0 0 50 50;
color: rgb(255,0,204);
}
shadows: rgb(0,0,0) 1 1;
}

View File

@ -1,7 +1,7 @@
shadow {
shadows: rgb(255,0,0) 10 10 4, rgb(0,0,255) -10 -10 8;
child: color {
bounds: 100 100 100 100;
color: rgb(0,128,0);
}
shadows: rgb(255,0,0) 10 10 4, rgb(0,0,255) -10 -10 8;
}

View File

@ -0,0 +1,320 @@
color {
bounds: 0 0 404 204;
color: rgb(246,245,244);
}
container {
container {
transform {
transform: translate(1, 1);
child: container {
rounded-clip {
clip: -1 -1 50 26 / 13;
child: color {
bounds: -1 -1 50 26;
color: rgb(225,222,219);
}
}
border {
colors: rgb(205,199,194);
outline: -1 -1 50 26 / 13;
}
container {
container {
outset-shadow {
color: rgba(0,0,0,0.1);
dx: 0;
outline: -1 -1 26 26 / 13;
}
outset-shadow {
blur: 2;
color: rgba(0,0,0,0.07);
dx: 0;
outline: -1 -1 26 26 / 13;
}
rounded-clip {
clip: -1 -1 26 26 / 13;
child: linear-gradient {
bounds: 0 0 24 24;
start: 12 0;
end: 12 24;
stops: 0.2 rgb(255,255,255), 0.9 rgb(246,245,244);
}
}
inset-shadow {
color: rgb(255,255,255);
dx: 0;
outline: 0 0 24 24 / 12;
}
}
border {
colors: rgb(191,184,177);
outline: -1 -1 26 26 / 13;
}
}
}
}
transform {
transform: translate(56, 0);
child: text {
color: rgb(46,52,54);
font: "Cantarell 11";
glyphs: "Disabled";
offset: 145 18;
}
}
}
transform {
transform: translate(0, 38);
child: container {
transform {
transform: translate(1, 1);
child: container {
rounded-clip {
clip: -1 -1 50 26 / 13;
child: color {
bounds: -1 -1 50 26;
color: rgb(53,132,228);
}
}
border {
colors: rgb(24,95,180);
outline: -1 -1 50 26 / 13;
}
transform {
transform: translate(24, 0);
child: container {
container {
outset-shadow {
color: rgba(0,0,0,0.1);
dx: 0;
outline: -1 -1 26 26 / 13;
}
outset-shadow {
blur: 2;
color: rgba(0,0,0,0.07);
dx: 0;
outline: -1 -1 26 26 / 13;
}
rounded-clip {
clip: -1 -1 26 26 / 13;
child: linear-gradient {
bounds: 0 0 24 24;
start: 12 0;
end: 12 24;
stops: 0.2 rgb(255,255,255), 0.9 rgb(246,245,244);
}
}
inset-shadow {
color: rgb(255,255,255);
dx: 0;
outline: 0 0 24 24 / 12;
}
}
border {
colors: rgb(24,95,180);
outline: -1 -1 26 26 / 13;
}
}
}
}
}
transform {
transform: translate(56, 0);
child: text {
color: rgb(46,52,54);
font: "Cantarell 11";
glyphs: "Enabled";
offset: 147 18;
}
}
}
}
transform {
transform: translate(0, 76);
child: container {
transform {
transform: translate(1, 1);
child: container {
rounded-clip {
clip: -1 -1 50 26 / 13;
child: color {
bounds: -1 -1 50 26;
color: rgb(250,249,248);
}
}
border {
colors: rgb(205,199,194);
outline: -1 -1 50 26 / 13;
}
container {
rounded-clip {
clip: -1 -1 26 26 / 13;
child: color {
bounds: 0 0 24 24;
color: rgb(250,249,248);
}
}
border {
colors: rgb(205,199,194);
outline: -1 -1 26 26 / 13;
}
}
}
}
transform {
transform: translate(56, 0);
child: text {
color: rgb(46,52,54);
font: "Cantarell 11";
glyphs: "Disabled";
offset: 145 18;
}
}
}
}
transform {
transform: translate(0, 114);
child: container {
transform {
transform: translate(1, 1);
child: container {
rounded-clip {
clip: -1 -1 50 26 / 13;
child: color {
bounds: -1 -1 50 26;
color: rgb(250,249,248);
}
}
border {
colors: rgb(205,199,194);
outline: -1 -1 50 26 / 13;
}
transform {
transform: translate(24, 0);
child: container {
rounded-clip {
clip: -1 -1 26 26 / 13;
child: color {
bounds: 0 0 24 24;
color: rgb(250,249,248);
}
}
border {
colors: rgb(205,199,194);
outline: -1 -1 26 26 / 13;
}
}
}
}
}
transform {
transform: translate(56, 0);
child: text {
color: rgb(46,52,54);
font: "Cantarell 11";
glyphs: "Enabled";
offset: 147 18;
}
}
}
}
transform {
transform: translate(0, 152);
child: container {
transform {
transform: translate(1, 1);
child: container {
rounded-clip {
clip: -1 -1 50 26 / 13;
child: color {
bounds: -1 -1 50 26;
color: rgb(225,222,219);
}
}
border {
colors: rgb(205,199,194);
outline: -1 -1 50 26 / 13;
}
container {
container {
outset-shadow {
color: rgba(0,0,0,0.1);
dx: 0;
outline: -1 -1 26 26 / 13;
}
outset-shadow {
blur: 2;
color: rgba(0,0,0,0.07);
dx: 0;
outline: -1 -1 26 26 / 13;
}
rounded-clip {
clip: -1 -1 26 26 / 13;
child: linear-gradient {
bounds: 0 0 24 24;
start: 12 0;
end: 12 24;
stops: 0.2 rgb(255,255,255), 0.9 rgb(246,245,244);
}
}
inset-shadow {
color: rgb(255,255,255);
dx: 0;
outline: 0 0 24 24 / 12;
}
}
border {
colors: rgb(191,184,177);
outline: -1 -1 26 26 / 13;
}
}
}
}
transform {
transform: translate(78, 0);
child: text {
color: rgb(46,52,54);
font: "Cantarell 11";
glyphs: "Disabled";
offset: 123 18;
}
}
transform {
transform: translate(388, 0);
child: transform {
transform: translate(1, 6);
child: container {
container {
outset-shadow {
color: rgba(0,0,0,0.1);
dx: 0;
outline: -1 -1 16 16 / 3;
}
outset-shadow {
blur: 2;
color: rgba(0,0,0,0.07);
dx: 0;
outline: -1 -1 16 16 / 3;
}
linear-gradient {
bounds: 0 0 14 14;
start: 7 0;
end: 7 14;
stops: 0.2 rgb(255,255,255), 0.9 rgb(246,245,244);
}
inset-shadow {
color: rgb(255,255,255);
dx: 0;
outline: 0 0 14 14 / 2;
}
}
border {
colors: rgb(191,184,177);
outline: -1 -1 16 16 / 3;
}
}
}
}
}
}
}

File diff suppressed because it is too large Load Diff