Bug 1865172 Part 1 - Always store a page name value when a breakpoint is first found during block reflow. r=dholbert

This happens in a similar location to where we find a breakpoint caused by a
change in page name. However, if the breakpoint was caused by something else,
we still need to compute this value so that the next page being constructed
will have the correct page name.

This also "fixes" the WPT /css/printing/page-name-007-print.html, which passed
before this patch just because our previous logic would continue using the last
page value in those cases, which coincidentally matched what was expected.

Part 2 will include a test that specifically detects this discrepency.

Differential Revision: https://phabricator.services.mozilla.com/D196895
This commit is contained in:
Emily McDonough
2024-02-23 22:34:37 +00:00
parent f02cf598f7
commit fee7314f2a
6 changed files with 85 additions and 10 deletions

View File

@@ -8042,6 +8042,20 @@ nsIFrame* nsCSSFrameConstructor::CreateContinuingFrame(
return newFrame;
}
void nsCSSFrameConstructor::MaybeSetNextPageContentFramePageName(
const nsIFrame* aFrame) {
MOZ_ASSERT(aFrame, "Frame should not be null");
// No parent means the root frame, which isn't what this funciton is for.
MOZ_ASSERT(aFrame->GetParent(),
"Frame should be the first child placed on a new page, not the "
"root frame.");
if (mNextPageContentFramePageName) {
return;
}
const nsAtom* const autoValue = aFrame->GetParent()->GetAutoPageValue();
mNextPageContentFramePageName = aFrame->ComputePageValue(autoValue);
}
nsresult nsCSSFrameConstructor::ReplicateFixedFrames(
nsPageContentFrame* aParentFrame) {
// Now deal with fixed-pos things.... They should appear on all pages,