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 Print presentation, non-XUL
ViewportFrame ViewportFrame
nsCanvasFrame
nsPageSequenceFrame nsPageSequenceFrame
PrintedSheetFrame PrintedSheetFrame
nsPageFrame nsPageFrame
@@ -2483,6 +2484,7 @@ void nsCSSFrameConstructor::SetUpDocElementContainingBlock(
ViewportFrame ViewportFrame
nsHTMLScrollFrame nsHTMLScrollFrame
nsCanvasFrame
nsPageSequenceFrame nsPageSequenceFrame
PrintedSheetFrame PrintedSheetFrame
nsPageFrame nsPageFrame
@@ -2543,9 +2545,7 @@ void nsCSSFrameConstructor::SetUpDocElementContainingBlock(
ComputedStyle* viewportPseudoStyle = viewportFrame->Style(); ComputedStyle* viewportPseudoStyle = viewportFrame->Style();
nsContainerFrame* rootFrame = nullptr; nsContainerFrame* rootFrame = nullptr;
PseudoStyleType rootPseudo;
if (!isPaginated) {
#ifdef MOZ_XUL #ifdef MOZ_XUL
if (aDocElement->IsXULElement()) { if (aDocElement->IsXULElement()) {
// pass a temporary stylecontext, the correct one will be set later // pass a temporary stylecontext, the correct one will be set later
@@ -2558,14 +2558,8 @@ void nsCSSFrameConstructor::SetUpDocElementContainingBlock(
mHasRootAbsPosContainingBlock = true; mHasRootAbsPosContainingBlock = true;
} }
rootPseudo = PseudoStyleType::canvas; PseudoStyleType rootPseudo = PseudoStyleType::canvas;
mDocElementContainingBlock = rootFrame; mDocElementContainingBlock = rootFrame;
} else {
// Create a page sequence frame
rootFrame = mPageSequenceFrame =
NS_NewPageSequenceFrame(mPresShell, viewportPseudoStyle);
rootPseudo = PseudoStyleType::pageSequence;
}
// --------- IF SCROLLABLE WRAP IN SCROLLFRAME -------- // --------- IF SCROLLABLE WRAP IN SCROLLFRAME --------
@@ -2595,13 +2589,7 @@ void nsCSSFrameConstructor::SetUpDocElementContainingBlock(
rootPseudoStyle = styleSet->ResolveInheritingAnonymousBoxStyle( rootPseudoStyle = styleSet->ResolveInheritingAnonymousBoxStyle(
rootPseudo, viewportPseudoStyle); rootPseudo, viewportPseudoStyle);
} else { } else {
if (rootPseudo == PseudoStyleType::canvas) {
rootPseudo = PseudoStyleType::scrolledCanvas; 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 // 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 // document element, the root frame, the parent view port frame, and we
@@ -2635,11 +2623,22 @@ void nsCSSFrameConstructor::SetUpDocElementContainingBlock(
} }
if (isPaginated) { 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 // Create the first printed sheet frame, as the sole child (for now) of our
// page sequence frame (rootFrame). // page sequence frame (mPageSequenceFrame).
auto* printedSheetFrame = auto* printedSheetFrame =
ConstructPrintedSheetFrame(mPresShell, rootFrame, nullptr); ConstructPrintedSheetFrame(mPresShell, mPageSequenceFrame, nullptr);
SetInitialSingleChild(rootFrame, printedSheetFrame); SetInitialSingleChild(mPageSequenceFrame, printedSheetFrame);
// Create the first page, as the sole child (for now) of the printed sheet // Create the first page, as the sole child (for now) of the printed sheet
// frame that we just created. // 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(pageSequence, ":-moz-page-sequence")
CSS_ANON_BOX(scrolledContent, ":-moz-scrolled-content") CSS_ANON_BOX(scrolledContent, ":-moz-scrolled-content")
CSS_ANON_BOX(scrolledCanvas, ":-moz-scrolled-canvas") 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 // A column set is a set of columns inside of ColumnSetWrapperFrame, which
// applies to nsColumnSetFrame. It doesn't contain any column-span elements. // applies to nsColumnSetFrame. It doesn't contain any column-span elements.

View File

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

View File

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