Commit f90b9a4c authored by thestig@chromium.org's avatar thestig@chromium.org

PDF: Do more robust page number parsing in OOP plugin.

BUG=64309

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

Cr-Commit-Position: refs/heads/master@{#290770}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290770 0039d316-1c4b-4281-b951-d872f2087c98
parent 34ed6476
...@@ -287,8 +287,10 @@ PDFViewer.prototype = { ...@@ -287,8 +287,10 @@ PDFViewer.prototype = {
// Order is important as later actions can override the effects // Order is important as later actions can override the effects
// of previous actions. // of previous actions.
if ('page' in paramsDictionary) { if ('page' in paramsDictionary) {
// value is 1-based. // |pageNumber| is 1-based, but goToPage() take a zero-based page number.
this.viewport_.goToPage(paramsDictionary['page'] - 1); var pageNumber = parseInt(paramsDictionary['page']);
if (!isNaN(pageNumber))
this.viewport_.goToPage(pageNumber - 1);
} }
}, },
......
...@@ -450,7 +450,7 @@ Viewport.prototype = { ...@@ -450,7 +450,7 @@ Viewport.prototype = {
/** /**
* Go to the given page index. * Go to the given page index.
* @param {number} page the index of the page to go to. * @param {number} page the index of the page to go to. zero-based.
*/ */
goToPage: function(page) { goToPage: function(page) {
this.mightZoom_(function() { this.mightZoom_(function() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment