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

Side by Side Diff: chrome/browser/resources/pdf/viewport.js

Issue 492433003: PDF: Do more robust page number parsing in OOP plugin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 /** 5 /**
6 * Returns the area of the intersection of two rectangles. 6 * Returns the area of the intersection of two rectangles.
7 * @param {Object} rect1 the first rect 7 * @param {Object} rect1 the first rect
8 * @param {Object} rect2 the second rect 8 * @param {Object} rect2 the second rect
9 * @return {number} the area of the intersection of the rects 9 * @return {number} the area of the intersection of the rects
10 */ 10 */
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 if (Viewport.ZOOM_FACTORS[i] > this.zoom_) 442 if (Viewport.ZOOM_FACTORS[i] > this.zoom_)
443 nextZoom = Viewport.ZOOM_FACTORS[i]; 443 nextZoom = Viewport.ZOOM_FACTORS[i];
444 } 444 }
445 this.setZoomInternal_(nextZoom); 445 this.setZoomInternal_(nextZoom);
446 this.updateViewport_(); 446 this.updateViewport_();
447 }.bind(this)); 447 }.bind(this));
448 }, 448 },
449 449
450 /** 450 /**
451 * Go to the given page index. 451 * Go to the given page index.
452 * @param {number} page the index of the page to go to. 452 * @param {number} page the index of the page to go to. zero-based.
453 */ 453 */
454 goToPage: function(page) { 454 goToPage: function(page) {
455 this.mightZoom_(function() { 455 this.mightZoom_(function() {
456 if (this.pageDimensions_.length == 0) 456 if (this.pageDimensions_.length == 0)
457 return; 457 return;
458 if (page < 0) 458 if (page < 0)
459 page = 0; 459 page = 0;
460 if (page >= this.pageDimensions_.length) 460 if (page >= this.pageDimensions_.length)
461 page = this.pageDimensions_.length - 1; 461 page = this.pageDimensions_.length - 1;
462 var dimensions = this.pageDimensions_[page]; 462 var dimensions = this.pageDimensions_[page];
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 spaceOnLeft = Math.max(spaceOnLeft, 0); 529 spaceOnLeft = Math.max(spaceOnLeft, 0);
530 530
531 return { 531 return {
532 x: x * this.zoom_ + spaceOnLeft - this.window_.pageXOffset, 532 x: x * this.zoom_ + spaceOnLeft - this.window_.pageXOffset,
533 y: insetDimensions.y * this.zoom_ - this.window_.pageYOffset, 533 y: insetDimensions.y * this.zoom_ - this.window_.pageYOffset,
534 width: insetDimensions.width * this.zoom_, 534 width: insetDimensions.width * this.zoom_,
535 height: insetDimensions.height * this.zoom_ 535 height: insetDimensions.height * this.zoom_
536 }; 536 };
537 } 537 }
538 }; 538 };
OLDNEW
« chrome/browser/resources/pdf/pdf.js ('K') | « chrome/browser/resources/pdf/pdf.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698