From f0d9d28a034fe3650c3c2d662090c1e8687ddb16 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 30 May 2018 16:40:00 +0000 Subject: Make CPDF_Document cache CPDF_Pages We cache pages not by page number, which can bounce around as pages are inserted or removed, but by page dictionary's object number. Since the page may be created under one function and used under another, we can't take the shortcut of not instantiating a render cache nor not parsing the page. Change-Id: I9a325cda8b3141153544ac53e78a51a44e6b411a Reviewed-on: https://pdfium-review.googlesource.com/32830 Commit-Queue: Tom Sepez Reviewed-by: dsinclair --- fpdfsdk/fpdf_editpage.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'fpdfsdk/fpdf_editpage.cpp') diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp index 39cf85fb95..9fb6c1fedf 100644 --- a/fpdfsdk/fpdf_editpage.cpp +++ b/fpdfsdk/fpdf_editpage.cpp @@ -196,8 +196,7 @@ FPDF_EXPORT FPDF_PAGE FPDF_CALLCONV FPDFPage_New(FPDF_DOCUMENT document, // Eventually, fallthru into non-XFA case once page type is consistent. return nullptr; #else // PDF_ENABLE_XFA - auto pPage = pdfium::MakeRetain(pDoc, pPageDict, true); - pPage->ParseContent(); + RetainPtr pPage = pDoc->GetOrCreatePDFPage(pPageDict); return FPDFPageFromUnderlying(pPage.Leak()); // Caller takes ownership. #endif // PDF_ENABLE_XFA } -- cgit v1.2.3