OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "pdf/pdfium/pdfium_engine.h" | 5 #include "pdf/pdfium/pdfium_engine.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 g_last_instance_id = instance->pp_instance(); | 773 g_last_instance_id = instance->pp_instance(); |
774 #endif | 774 #endif |
775 } | 775 } |
776 | 776 |
777 PDFiumEngine::~PDFiumEngine() { | 777 PDFiumEngine::~PDFiumEngine() { |
778 for (auto& page : pages_) | 778 for (auto& page : pages_) |
779 page->Unload(); | 779 page->Unload(); |
780 | 780 |
781 if (doc_) { | 781 if (doc_) { |
782 FORM_DoDocumentAAction(form_, FPDFDOC_AACTION_WC); | 782 FORM_DoDocumentAAction(form_, FPDFDOC_AACTION_WC); |
783 | |
784 #if defined(PDF_ENABLE_XFA) | |
785 // XFA may require |form_| to outlive |doc_|, so shut down in that order. | |
786 FPDF_CloseDocument(doc_); | |
787 FPDFDOC_ExitFormFillEnvironment(form_); | |
788 #else | |
789 // Normally |doc_| should outlive |form_|. | |
790 FPDFDOC_ExitFormFillEnvironment(form_); | 783 FPDFDOC_ExitFormFillEnvironment(form_); |
791 FPDF_CloseDocument(doc_); | 784 FPDF_CloseDocument(doc_); |
792 #endif | |
793 } | 785 } |
794 FPDFAvail_Destroy(fpdf_availability_); | 786 FPDFAvail_Destroy(fpdf_availability_); |
795 } | 787 } |
796 | 788 |
797 #if defined(PDF_ENABLE_XFA) | 789 #if defined(PDF_ENABLE_XFA) |
798 | 790 |
799 void PDFiumEngine::Form_EmailTo(FPDF_FORMFILLINFO* param, | 791 void PDFiumEngine::Form_EmailTo(FPDF_FORMFILLINFO* param, |
800 FPDF_FILEHANDLER* file_handler, | 792 FPDF_FILEHANDLER* file_handler, |
801 FPDF_WIDESTRING to, | 793 FPDF_WIDESTRING to, |
802 FPDF_WIDESTRING subject, | 794 FPDF_WIDESTRING subject, |
(...skipping 3339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4142 FPDF_DOCUMENT doc = | 4134 FPDF_DOCUMENT doc = |
4143 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); | 4135 FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, nullptr); |
4144 if (!doc) | 4136 if (!doc) |
4145 return false; | 4137 return false; |
4146 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 4138 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
4147 FPDF_CloseDocument(doc); | 4139 FPDF_CloseDocument(doc); |
4148 return success; | 4140 return success; |
4149 } | 4141 } |
4150 | 4142 |
4151 } // namespace chrome_pdf | 4143 } // namespace chrome_pdf |
OLD | NEW |