Bug 1686494 part 1: Change return type of nsPageSequence::GetCurrentSheetFrame to the actual concrete type, PrintedSheetFrame*, instead of nsIFrame*. r=TYLin

This patch doesn't change behavior; it just adds a static_cast to a
more-specific type that we know the variable has, and updates the signature and
callsites.

(The next patch will make use of the fact that we know this type.)

Differential Revision: https://phabricator.services.mozilla.com/D101941
This commit is contained in:
Daniel Holbert 2021-01-15 18:17:47 +00:00
Родитель c2e4fdeb90
Коммит 1ad8b7a2ee
2 изменённых файлов: 8 добавлений и 5 удалений

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

@ -504,11 +504,13 @@ static void GetPrintCanvasElementsInFrame(
}
}
nsIFrame* nsPageSequenceFrame::GetCurrentSheetFrame() {
PrintedSheetFrame* nsPageSequenceFrame::GetCurrentSheetFrame() {
uint32_t i = 0;
for (nsIFrame* child : mFrames) {
MOZ_ASSERT(child->IsPrintedSheetFrame(),
"Our children must all be PrintedSheetFrame");
if (i == mCurrentSheetIdx) {
return child;
return static_cast<PrintedSheetFrame*>(child);
}
++i;
}
@ -517,7 +519,7 @@ nsIFrame* nsPageSequenceFrame::GetCurrentSheetFrame() {
nsresult nsPageSequenceFrame::PrePrintNextSheet(nsITimerCallback* aCallback,
bool* aDone) {
nsIFrame* currentSheet = GetCurrentSheetFrame();
PrintedSheetFrame* currentSheet = GetCurrentSheetFrame();
if (!currentSheet) {
*aDone = true;
return NS_ERROR_FAILURE;
@ -621,7 +623,7 @@ nsresult nsPageSequenceFrame::PrintNextSheet() {
// print are 1 and then two (which is different than printing a page range,
// where the page numbers would have been 2 and then 3)
nsIFrame* currentSheetFrame = GetCurrentSheetFrame();
PrintedSheetFrame* currentSheetFrame = GetCurrentSheetFrame();
if (!currentSheetFrame) {
return NS_ERROR_FAILURE;
}

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

@ -14,6 +14,7 @@
namespace mozilla {
class PresShell;
class PrintedSheetFrame;
namespace dom {
@ -179,7 +180,7 @@ class nsPageSequenceFrame final : public nsContainerFrame {
nscoord aChildPaddingBoxWidth,
const nsMargin& aChildPhysicalMargin);
nsIFrame* GetCurrentSheetFrame();
mozilla::PrintedSheetFrame* GetCurrentSheetFrame();
nsSize mSize;