From 989d170dc7318ca3cbaa5b76760eb14f4e6a8605 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Mon, 28 Nov 2022 12:40:16 +0100 Subject: Fragments --- library/src/shared/ext.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'library/src/shared') diff --git a/library/src/shared/ext.rs b/library/src/shared/ext.rs index f90260ad..54a1598a 100644 --- a/library/src/shared/ext.rs +++ b/library/src/shared/ext.rs @@ -99,22 +99,22 @@ struct FillNode { child: Content, } -#[node(LayoutBlock)] +#[node(Layout)] impl FillNode {} -impl LayoutBlock for FillNode { - fn layout_block( +impl Layout for FillNode { + fn layout( &self, world: Tracked, styles: StyleChain, regions: &Regions, - ) -> SourceResult> { - let mut frames = self.child.layout_block(world, styles, regions)?; - for frame in &mut frames { + ) -> SourceResult { + let mut fragment = self.child.layout(world, styles, regions)?; + for frame in &mut fragment { let shape = Geometry::Rect(frame.size()).filled(self.fill); frame.prepend(Point::zero(), Element::Shape(shape)); } - Ok(frames) + Ok(fragment) } } @@ -127,21 +127,21 @@ struct StrokeNode { child: Content, } -#[node(LayoutBlock)] +#[node(Layout)] impl StrokeNode {} -impl LayoutBlock for StrokeNode { - fn layout_block( +impl Layout for StrokeNode { + fn layout( &self, world: Tracked, styles: StyleChain, regions: &Regions, - ) -> SourceResult> { - let mut frames = self.child.layout_block(world, styles, regions)?; - for frame in &mut frames { + ) -> SourceResult { + let mut fragment = self.child.layout(world, styles, regions)?; + for frame in &mut fragment { let shape = Geometry::Rect(frame.size()).stroked(self.stroke); frame.prepend(Point::zero(), Element::Shape(shape)); } - Ok(frames) + Ok(fragment) } } -- cgit v1.2.3