Chromium Code Reviews| 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 2580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 // Only returns 0 when data isn't available. If form data is downloaded, or |
| 2601 // if this isn't a form, returns positive values. | 2601 // if this isn't a form, returns positive values. FPDFAvail_IsFormAvail() |
| 2602 if (!doc_loader_.IsDocumentComplete() && | 2602 // must be called before continuing, so it must come first in the condition. |
| 2603 !FPDFAvail_IsFormAvail(fpdf_availability_, &download_hints_)) { | 2603 if (!FPDFAvail_IsFormAvail(fpdf_availability_, &download_hints_) && |
|
Lei Zhang
2015/12/30 01:09:21
How about we call these 2 functions separately, an
spelchat
2015/12/30 17:14:58
PDF_FORM_NOTEXIST is OK too, it just means there i
| |
| 2604 !doc_loader_.IsDocumentComplete()) { | |
| 2604 return; | 2605 return; |
| 2605 } | 2606 } |
| 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); |
| (...skipping 1385 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 |