Merge branch 'wip/otte/for-main' into 'main'

cssnode: Don't crash the inspector

See merge request GNOME/gtk!5595
This commit is contained in:
Benjamin Otte 2023-03-05 17:53:18 +00:00
commit 0fa1e71ef0
10 changed files with 43 additions and 4 deletions

View File

@ -507,9 +507,6 @@ gtk_css_node_real_node_removed (GtkCssNode *parent,
node->previous_sibling = NULL;
node->next_sibling = NULL;
node->parent = NULL;
if (parent->children_observer)
gtk_list_list_model_item_removed (parent->children_observer, previous);
}
static void
@ -715,6 +712,8 @@ gtk_css_node_reposition (GtkCssNode *node,
if (old_parent != NULL)
{
GTK_CSS_NODE_GET_CLASS (old_parent)->node_removed (old_parent, node, node->previous_sibling);
if (old_parent->children_observer && old_parent != new_parent)
gtk_list_list_model_item_removed (old_parent->children_observer, previous);
if (old_parent->first_child && node->visible)
gtk_css_node_invalidate (old_parent->first_child, GTK_CSS_CHANGE_NTH_LAST_CHILD);
}
@ -784,7 +783,7 @@ gtk_css_node_reposition (GtkCssNode *node,
if (new_parent && new_parent->children_observer)
{
if (old_previous)
if (old_previous && old_parent == new_parent)
gtk_list_list_model_item_moved (new_parent->children_observer, node, old_previous);
else
gtk_list_list_model_item_added (new_parent->children_observer, node);

View File

@ -142,6 +142,9 @@ endforeach
node_parser_tests = [
'blend.node',
'blend-unknown-mode.errors',
'blend-unknown-mode.node',
'blend-unknown-mode.ref.node',
'border.node',
'color.node',
'conic-gradient.node',
@ -201,6 +204,8 @@ node_parser_tests = [
'empty-text.ref.node',
'empty-texture.node',
'empty-texture.ref.node',
'empty-texture-scale.node',
'empty-texture-scale.ref.node',
'empty-transform.node',
'empty-transform.ref.node',
'glshader.node',
@ -229,6 +234,9 @@ node_parser_tests = [
'texture-fail.node',
'texture-fail.ref.node',
'texture-fail.ref.errors',
'texture-scale-unknown-filter.errors',
'texture-scale-unknown-filter.node',
'texture-scale-unknown-filter.ref.node',
'transform-fail.node',
'transform-fail.ref.node',
'transform-fail.errors',

View File

@ -0,0 +1 @@
<data>:2:9-13: error: GTK_CSS_PARSER_ERROR_SYNTAX

View File

@ -0,0 +1,3 @@
blend {
mode: diff;
}

View File

@ -0,0 +1,10 @@
blend {
bottom: color {
bounds: 0 0 50 50;
color: rgb(170,255,0);
}
top: color {
bounds: 0 0 50 50;
color: rgb(255,0,204);
}
}

View File

@ -0,0 +1,2 @@
texture-scale {
}

View File

@ -0,0 +1,6 @@
texture-scale {
bounds: 0 0 50 50;
texture: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAKUlEQVQYlWP8z3DmPwMaYGQwYUQX\
Y0IXwAUGUCGGoxkYGBiweXAoeAYAz44F3e3U1xUAAAAASUVORK5CYII=\
");
}

View File

@ -0,0 +1 @@
<data>:2:11-29: error: GTK_CSS_PARSER_ERROR_SYNTAX

View File

@ -0,0 +1,3 @@
texture-scale {
filter: guess-i-dont-exist;
}

View File

@ -0,0 +1,6 @@
texture-scale {
bounds: 0 0 50 50;
texture: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAKUlEQVQYlWP8z3DmPwMaYGQwYUQX\
Y0IXwAUGUCGGoxkYGBiweXAoeAYAz44F3e3U1xUAAAAASUVORK5CYII=\
");
}