summaryrefslogtreecommitdiff
path: root/src/layout/fixed.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-03-11 10:48:29 +0100
committerLaurenz <laurmaedje@gmail.com>2021-03-11 10:48:29 +0100
commitc1b1dbcc0925ba1730fabbfbca3c8b99831c5561 (patch)
tree6e4cb30753729c699bd899a7f2ec352e276beee8 /src/layout/fixed.rs
parent4e5f85aa4ac0d6b51323bb2a6e1fbd3f4f46babb (diff)
Better expansion behaviour 🐪
This makes expansion behaviour inheritable by placing it into the area and passing it down during layouting instead of computing some approximation of what we want during execution.
Diffstat (limited to 'src/layout/fixed.rs')
-rw-r--r--src/layout/fixed.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/layout/fixed.rs b/src/layout/fixed.rs
index 60dbe4d6..a9554a07 100644
--- a/src/layout/fixed.rs
+++ b/src/layout/fixed.rs
@@ -20,7 +20,13 @@ impl Layout for NodeFixed {
self.height.map(|h| h.resolve(full.height)).unwrap_or(current.height),
);
- let areas = Areas::once(size);
+ let fill_if = |cond| if cond { Expand::Fill } else { Expand::Fit };
+ let expand = Spec::new(
+ fill_if(self.width.is_some()),
+ fill_if(self.height.is_some()),
+ );
+
+ let areas = Areas::once(size, expand);
self.child.layout(ctx, &areas)
}
}