summaryrefslogtreecommitdiff
path: root/src/library/sized.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/library/sized.rs')
-rw-r--r--src/library/sized.rs18
1 files changed, 6 insertions, 12 deletions
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<Value> {
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<Value> {
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
}
})))
}