From 31a5cfa91bb4be088a6478c13ab227a114aeb923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 14 Aug 2020 12:23:39 +0000 Subject: [PATCH] Bug 1659084 - Clean up some nsPageSequenceFrame. r=jfkthame Differential Revision: https://phabricator.services.mozilla.com/D87061 --- layout/generic/nsPageSequenceFrame.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/layout/generic/nsPageSequenceFrame.cpp b/layout/generic/nsPageSequenceFrame.cpp index 60c426fdc9d3..978db794f3b5 100644 --- a/layout/generic/nsPageSequenceFrame.cpp +++ b/layout/generic/nsPageSequenceFrame.cpp @@ -559,7 +559,7 @@ nsresult nsPageSequenceFrame::PrePrintNextPage(nsITimerCallback* aCallback, mCurrentCanvasListSetup = true; GetPrintCanvasElementsInFrame(currentPage, &mCurrentCanvasList); - if (mCurrentCanvasList.Length() != 0) { + if (!mCurrentCanvasList.IsEmpty()) { nsresult rv = NS_OK; // Begin printing of the document @@ -579,8 +579,7 @@ nsresult nsPageSequenceFrame::PrePrintNextPage(nsITimerCallback* aCallback, return NS_ERROR_FAILURE; } - for (int32_t i = mCurrentCanvasList.Length() - 1; i >= 0; i--) { - HTMLCanvasElement* canvas = mCurrentCanvasList[i]; + for (HTMLCanvasElement* canvas : Reversed(mCurrentCanvasList)) { nsIntSize size = canvas->GetSize(); RefPtr canvasTarget = @@ -613,9 +612,7 @@ nsresult nsPageSequenceFrame::PrePrintNextPage(nsITimerCallback* aCallback, } } uint32_t doneCounter = 0; - for (int32_t i = mCurrentCanvasList.Length() - 1; i >= 0; i--) { - HTMLCanvasElement* canvas = mCurrentCanvasList[i]; - + for (HTMLCanvasElement* canvas : mCurrentCanvasList) { if (canvas->IsPrintCallbackDone()) { doneCounter++; }