Bug 1786399 - Check for block layout when applying and propagating page-name properties r=dholbert

The page-name property only applies to boxes which can create class A
breakpoints. One of the qualifiers for this is a block-level item, which is
the child of a block frame. Additionally, page-name propagation only occurs
through frames for which the page-name property applies, because where it does
not apply the auto page-name is propagated instead.

This means we only need to worry about block frames, and only use specified
page-name for BlockOutside frames.

Differential Revision: https://phabricator.services.mozilla.com/D155285
This commit is contained in:
Emily McDonough
2022-09-13 21:29:38 +00:00
parent a5868d2d3c
commit 092af88db6
10 changed files with 104 additions and 2 deletions

View File

@@ -9553,7 +9553,8 @@ inline void nsCSSFrameConstructor::ConstructFramesFromItemList(
// Calculate and propagate page-name values for each frame in the frame list.
// This will be affected by https://bugzilla.mozilla.org/1782597
if (aState.mPresContext->IsPaginated() &&
StaticPrefs::layout_css_named_pages_enabled()) {
StaticPrefs::layout_css_named_pages_enabled() &&
aParentFrame->IsBlockFrameOrSubclass()) {
// Set the start/end page values while iterating the frame list, to walk
// up the frame tree only once after iterating the frame list.
// This also avoids extra property lookups on these frames.
@@ -9613,7 +9614,8 @@ inline void nsCSSFrameConstructor::ConstructFramesFromItemList(
// Alternatively, we could propagate this back up the frame tree after
// constructing this frame's first child, inspecting the parent frames
// and rewriting their first child page-name.
for (nsContainerFrame* frame = aParentFrame; frame;
for (nsContainerFrame* frame = aParentFrame;
frame && frame->IsBlockFrameOrSubclass();
frame = frame->GetParent()) {
nsIFrame::PageValues* const parentPageValues =
frame->GetProperty(nsIFrame::PageValuesProperty());