Bug 1659005 part 2: Make nsPageSequenceFrame determine its page range information earlier on, at the start of reflow. r=TYLin

This patch shouldn't change behavior.

After this change, we'll be able to reason about the page range during reflow
(in a later patch in this series). The old place where we determine the
page-range information -- in nsPageSequenceFrame::StartPrint -- unfortunately
runs *after* reflow.  So that was running too late for the information to be
useful when we're laying out pages on sheets.

Differential Revision: https://phabricator.services.mozilla.com/D88469
This commit is contained in:
Daniel Holbert 2020-08-28 22:27:42 +00:00
Родитель 2e3917b1b1
Коммит f2ab159f03
1 изменённых файлов: 10 добавлений и 9 удалений

Просмотреть файл

@ -236,6 +236,16 @@ void nsPageSequenceFrame::Reflow(nsPresContext* aPresContext,
mPageData->mEdgePaperMargin =
nsPresContext::CSSTwipsToAppUnits(edgeTwips + unwriteableTwips);
// Get the custom page-range state:
mPageData->mPrintSettings->GetStartPageRange(&mPageData->mFromPageNum);
mPageData->mPrintSettings->GetEndPageRange(&mPageData->mToPageNum);
mPageData->mPrintSettings->GetPageRanges(mPageData->mPageRanges);
int16_t printType;
mPageData->mPrintSettings->GetPrintRange(&printType);
mPageData->mDoingPageRange =
nsIPrintSettings::kRangeSpecifiedPageRange == printType;
}
// We use the CSS "margin" property on the -moz-printed-sheet pseudoelement
@ -395,15 +405,6 @@ nsresult nsPageSequenceFrame::StartPrint(nsPresContext* aPresContext,
mPageData->mDocURL = aDocURL;
}
aPrintSettings->GetStartPageRange(&mPageData->mFromPageNum);
aPrintSettings->GetEndPageRange(&mPageData->mToPageNum);
aPrintSettings->GetPageRanges(mPageData->mPageRanges);
int16_t printType;
aPrintSettings->GetPrintRange(&printType);
mPageData->mDoingPageRange =
nsIPrintSettings::kRangeSpecifiedPageRange == printType;
// If printing a range of pages make sure at least the starting page
// number is valid
if (mPageData->mDoingPageRange) {