summaryrefslogtreecommitdiff
path: root/src/library/sized.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-11-16 12:47:14 +0100
committerLaurenz <laurmaedje@gmail.com>2021-11-16 12:47:14 +0100
commit79638d4bbdc140a8dca0ccfdf70ffd607d5da251 (patch)
tree3da8a7d345ccac389d07c8327d9c63fd7209a250 /src/library/sized.rs
parent73c4701749ac3919c5b845002052326502c67306 (diff)
Don't wrap already layoutable nodes into flows/pars unnecessarily
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
}
})))
}