Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(758)

Unified Diff: pdf/pdfium/pdfium_engine.cc

Issue 1942253003: Revert of Get the correct page size for linearized PDFs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/pdfium/pdfium_engine.cc
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc
index ac00af5c590d3827fb2493b4e615f44729fed331..09d8a2f5ec1e64c196e87981fce53607ab6817ea 100644
--- a/pdf/pdfium/pdfium_engine.cc
+++ b/pdf/pdfium/pdfium_engine.cc
@@ -2522,27 +2522,17 @@
std::vector<pp::Rect> page_rects;
int page_count = FPDF_GetPageCount(doc_);
bool doc_complete = doc_loader_.IsDocumentComplete();
- bool is_linear = FPDFAvail_IsLinearized(fpdf_availability_) == PDF_LINEARIZED;
for (int i = 0; i < page_count; ++i) {
if (i != 0) {
// Add space for horizontal separator.
document_size_.Enlarge(0, kPageSeparatorThickness);
}
- // Get page availability. If |reload| == true, then the document has been
- // constructed already. Get page availability flag from already existing
- // PDFiumPage class.
- // If |reload| == false, then the document may not be fully loaded yet.
- bool page_available;
- if (reload) {
- page_available = pages_[i]->available();
- } else if (is_linear) {
- int linear_page_avail =
- FPDFAvail_IsPageAvail(fpdf_availability_, i, &download_hints_);
- page_available = linear_page_avail == PDF_DATA_AVAIL;
- } else {
- page_available = doc_complete;
- }
+ // Get page availability. If reload==false, and document is not loaded yet
+ // (we are using async loading) - mark all pages as unavailable.
+ // If reload==true (we have document constructed already), get page
+ // availability flag from already existing PDFiumPage class.
+ bool page_available = reload ? pages_[i]->available() : doc_complete;
pp::Size size = page_available ? GetPageSize(i) : default_page_size_;
size.Enlarge(kPageShadowLeft + kPageShadowRight,
@@ -2642,7 +2632,13 @@
return true;
if (!FPDFAvail_IsPageAvail(fpdf_availability_, index, &download_hints_)) {
- if (!ContainsValue(*pending, index))
+ size_t j;
+ for (j = 0; j < pending->size(); ++j) {
+ if ((*pending)[j] == index)
+ break;
+ }
+
+ if (j == pending->size())
pending->push_back(index);
return false;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698