| 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 2579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2590 return; | 2590 return; |
| 2591 } | 2591 } |
| 2592 | 2592 |
| 2593 if (FPDFDoc_GetPageMode(doc_) == PAGEMODE_USEOUTLINES) | 2593 if (FPDFDoc_GetPageMode(doc_) == PAGEMODE_USEOUTLINES) |
| 2594 client_->DocumentHasUnsupportedFeature("Bookmarks"); | 2594 client_->DocumentHasUnsupportedFeature("Bookmarks"); |
| 2595 | 2595 |
| 2596 permissions_ = FPDF_GetDocPermissions(doc_); | 2596 permissions_ = FPDF_GetDocPermissions(doc_); |
| 2597 permissions_handler_revision_ = FPDF_GetSecurityHandlerRevision(doc_); | 2597 permissions_handler_revision_ = FPDF_GetSecurityHandlerRevision(doc_); |
| 2598 | 2598 |
| 2599 if (!form_) { | 2599 if (!form_) { |
| 2600 // Only returns 0 when data isn't available. If form data is downloaded, or | 2600 int form_status = |
| 2601 // if this isn't a form, returns positive values. | 2601 FPDFAvail_IsFormAvail(fpdf_availability_, &download_hints_); |
| 2602 if (!doc_loader_.IsDocumentComplete() && | 2602 bool doc_complete = doc_loader_.IsDocumentComplete(); |
| 2603 !FPDFAvail_IsFormAvail(fpdf_availability_, &download_hints_)) { | 2603 // Try again if the data is not available and the document hasn't finished |
| 2604 // downloading. |
| 2605 if (form_status == PDF_FORM_NOTAVAIL && !doc_complete) |
| 2604 return; | 2606 return; |
| 2605 } | |
| 2606 | 2607 |
| 2607 form_ = FPDFDOC_InitFormFillEnvironment( | 2608 form_ = FPDFDOC_InitFormFillEnvironment( |
| 2608 doc_, static_cast<FPDF_FORMFILLINFO*>(this)); | 2609 doc_, static_cast<FPDF_FORMFILLINFO*>(this)); |
| 2609 #ifdef PDF_USE_XFA | 2610 #ifdef PDF_USE_XFA |
| 2610 FPDF_LoadXFA(doc_); | 2611 FPDF_LoadXFA(doc_); |
| 2611 #endif | 2612 #endif |
| 2612 | 2613 |
| 2613 FPDF_SetFormFieldHighlightColor(form_, 0, kFormHighlightColor); | 2614 FPDF_SetFormFieldHighlightColor(form_, 0, kFormHighlightColor); |
| 2614 FPDF_SetFormFieldHighlightAlpha(form_, kFormHighlightAlpha); | 2615 FPDF_SetFormFieldHighlightAlpha(form_, kFormHighlightAlpha); |
| 2615 } | 2616 } |
| (...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3999 double* height) { | 4000 double* height) { |
| 4000 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); | 4001 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); |
| 4001 if (!doc) | 4002 if (!doc) |
| 4002 return false; | 4003 return false; |
| 4003 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 4004 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
| 4004 FPDF_CloseDocument(doc); | 4005 FPDF_CloseDocument(doc); |
| 4005 return success; | 4006 return success; |
| 4006 } | 4007 } |
| 4007 | 4008 |
| 4008 } // namespace chrome_pdf | 4009 } // namespace chrome_pdf |
| OLD | NEW |