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

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

Issue 1038573003: OOP PDF: Reset FittingType when manually setting the zoom. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | chrome/test/data/pdf/viewport_test.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 height of the intersection of two rectangles. 6 * Returns the height 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 height of the intersection of the rects 9 * @return {number} the height of the intersection of the rects
10 */ 10 */
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 // Scroll to the scaled scroll position. 235 // Scroll to the scaled scroll position.
236 this.window_.scrollTo(currentScrollPos[0] * newZoom, 236 this.window_.scrollTo(currentScrollPos[0] * newZoom,
237 currentScrollPos[1] * newZoom); 237 currentScrollPos[1] * newZoom);
238 }, 238 },
239 239
240 /** 240 /**
241 * Sets the zoom to the given zoom level. 241 * Sets the zoom to the given zoom level.
242 * @param {number} newZoom the zoom level to zoom to. 242 * @param {number} newZoom the zoom level to zoom to.
243 */ 243 */
244 setZoom: function(newZoom) { 244 setZoom: function(newZoom) {
245 this.fittingType_ = Viewport.FittingType.NONE;
245 newZoom = Math.max(Viewport.ZOOM_FACTOR_RANGE.min, 246 newZoom = Math.max(Viewport.ZOOM_FACTOR_RANGE.min,
246 Math.min(newZoom, Viewport.ZOOM_FACTOR_RANGE.max)); 247 Math.min(newZoom, Viewport.ZOOM_FACTOR_RANGE.max));
247 this.mightZoom_(function() { 248 this.mightZoom_(function() {
248 this.setZoomInternal_(newZoom); 249 this.setZoomInternal_(newZoom);
249 this.updateViewport_(); 250 this.updateViewport_();
250 }.bind(this)); 251 }.bind(this));
251 }, 252 },
252 253
253 /** 254 /**
254 * @type {number} the width of scrollbars in the viewport in pixels. 255 * @type {number} the width of scrollbars in the viewport in pixels.
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 spaceOnLeft = Math.max(spaceOnLeft, 0); 551 spaceOnLeft = Math.max(spaceOnLeft, 0);
551 552
552 return { 553 return {
553 x: x * this.zoom_ + spaceOnLeft - this.window_.pageXOffset, 554 x: x * this.zoom_ + spaceOnLeft - this.window_.pageXOffset,
554 y: insetDimensions.y * this.zoom_ - this.window_.pageYOffset, 555 y: insetDimensions.y * this.zoom_ - this.window_.pageYOffset,
555 width: insetDimensions.width * this.zoom_, 556 width: insetDimensions.width * this.zoom_,
556 height: insetDimensions.height * this.zoom_ 557 height: insetDimensions.height * this.zoom_
557 }; 558 };
558 } 559 }
559 }; 560 };
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/pdf/viewport_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698