Bug 1848407 - Ensure that zero-height block frame lines will be placed on the next page when break-after: page is set. r=dholbert

Differential Revision: https://phabricator.services.mozilla.com/D186061
This commit is contained in:
Emily McDonough 2023-08-17 17:05:15 +00:00
parent 995979d9d0
commit dbc26c185f
5 changed files with 91 additions and 0 deletions

View File

@ -3761,6 +3761,18 @@ void nsBlockFrame::ReflowBlockFrame(BlockReflowState& aState,
return; return;
} }
// If the previous frame was a page-break-frame, then preemptively push this
// frame to the next page.
// This is primarily important for the placeholders for abspos frames, which
// measure as zero height and then would be placed on this page.
if (aState.ContentBSize() != NS_UNCONSTRAINEDSIZE) {
const nsIFrame* const prev = frame->GetPrevSibling();
if (prev && prev->IsPageBreakFrame()) {
PushTruncatedLine(aState, aLine, aKeepReflowGoing);
return;
}
}
// Prepare the block reflow engine // Prepare the block reflow engine
nsBlockReflowContext brc(aState.mPresContext, aState.mReflowInput); nsBlockReflowContext brc(aState.mPresContext, aState.mReflowInput);

View File

@ -0,0 +1,25 @@
<!DOCTYPE html>
<html>
<title>Absolute position frame inside 'overflow: hidden' immediately after a forced page break</title>
<link rel="author" title="Emily McDonough" href="mailto:emcdonough@mozilla.com"/>
<style>
.inner {
box-sizing: border-box;
width: 100%;
}
.outer {
break-after: page;
width: 100vw;
height: 100vh;
}
html, body { margin: 0; }
</style>
<body>
<div class="outer">
<div class="inner" style="border: 3px solid blue">111</div>
</div>
<div class="outer">
<div class="inner" style="border: 3px solid black">222</div>
</div>
</body>
</html>

View File

@ -0,0 +1,31 @@
<!DOCTYPE html>
<html>
<title>Absolute position frame inside 'overflow: hidden' immediately after a forced page break</title>
<link rel="author" title="Emily McDonough" href="mailto:emcdonough@mozilla.com"/>
<link rel="match" href="abspos-overflow-hidden-001-print-ref.html"/>
<link rel="help" href="https://www.w3.org/TR/css-break-3/#page-break-values"/>
<meta name="assert" content="An abspos box after a forced pagebreak and inside 'overflow:hidden' should be visible on the next page"/>
<style>
.inner {
position: absolute;
box-sizing: border-box;
width: 100%;
}
.outer {
overflow: hidden;
position: relative;
break-after: page;
width: 100vw;
height: 100vh;
}
html, body { margin: 0; }
</style>
<body>
<div class="outer">
<div class="inner" style="border: 3px solid blue">111</div>
</div>
<div class="outer">
<div class="inner" style="border: 3px solid black">222</div>
</div>
</body>
</html>

View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<title>Zero height box immediately after a forced page-break</title>
<link rel="author" title="Emily McDonough" href="mailto:emcdonough@mozilla.com"/>
<body>
<div style="break-after: page; height: 100%">Page 1</div>
<div style="height: 1in"></div>
</body>
</html>

View File

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html>
<title>Zero height box immediately after a forced page-break</title>
<link rel="author" title="Emily McDonough" href="mailto:emcdonough@mozilla.com"/>
<link rel="match" href="zero-height-page-break-001-print-ref.html"/>
<link rel="help" href="https://www.w3.org/TR/css-break-3/#page-break-values"/>
<meta name="assert" content="Ensures that a zero-height frame after a forced page-break appears on the following page."/>
<!-- This will cause a failure of there is only one page, regardless of matching the ref -->
<meta name="reftest-pages" content="1,2"/>
<body>
<div style="break-after: page; height: 100%">Page 1</div>
<div></div>
</body>
</html>