From 854d71c1420eb80ec79755a6cdf829f3f39aead7 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Wed, 18 Oct 2017 12:28:14 -0400 Subject: Refactor HasXFAField into HasFormInfo The existing API is too restrictive for collection the metrics information that we want. Specifically it only tells us if there are XFA forms in the document, but not AcroForms. This refactoring makes the method more general, so that non-XFA information is provided also. This change in semantics of the return value required some changes at the call sites of the API. BUG=chromium:775519 Change-Id: Id421c66c09b47196c252c64cdc2c711ca1911de0 Reviewed-on: https://pdfium-review.googlesource.com/16210 Commit-Queue: Ryan Harrison Reviewed-by: Henrique Nakashima Reviewed-by: dsinclair --- samples/pdfium_test.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'samples') diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc index a638fd0822..644aee7819 100644 --- a/samples/pdfium_test.cc +++ b/samples/pdfium_test.cc @@ -1430,10 +1430,10 @@ void RenderPdf(const std::string& name, form_callbacks.form_handle = form.get(); #ifdef PDF_ENABLE_XFA - int doc_type = XFADOCTYPE_NONE; - if (FPDF_HasXFAField(doc.get(), &doc_type) && doc_type != XFADOCTYPE_NONE && - !FPDF_LoadXFA(doc.get())) { - fprintf(stderr, "LoadXFA unsuccessful, continuing anyway.\n"); + int doc_type = FPDF_GetFormType(doc.get()); + if (doc_type == FORMTYPE_XFA_FULL || doc_type == FORMTYPE_XFA_FOREGROUND) { + if (!FPDF_LoadXFA(doc.get())) + fprintf(stderr, "LoadXFA unsuccessful, continuing anyway.\n"); } #endif // PDF_ENABLE_XFA -- cgit v1.2.3