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

Unified Diff: pdf/pdfium/pdfium_engine.cc

Issue 1255403002: Add a scroll offset to PDF documents to account for the top material design toolbar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 | « pdf/pdfium/pdfium_engine.h ('k') | 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 89fa7eb0a8ad75f17d288a63e4a526eb98dd328a..fc36c1ef152e46a89786ce8adfb37692f4dba11f 100644
--- a/pdf/pdfium/pdfium_engine.cc
+++ b/pdf/pdfium/pdfium_engine.cc
@@ -1071,6 +1071,15 @@ void PDFiumEngine::Paint(const pp::Rect& rect,
if (dirty_in_screen.IsEmpty())
continue;
+ // Compute the leftover dirty region. The first page may have blank space
+ // above it, in which case we also need to subtract that space from the
+ // dirty region.
+ if (i == 0) {
+ pp::Rect blank_space_in_screen = dirty_in_screen;
+ blank_space_in_screen.set_y(0);
+ blank_space_in_screen.set_height(dirty_in_screen.y());
+ leftover = leftover.Subtract(blank_space_in_screen);
+ }
leftover = leftover.Subtract(dirty_in_screen);
if (pages_[index]->available()) {
« no previous file with comments | « pdf/pdfium/pdfium_engine.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698