Bug 454059 - Add a new PaintForPrinting display list builder mode, and only create a Linkifier when printing. r=mstange

Differential Revision: https://phabricator.services.mozilla.com/D114474
This commit is contained in:
Jonathan Kew 2021-05-11 17:00:30 +00:00
Родитель 11144bf7be
Коммит 63f05b6d5a
3 изменённых файлов: 18 добавлений и 3 удалений

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

@ -3131,6 +3131,10 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
TimeStamp startBuildDisplayList = TimeStamp::Now();
const bool buildCaret = !(aFlags & PaintFrameFlags::HideCaret);
// Note that isForPainting here does not include the PaintForPrinting builder
// mode; that's OK because there is no point in using retained display lists
// for a print destination.
const bool isForPainting = (aFlags & PaintFrameFlags::WidgetLayers) &&
aBuilderMode == nsDisplayListBuilderMode::Painting;

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

@ -673,7 +673,7 @@ nsresult nsPageSequenceFrame::PrintNextSheet() {
nsRegion drawingRegion(drawingRect);
nsLayoutUtils::PaintFrame(gCtx, currentSheetFrame, drawingRegion,
NS_RGBA(0, 0, 0, 0),
nsDisplayListBuilderMode::Painting,
nsDisplayListBuilderMode::PaintForPrinting,
nsLayoutUtils::PaintFrameFlags::SyncDecodeImages);
return rv;
}

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

@ -341,6 +341,7 @@ struct ActiveScrolledRoot {
enum class nsDisplayListBuilderMode : uint8_t {
Painting,
PaintForPrinting,
EventDelivery,
FrameVisibility,
TransformComputation,
@ -463,10 +464,20 @@ class nsDisplayListBuilder {
}
/**
* @return true if the display list is being built for painting.
* @return true if the display list is being built for painting. This
* includes both painting to a window or other buffer and painting to
* a print/pdf destination.
*/
bool IsForPainting() const {
return mMode == nsDisplayListBuilderMode::Painting;
return mMode == nsDisplayListBuilderMode::Painting ||
mMode == nsDisplayListBuilderMode::PaintForPrinting;
}
/**
* @return true if the display list is being built specifically for printing.
*/
bool IsForPrinting() const {
return mMode == nsDisplayListBuilderMode::PaintForPrinting;
}
/**