Bug 1700472 - Remove -moz-scrolled-page-sequence. r=dholbert

This is needed for bug 1700379, because otherwise we create a reference
frame with the root's scrolled content (the
::-moz-scrolled-page-sequence), and that breaks some display list
invariants.

Always create a canvas frame instead, (doesn't matter when printing
since we print off the page sequence frame directly), and create a
single ::-moz-page-sequence box.

Differential Revision: https://phabricator.services.mozilla.com/D109512
This commit is contained in:
Emilio Cobos Álvarez
2021-03-23 22:31:08 +00:00
parent 8725ccdd3f
commit c362e5b665
4 changed files with 42 additions and 46 deletions

View File

@@ -2471,18 +2471,7 @@ void nsCSSFrameConstructor::SetUpDocElementContainingBlock(
Print presentation, non-XUL
ViewportFrame
nsPageSequenceFrame
PrintedSheetFrame
nsPageFrame
nsPageContentFrame [fixed-cb]
nsCanvasFrame [abs-cb]
root element frame (nsBlockFrame, SVGOuterSVGFrame,
nsTableWrapperFrame, nsPlaceholderFrame)
Print-preview presentation, non-XUL
ViewportFrame
nsHTMLScrollFrame
nsCanvasFrame
nsPageSequenceFrame
PrintedSheetFrame
nsPageFrame
@@ -2491,6 +2480,19 @@ void nsCSSFrameConstructor::SetUpDocElementContainingBlock(
root element frame (nsBlockFrame, SVGOuterSVGFrame,
nsTableWrapperFrame, nsPlaceholderFrame)
Print-preview presentation, non-XUL
ViewportFrame
nsHTMLScrollFrame
nsCanvasFrame
nsPageSequenceFrame
PrintedSheetFrame
nsPageFrame
nsPageContentFrame [fixed-cb]
nsCanvasFrame [abs-cb]
root element frame (nsBlockFrame, SVGOuterSVGFrame,
nsTableWrapperFrame, nsPlaceholderFrame)
Print/print preview of XUL is not supported.
[fixed-cb]: the default containing block for fixed-pos content
[abs-cb]: the default containing block for abs-pos content
@@ -2543,30 +2545,22 @@ void nsCSSFrameConstructor::SetUpDocElementContainingBlock(
ComputedStyle* viewportPseudoStyle = viewportFrame->Style();
nsContainerFrame* rootFrame = nullptr;
PseudoStyleType rootPseudo;
if (!isPaginated) {
#ifdef MOZ_XUL
if (aDocElement->IsXULElement()) {
// pass a temporary stylecontext, the correct one will be set later
rootFrame = NS_NewRootBoxFrame(mPresShell, viewportPseudoStyle);
} else
if (aDocElement->IsXULElement()) {
// pass a temporary stylecontext, the correct one will be set later
rootFrame = NS_NewRootBoxFrame(mPresShell, viewportPseudoStyle);
} else
#endif
{
// pass a temporary stylecontext, the correct one will be set later
rootFrame = NS_NewCanvasFrame(mPresShell, viewportPseudoStyle);
mHasRootAbsPosContainingBlock = true;
}
rootPseudo = PseudoStyleType::canvas;
mDocElementContainingBlock = rootFrame;
} else {
// Create a page sequence frame
rootFrame = mPageSequenceFrame =
NS_NewPageSequenceFrame(mPresShell, viewportPseudoStyle);
rootPseudo = PseudoStyleType::pageSequence;
{
// pass a temporary stylecontext, the correct one will be set later
rootFrame = NS_NewCanvasFrame(mPresShell, viewportPseudoStyle);
mHasRootAbsPosContainingBlock = true;
}
PseudoStyleType rootPseudo = PseudoStyleType::canvas;
mDocElementContainingBlock = rootFrame;
// --------- IF SCROLLABLE WRAP IN SCROLLFRAME --------
// If the device supports scrolling (e.g., in galley mode on the screen and
@@ -2595,13 +2589,7 @@ void nsCSSFrameConstructor::SetUpDocElementContainingBlock(
rootPseudoStyle = styleSet->ResolveInheritingAnonymousBoxStyle(
rootPseudo, viewportPseudoStyle);
} else {
if (rootPseudo == PseudoStyleType::canvas) {
rootPseudo = PseudoStyleType::scrolledCanvas;
} else {
NS_ASSERTION(rootPseudo == PseudoStyleType::pageSequence,
"Unknown root pseudo");
rootPseudo = PseudoStyleType::scrolledPageSequence;
}
rootPseudo = PseudoStyleType::scrolledCanvas;
// Build the frame. We give it the content we are wrapping which is the
// document element, the root frame, the parent view port frame, and we
@@ -2635,11 +2623,22 @@ void nsCSSFrameConstructor::SetUpDocElementContainingBlock(
}
if (isPaginated) {
// Create a page sequence frame
{
RefPtr<ComputedStyle> pageSequenceStyle =
styleSet->ResolveInheritingAnonymousBoxStyle(
PseudoStyleType::pageSequence, viewportPseudoStyle);
mPageSequenceFrame =
NS_NewPageSequenceFrame(mPresShell, pageSequenceStyle);
mPageSequenceFrame->Init(aDocElement, rootFrame, nullptr);
SetInitialSingleChild(rootFrame, mPageSequenceFrame);
}
// Create the first printed sheet frame, as the sole child (for now) of our
// page sequence frame (rootFrame).
// page sequence frame (mPageSequenceFrame).
auto* printedSheetFrame =
ConstructPrintedSheetFrame(mPresShell, rootFrame, nullptr);
SetInitialSingleChild(rootFrame, printedSheetFrame);
ConstructPrintedSheetFrame(mPresShell, mPageSequenceFrame, nullptr);
SetInitialSingleChild(mPageSequenceFrame, printedSheetFrame);
// Create the first page, as the sole child (for now) of the printed sheet
// frame that we just created.