Add rank-0 Item leaf variants to the Graphic enum alongside its List variants (#4437)

* Add the rank-0 Item leaf variants to the Graphic enum, rendering leaves and list rows through shared per-row logic

* Traverse the rank-0 Graphic leaf variants in the vector node helpers and flattening

* Reach rank-0 vector graphics from the styling and gradient-fitting helpers

* Two code review fixes

* Fix comment
This commit is contained in:
Keavon Chambers
2026-08-16 02:24:15 -07:00
committed by GitHub
parent ba7cbd83bc
commit c507b35645
13 changed files with 2412 additions and 1665 deletions
+9 -3
View File
@@ -934,10 +934,10 @@ pub async fn wrap_graphic<T: Into<Graphic> + 'n>(
_: impl Ctx,
#[implementations(
List<Graphic>,
List<Vector>,
List<Vector>,
List<Raster<CPU>>,
List<Raster<GPU>>,
List<Color>,
List<Raster<GPU>>,
List<Color>,
List<Gradient>,
List<String>,
Item<DAffine2>,
@@ -981,6 +981,12 @@ pub async fn flatten_graphic(_: impl Ctx, content: List<Graphic>, fully_flatten:
let recurse = fully_flatten || recursion_depth == 0;
// A boxed single graphic is the rank-0 spelling of the same nesting, so it flattens through the list path
let current_element = match current_element {
Graphic::Graphic(item) if recurse => Graphic::GraphicList(List::new_from_item(*item)),
element => element,
};
match current_element {
// If we're allowed to recurse, flatten any graphics we encounter
Graphic::GraphicList(mut current_element) if recurse => {