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

Unified Diff: pdf/instance.cc

Issue 560133004: Let PDFium handle event when there is not yet a visible page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/instance.cc
diff --git a/pdf/instance.cc b/pdf/instance.cc
index bb13fcc210eba34fdd4a03dde8fe5c9ff6b73ad0..7706a69bebd403292a97bdcd42f9d35470d38374 100644
--- a/pdf/instance.cc
+++ b/pdf/instance.cc
@@ -520,6 +520,8 @@ bool Instance::HandleInputEvent(const pp::InputEvent& event) {
}
if (page_down) {
int page = engine_->GetFirstVisiblePage();
+ if (page == -1)
+ return true;
// Engine calculates visible page including delimiter to the page size.
// We need to check here if the page itself is completely out of view and
// scroll to the next one in that case.
@@ -531,6 +533,8 @@ bool Instance::HandleInputEvent(const pp::InputEvent& event) {
return true;
} else if (page_up) {
int page = engine_->GetFirstVisiblePage();
+ if (page == -1)
+ return true;
if (engine_->GetPageRect(page).y() * zoom_ >= v_scrollbar_->GetValue())
page--;
ScrollToPage(page);
« 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