This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch edje-vector-intergration
in repository efl.
View the commit online.
commit 65737ca09ec6d3864a1d7c4a565048ec206f2a12
Author: [email protected] <[email protected]>
AuthorDate: Tue Apr 28 12:14:16 2026 -0600
edje: add VG node parsing infrastructure (shape, container, gradient_linear, gradient_radial)
Teach edje_cc to parse the four sub-node block kinds inside a vector tree:
shape, container, gradient_linear, and gradient_radial. This commit lands
only the openers, the close-pop hook, and the dispatch-table entries that
enable container nesting up to four levels deep. Properties (name, color,
path, fill, stroke, etc.) are deferred to Tasks 2.5-2.7 so each property
family reviews independently.
The two macros VG_NODE_OPENERS and VG_NODE_NESTED_AT keep the 32-entry
dispatch-table additions tractable: 4 node kinds × 4 nesting depths ×
2 path prefixes. The 4-level nesting cap is documented inline for future
maintainers. Runtime defense-in-depth: _vg_open_node aborts if a shape or
gradient tries to nest inside a non-container node; the dispatcher rejects
unregistered paths first. Current_vg_node_stack lazy-allocates so this is
safe even if invoked outside the normal ob_vectors_vector path.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
---
src/bin/edje/edje_cc_handlers.c | 132 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 132 insertions(+)
diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c
index 2f928768e1..60f320ebad 100644
--- a/src/bin/edje/edje_cc_handlers.c
+++ b/src/bin/edje/edje_cc_handlers.c
@@ -283,6 +283,12 @@ static void ob_vectors_vector(void);
static void st_vectors_vector_name(void);
static void st_vectors_vector_viewbox(void);
static void _vg_tree_block_end(void);
+static void _vg_open_node(Edje_Vg_Node_Type type);
+static void ob_vg_shape(void);
+static void ob_vg_container(void);
+static void ob_vg_gradient_linear(void);
+static void ob_vg_gradient_radial(void);
+static void _vg_close_node(void);
static void ob_filters_filter(void);
static void ob_filters_filter_script(void);
@@ -1498,6 +1504,96 @@ st_vectors_vector_viewbox(void)
current_vg_tree->vbh = parse_float(3);
}
+/**
+ @page edcref
+
+ @block
+ shape
+ @context
+ vector {
+ shape { }
+ container {
+ shape { }
+ }
+ }
+ @description
+ A leaf node that renders a filled/stroked path. Must appear directly
+ inside a vector tree root or a container block. Node properties
+ (name, color, path, fill, stroke) are added in subsequent tasks.
+ @endblock
+
+ @block
+ container
+ @context
+ vector {
+ container {
+ shape { }
+ container { }
+ gradient_linear { }
+ }
+ }
+ @description
+ A grouping node that holds an ordered list of child nodes. Children
+ may be shapes, gradients, or nested containers. Up to four levels of
+ nesting are supported. Transform and visibility properties apply to
+ all children.
+ @endblock
+
+ @block
+ gradient_linear
+ @context
+ vector {
+ gradient_linear { }
+ }
+ @description
+ A named linear gradient node. Defines a gradient resource that can
+ be referenced by a shape's fill.gradient property. Geometry (start,
+ end) and color stops are added in Task 2.7.
+ @endblock
+
+ @block
+ gradient_radial
+ @context
+ vector {
+ gradient_radial { }
+ }
+ @description
+ A named radial gradient node. Defines a gradient resource that can
+ be referenced by a shape's fill.gradient property. Geometry (center,
+ focal, radius) and color stops are added in Task 2.7.
+ @endblock
+ */
+
+static void
+_vg_open_node(Edje_Vg_Node_Type type)
+{
+ if (!current_vg_node)
+ error_and_abort(NULL, "shape/container/gradient outside vector tree");
+ if (current_vg_node->type != EDJE_VG_NODE_CONTAINER)
+ error_and_abort(NULL, "Cannot nest a node inside a non-container");
+ Edje_Vg_Node *n = _edje_vg_node_new(type);
+ if (!n) error_and_abort(NULL, "OOM allocating vector node");
+ _edje_vg_container_append(current_vg_node, n);
+ if (!current_vg_node_stack)
+ current_vg_node_stack = eina_array_new(8);
+ eina_array_push(current_vg_node_stack, current_vg_node);
+ current_vg_node = n;
+}
+
+static void ob_vg_shape(void) { _vg_open_node(EDJE_VG_NODE_SHAPE); }
+static void ob_vg_container(void) { _vg_open_node(EDJE_VG_NODE_CONTAINER); }
+static void ob_vg_gradient_linear(void) { _vg_open_node(EDJE_VG_NODE_GRADIENT_LINEAR); }
+static void ob_vg_gradient_radial(void) { _vg_open_node(EDJE_VG_NODE_GRADIENT_RADIAL); }
+
+static void
+_vg_close_node(void)
+{
+ if (current_vg_node_stack && eina_array_count(current_vg_node_stack) > 0)
+ current_vg_node = eina_array_pop(current_vg_node_stack);
+ else
+ current_vg_node = current_vg_tree ? current_vg_tree->root : NULL;
+}
+
#define PROGRAM_OBJECTS(PREFIX) \
{PREFIX ".program", ob_collections_group_programs_program}, /* dup */ \
{PREFIX ".program.script", ob_collections_group_programs_program_script}, /* dup */ \
@@ -1517,6 +1613,14 @@ st_vectors_vector_viewbox(void)
{PREFIX ".programs.script", ob_collections_group_script}, /* dup */ \
{PREFIX ".script", ob_collections_group_script}, /* dup */
+/* Expands to the four node-kind opener entries for a given path prefix.
+ * Used at every nesting depth so the parser dispatches correctly. */
+#define VG_NODE_OPENERS(PFX) \
+ {PFX "shape", ob_vg_shape}, /* dup */ \
+ {PFX "container", ob_vg_container}, /* dup */ \
+ {PFX "gradient_linear", ob_vg_gradient_linear}, /* dup */ \
+ {PFX "gradient_radial", ob_vg_gradient_radial}, /* dup */
+
New_Object_Handler object_handlers[] =
{
{"externals", NULL},
@@ -1532,6 +1636,11 @@ New_Object_Handler object_handlers[] =
{"color_classes.color_class", ob_color_class},
{"vectors", NULL},
{"vectors.vector", ob_vectors_vector},
+ /* 4-level container nesting cap; add another VG_NODE_OPENERS row to extend. */
+ VG_NODE_OPENERS("vectors.vector.")
+ VG_NODE_OPENERS("vectors.vector.container.")
+ VG_NODE_OPENERS("vectors.vector.container.container.")
+ VG_NODE_OPENERS("vectors.vector.container.container.container.")
{"text_classes", NULL},
{"text_classes.text_class", ob_text_class},
{"size_classes", NULL},
@@ -1555,6 +1664,11 @@ New_Object_Handler object_handlers[] =
{"collections.color_classes.color_class", ob_color_class}, /* dup */
{"collections.vectors", NULL}, /* dup */
{"collections.vectors.vector", ob_vectors_vector}, /* dup */
+ /* 4-level container nesting cap; add another VG_NODE_OPENERS row to extend. */
+ VG_NODE_OPENERS("collections.vectors.vector.")
+ VG_NODE_OPENERS("collections.vectors.vector.container.")
+ VG_NODE_OPENERS("collections.vectors.vector.container.container.")
+ VG_NODE_OPENERS("collections.vectors.vector.container.container.container.")
{"collections.text_classes", NULL},
{"collections.text_classes.text_class", ob_text_class}, /* dup */
{"collections.size_classes", NULL}, /* dup */
@@ -1742,10 +1856,28 @@ New_Object_Handler object_handlers_short[] =
{"collections.group.parts.vector", ob_collections_group_parts_part_short},
};
+/* Expands to the four node-kind close-pop entries for a given parent path.
+ * Fires _vg_close_node when any node block ends, restoring current_vg_node. */
+#define VG_NODE_NESTED_AT(PARENT) \
+ {PARENT, "shape", NULL, _vg_close_node}, \
+ {PARENT, "container", NULL, _vg_close_node}, \
+ {PARENT, "gradient_linear", NULL, _vg_close_node}, \
+ {PARENT, "gradient_radial", NULL, _vg_close_node},
+
New_Nested_Handler nested_handlers[] = {
{"collections.group.parts", "part", NULL, edje_cc_handlers_hierarchy_pop },
{"collections.vectors", "vector", NULL, _vg_tree_block_end },
{"vectors", "vector", NULL, _vg_tree_block_end },
+ /* 4-level nesting cap mirrors VG_NODE_OPENERS. */
+ VG_NODE_NESTED_AT("vectors.vector")
+ VG_NODE_NESTED_AT("vectors.vector.container")
+ VG_NODE_NESTED_AT("vectors.vector.container.container")
+ VG_NODE_NESTED_AT("vectors.vector.container.container.container")
+ /* 4-level nesting cap mirrors VG_NODE_OPENERS. */
+ VG_NODE_NESTED_AT("collections.vectors.vector")
+ VG_NODE_NESTED_AT("collections.vectors.vector.container")
+ VG_NODE_NESTED_AT("collections.vectors.vector.container.container")
+ VG_NODE_NESTED_AT("collections.vectors.vector.container.container.container")
};
New_Nested_Handler nested_handlers_short[] = {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.