summaryrefslogtreecommitdiff
path: root/src/library/page.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-01-17 16:01:01 +0100
committerLaurenz <laurmaedje@gmail.com>2022-01-17 16:01:01 +0100
commit0c5243fa802d8133d75c0823c3efa6f14794ba60 (patch)
treee8554c25aa9d5c3ec33c9b4d6de56f1c97d30eff /src/library/page.rs
parent4abdafcd158ab15d9d2ae18553067578ae559d33 (diff)
Basic tables
Diffstat (limited to 'src/library/page.rs')
-rw-r--r--src/library/page.rs21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/library/page.rs b/src/library/page.rs
index e2c27a36..f3a287dc 100644
--- a/src/library/page.rs
+++ b/src/library/page.rs
@@ -98,27 +98,22 @@ impl PageNode {
child = ColumnsNode { columns, child: self.0.clone() }.pack();
}
- // Realize margins with padding node.
+ // Realize margins.
child = child.padded(padding);
+ // Realize background fill.
+ if let Some(fill) = styles.get(Self::FILL) {
+ child = child.filled(fill);
+ }
+
// Layout the child.
let expand = size.map(Length::is_finite);
let regions = Regions::repeat(size, size, expand);
- let mut frames: Vec<_> = child
+ child
.layout(ctx, &regions, styles)
.into_iter()
.map(|c| c.item)
- .collect();
-
- // Add background fill if requested.
- if let Some(fill) = styles.get(Self::FILL) {
- for frame in &mut frames {
- let shape = Shape::filled(Geometry::Rect(frame.size), fill);
- Rc::make_mut(frame).prepend(Point::zero(), Element::Shape(shape));
- }
- }
-
- frames
+ .collect()
}
}