fix SVG group clipPath importing#4338
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements support for importing SVG group clip paths as hidden clipping masks in Graphite. It introduces helper functions to traverse and import clip paths, updates the import logic to return an ImportedNode struct containing both the layer identifier and its vertical extent, and adds a comprehensive test suite. The feedback suggests ensuring that strokes defined on <clipPath> elements or their children are ignored or disabled during import, as they should not be rendered according to the SVG specification.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| // Fill opacity hides the clip geometry during normal rendering but is intentionally ignored | ||
| // by the renderer's mask pass, leaving the geometry fully opaque as a stencil. | ||
| modify_inputs.opacity_fill_set(0.); |
There was a problem hiding this comment.
In the SVG specification, any stroke defined on a <clipPath> or its child geometries is ignored for clipping purposes and must not be rendered. Currently, import_usvg_clip_path only sets the fill opacity to 0 via modify_inputs.opacity_fill_set(0.). If any of the geometries inside the clip path have a stroke defined, those strokes will still be imported and rendered during normal rendering, creating a visual discrepancy. Consider passing a flag or context during the clip path children import traversal to ignore or disable strokes on any imported clip path geometries.
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Confidence score: 5/5
- Safe to merge after the addressed issues were fixed.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Title
Fix SVG group clipPath importing
Description
Preserves clipPath clipping when importing SVG groups by connecting the importer to
Graphite’s existing clipping-mask system.
Fixes #4331