summaryrefslogtreecommitdiff
path: root/src/layout/par.rs
diff options
context:
space:
mode:
authorMartin Haug <mhaug@live.de>2021-06-27 18:06:39 +0200
committerMartin Haug <mhaug@live.de>2021-06-27 18:06:39 +0200
commit9bd8b7ddac046f581dc750e148147901d08cb0f4 (patch)
tree0e7a39d25fe2bcccc7625568548759b330b48008 /src/layout/par.rs
parent57bd3e23c79878d106ab8be17c71caca6c4f5a7c (diff)
Code review, new stack test
Diffstat (limited to 'src/layout/par.rs')
-rw-r--r--src/layout/par.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/layout/par.rs b/src/layout/par.rs
index 40cb84f2..504981e6 100644
--- a/src/layout/par.rs
+++ b/src/layout/par.rs
@@ -190,6 +190,7 @@ impl<'a> ParLayouter<'a> {
// line cannot be broken up further.
if !stack.regions.current.fits(line.size) {
if let Some((last_line, last_end)) = last.take() {
+ // The region must not fit this line for the result to be valid.
if !stack.regions.current.width.fits(line.size.width) {
stack.constraints.max.horizontal.set_min(line.size.width);
}
@@ -213,6 +214,9 @@ impl<'a> ParLayouter<'a> {
while !stack.regions.current.height.fits(line.size.height)
&& !stack.regions.in_full_last()
{
+ // Again, the line must not fit. It would if the space taken up
+ // plus the line height would fit, therefore the constraint
+ // below.
stack.constraints.max.vertical.set_min(
stack.full.height - stack.regions.current.height + line.size.height,
);
@@ -225,7 +229,7 @@ impl<'a> ParLayouter<'a> {
stack.overflowing = true;
break;
}
-
+
stack.constraints.max.vertical.set_min(
stack.full.height - stack.regions.current.height + line.size.height,
);