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,6 +2471,7 @@ void nsCSSFrameConstructor::SetUpDocElementContainingBlock(
Print presentation, non-XUL
ViewportFrame
nsCanvasFrame
nsPageSequenceFrame
PrintedSheetFrame
nsPageFrame
@@ -2483,6 +2484,7 @@ void nsCSSFrameConstructor::SetUpDocElementContainingBlock(
ViewportFrame
nsHTMLScrollFrame
nsCanvasFrame
nsPageSequenceFrame
PrintedSheetFrame
nsPageFrame
@@ -2543,9 +2545,7 @@ 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
@@ -2558,14 +2558,8 @@ void nsCSSFrameConstructor::SetUpDocElementContainingBlock(
mHasRootAbsPosContainingBlock = true;
}
rootPseudo = PseudoStyleType::canvas;
PseudoStyleType rootPseudo = PseudoStyleType::canvas;
mDocElementContainingBlock = rootFrame;
} else {
// Create a page sequence frame
rootFrame = mPageSequenceFrame =
NS_NewPageSequenceFrame(mPresShell, viewportPseudoStyle);
rootPseudo = PseudoStyleType::pageSequence;
}
// --------- IF SCROLLABLE WRAP IN SCROLLFRAME --------
@@ -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;
}
// 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.

View File

@@ -114,7 +114,6 @@ CSS_ANON_BOX(canvas, ":-moz-canvas")
CSS_ANON_BOX(pageSequence, ":-moz-page-sequence")
CSS_ANON_BOX(scrolledContent, ":-moz-scrolled-content")
CSS_ANON_BOX(scrolledCanvas, ":-moz-scrolled-canvas")
CSS_ANON_BOX(scrolledPageSequence, ":-moz-scrolled-page-sequence")
// A column set is a set of columns inside of ColumnSetWrapperFrame, which
// applies to nsColumnSetFrame. It doesn't contain any column-span elements.

View File

@@ -200,8 +200,7 @@
overflow-clip-box: inherit;
}
*|*::-moz-scrolled-content, *|*::-moz-scrolled-canvas,
*|*::-moz-scrolled-page-sequence {
*|*::-moz-scrolled-content, *|*::-moz-scrolled-canvas {
/* e.g., text inputs, select boxes */
padding: inherit;
/* The display doesn't affect the kind of frame constructed here. This just
@@ -291,7 +290,7 @@
display: block;
}
*|*::-moz-page-sequence, *|*::-moz-scrolled-page-sequence {
*|*::-moz-page-sequence {
/* Collection of pages in print/print preview. Visual styles may only appear
* in print preview. */
display: block;

View File

@@ -2476,7 +2476,6 @@ STATIC_ATOMS = [
InheritingAnonBoxAtom("AnonBox_pageSequence", ":-moz-page-sequence"),
InheritingAnonBoxAtom("AnonBox_scrolledContent", ":-moz-scrolled-content"),
InheritingAnonBoxAtom("AnonBox_scrolledCanvas", ":-moz-scrolled-canvas"),
InheritingAnonBoxAtom("AnonBox_scrolledPageSequence", ":-moz-scrolled-page-sequence"),
InheritingAnonBoxAtom("AnonBox_columnSet", ":-moz-column-set"),
InheritingAnonBoxAtom("AnonBox_columnContent", ":-moz-column-content"),
InheritingAnonBoxAtom("AnonBox_viewport", ":-moz-viewport"),