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 DCHECK(form_status != PDF_FORM_ERROR); |
Lei Zhang
2015/12/30 17:48:26
DCHECK_NE()
spelchat
2015/12/30 17:53:36
Done.
| |
2603 !FPDFAvail_IsFormAvail(fpdf_availability_, &download_hints_)) { | 2603 bool doc_complete = doc_loader_.IsDocumentComplete(); |
2604 // Try again if the data is not available and the document hasn't finished | |
2605 // downloading. | |
2606 if (form_status == PDF_FORM_NOTAVAIL && !doc_complete) | |
2604 return; | 2607 return; |
2605 } | |
2606 | 2608 |
2607 form_ = FPDFDOC_InitFormFillEnvironment( | 2609 form_ = FPDFDOC_InitFormFillEnvironment( |
2608 doc_, static_cast<FPDF_FORMFILLINFO*>(this)); | 2610 doc_, static_cast<FPDF_FORMFILLINFO*>(this)); |
2609 #ifdef PDF_USE_XFA | 2611 #ifdef PDF_USE_XFA |
2610 FPDF_LoadXFA(doc_); | 2612 FPDF_LoadXFA(doc_); |
2611 #endif | 2613 #endif |
2612 | 2614 |
2613 FPDF_SetFormFieldHighlightColor(form_, 0, kFormHighlightColor); | 2615 FPDF_SetFormFieldHighlightColor(form_, 0, kFormHighlightColor); |
2614 FPDF_SetFormFieldHighlightAlpha(form_, kFormHighlightAlpha); | 2616 FPDF_SetFormFieldHighlightAlpha(form_, kFormHighlightAlpha); |
2615 } | 2617 } |
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3999 double* height) { | 4001 double* height) { |
4000 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); | 4002 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); |
4001 if (!doc) | 4003 if (!doc) |
4002 return false; | 4004 return false; |
4003 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 4005 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
4004 FPDF_CloseDocument(doc); | 4006 FPDF_CloseDocument(doc); |
4005 return success; | 4007 return success; |
4006 } | 4008 } |
4007 | 4009 |
4008 } // namespace chrome_pdf | 4010 } // namespace chrome_pdf |
OLD | NEW |