Skip to content

Commit

Permalink
Let PDFium handle event when there is not yet a visible page.
Browse files Browse the repository at this point in the history
Speculative fix for 415307. CF will confirm.
The stack trace for that bug indicates an attempt to index by -1, which is consistent with no visible page.

BUG=415307

Review URL: https://codereview.chromium.org/560133004

Cr-Commit-Position: refs/heads/master@{#295421}
  • Loading branch information
tsepez authored and Commit bot committed Sep 18, 2014
1 parent 3558ad6 commit 9b04ffd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pdf/instance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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);
Expand Down

0 comments on commit 9b04ffd

Please sign in to comment.