OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 'use strict'; | 5 'use strict'; |
6 | 6 |
7 <include src="../../../../ui/webui/resources/js/util.js"> | 7 <include src="../../../../ui/webui/resources/js/util.js"> |
8 <include src="pdf_scripting_api.js"> | 8 <include src="pdf_scripting_api.js"> |
9 <include src="viewport.js"> | 9 <include src="viewport.js"> |
10 | 10 |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
280 for (var i = 0; i < paramTokens.length; ++i) { | 280 for (var i = 0; i < paramTokens.length; ++i) { |
281 var keyValueSplit = paramTokens[i].split('='); | 281 var keyValueSplit = paramTokens[i].split('='); |
282 if (keyValueSplit.length != 2) | 282 if (keyValueSplit.length != 2) |
283 continue; | 283 continue; |
284 paramsDictionary[keyValueSplit[0]] = keyValueSplit[1]; | 284 paramsDictionary[keyValueSplit[0]] = keyValueSplit[1]; |
285 } | 285 } |
286 | 286 |
287 // Order is important as later actions can override the effects | 287 // Order is important as later actions can override the effects |
288 // of previous actions. | 288 // of previous actions. |
289 if ('page' in paramsDictionary) { | 289 if ('page' in paramsDictionary) { |
290 // value is 1-based. | 290 // |pageNumber| is 1-based, but goToPage() take a zero-based page number. |
291 this.viewport_.goToPage(paramsDictionary['page'] - 1); | 291 var pageNumber = parseInt(paramsDictionary['page']); |
292 if (!isNaN(pageNumber)) | |
293 this.viewport_.goToPage(pageNumber - 1); | |
raymes
2014/08/20 00:53:54
What happens without this?
Lei Zhang
2014/08/20 00:57:19
Without this CL, in goToPage(), we blow past the p
| |
292 } | 294 } |
293 }, | 295 }, |
294 | 296 |
295 /** | 297 /** |
296 * @private | 298 * @private |
297 * Update the loading progress of the document in response to a progress | 299 * Update the loading progress of the document in response to a progress |
298 * message being received from the plugin. | 300 * message being received from the plugin. |
299 * @param {number} progress the progress as a percentage. | 301 * @param {number} progress the progress as a percentage. |
300 */ | 302 */ |
301 updateProgress_: function(progress) { | 303 updateProgress_: function(progress) { |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
569 | 571 |
570 /** | 572 /** |
571 * @type {Viewport} the viewport of the PDF viewer. | 573 * @type {Viewport} the viewport of the PDF viewer. |
572 */ | 574 */ |
573 get viewport() { | 575 get viewport() { |
574 return this.viewport_; | 576 return this.viewport_; |
575 } | 577 } |
576 }; | 578 }; |
577 | 579 |
578 var viewer = new PDFViewer(); | 580 var viewer = new PDFViewer(); |
OLD | NEW |