Revert "Revert "Add support for OOPIF printing in renderer""

https://chromium-review.googlesource.com/924566
This commit is contained in:
Aleksei Kuzmin 2018-04-11 16:59:05 +02:00 committed by Samuel Attard
parent 93fc60720a
commit 7732da41ba
5 changed files with 8 additions and 9 deletions

View file

@ -139,8 +139,7 @@ void PrintViewManagerBase::OnDidPrintPage(
}
}
std::unique_ptr<PdfMetafileSkia> metafile(
new PdfMetafileSkia(SkiaDocumentType::PDF));
auto metafile = std::make_unique<PdfMetafileSkia>();
if (metafile_must_be_valid) {
if (!metafile->InitFromData(shared_buf.memory(), params.data_size)) {
NOTREACHED() << "Invalid metafile header";

View file

@ -1238,7 +1238,7 @@ bool PrintWebViewHelper::PrintPreviewContext::CreatePreviewDocument(
return false;
}
metafile_.reset(new PdfMetafileSkia(SkiaDocumentType::PDF));
metafile_.reset(new PdfMetafileSkia());
CHECK(metafile_->Init());
current_page_index_ = 0;

View file

@ -33,7 +33,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
std::unique_ptr<PdfMetafileSkia> draft_metafile;
PdfMetafileSkia* initial_render_metafile = print_preview_context_.metafile();
if (print_preview_context_.IsModifiable() && is_print_ready_metafile_sent_) {
draft_metafile.reset(new PdfMetafileSkia(SkiaDocumentType::PDF));
draft_metafile.reset(new PdfMetafileSkia());
initial_render_metafile = draft_metafile.get();
}
@ -56,7 +56,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame,
int page_count) {
PdfMetafileSkia metafile(SkiaDocumentType::PDF);
PdfMetafileSkia metafile;
if (!metafile.Init())
return false;

View file

@ -22,7 +22,7 @@ using blink::WebLocalFrame;
void PrintWebViewHelper::PrintPageInternal(
const PrintMsg_PrintPage_Params& params,
WebLocalFrame* frame) {
PdfMetafileSkia metafile(SkiaDocumentType::PDF);
PdfMetafileSkia metafile;
CHECK(metafile.Init());
int page_number = params.page_number;
@ -60,7 +60,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
print_preview_context_.IsModifiable() && is_print_ready_metafile_sent_;
if (render_to_draft) {
draft_metafile.reset(new PdfMetafileSkia(SkiaDocumentType::PDF));
draft_metafile.reset(new PdfMetafileSkia());
CHECK(draft_metafile->Init());
initial_render_metafile = draft_metafile.get();
}

View file

@ -29,7 +29,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
std::unique_ptr<PdfMetafileSkia> draft_metafile;
PdfMetafileSkia* initial_render_metafile = print_preview_context_.metafile();
if (print_preview_context_.IsModifiable() && is_print_ready_metafile_sent_) {
draft_metafile.reset(new PdfMetafileSkia(SkiaDocumentType::PDF));
draft_metafile.reset(new PdfMetafileSkia());
initial_render_metafile = draft_metafile.get();
}
@ -52,7 +52,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
bool PrintWebViewHelper::PrintPagesNative(blink::WebLocalFrame* frame,
int page_count) {
PdfMetafileSkia metafile(SkiaDocumentType::PDF);
PdfMetafileSkia metafile;
if (!metafile.Init())
return false;