From 79638d4bbdc140a8dca0ccfdf70ffd607d5da251 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 16 Nov 2021 12:47:14 +0100 Subject: Don't wrap already layoutable nodes into flows/pars unnecessarily --- src/library/sized.rs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'src/library/sized.rs') diff --git a/src/library/sized.rs b/src/library/sized.rs index 631f9e6f..686d79b9 100644 --- a/src/library/sized.rs +++ b/src/library/sized.rs @@ -6,14 +6,11 @@ pub fn box_(_: &mut EvalContext, args: &mut Args) -> TypResult { let height = args.named("height")?; let body: Template = args.find().unwrap_or_default(); Ok(Value::Template(Template::from_inline(move |style| { - let flow = body.to_flow(style).pack(); + let child = body.pack(style); if width.is_some() || height.is_some() { - Layout::pack(SizedNode { - sizing: Spec::new(width, height), - child: flow, - }) + Layout::pack(SizedNode { sizing: Spec::new(width, height), child }) } else { - flow + child } }))) } @@ -24,14 +21,11 @@ pub fn block(_: &mut EvalContext, args: &mut Args) -> TypResult { let height = args.named("height")?; let body: Template = args.find().unwrap_or_default(); Ok(Value::Template(Template::from_block(move |style| { - let flow = body.to_flow(style).pack(); + let child = body.pack(style); if width.is_some() || height.is_some() { - Layout::pack(SizedNode { - sizing: Spec::new(width, height), - child: flow, - }) + Layout::pack(SizedNode { sizing: Spec::new(width, height), child }) } else { - flow + child } }))) } -- cgit v1.2.3