OLD | NEW |
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 * The increment to scroll a page by in pixels when up/down/left/right arrow | 60 * The increment to scroll a page by in pixels when up/down/left/right arrow |
61 * keys are pressed. Usually we just let the browser handle scrolling on the | 61 * keys are pressed. Usually we just let the browser handle scrolling on the |
62 * window when these keys are pressed but in certain cases we need to simulate | 62 * window when these keys are pressed but in certain cases we need to simulate |
63 * these events. | 63 * these events. |
64 */ | 64 */ |
65 Viewport.SCROLL_INCREMENT = 40; | 65 Viewport.SCROLL_INCREMENT = 40; |
66 | 66 |
67 /** | 67 /** |
68 * Predefined zoom factors to be used when zooming in/out. These are in | 68 * Predefined zoom factors to be used when zooming in/out. These are in |
69 * ascending order. This should match the list in | 69 * ascending order. This should match the list in |
70 * chrome/browser/chrome_page_zoom_constants.cc. | 70 * components/ui/zoom/page_zoom_constants.h |
71 */ | 71 */ |
72 Viewport.ZOOM_FACTORS = [0.25, 0.333, 0.5, 0.666, 0.75, 0.9, 1, | 72 Viewport.ZOOM_FACTORS = [0.25, 0.333, 0.5, 0.666, 0.75, 0.9, 1, |
73 1.1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5]; | 73 1.1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5]; |
74 | 74 |
75 /** | 75 /** |
76 * The minimum and maximum range to be used to clip zoom factor. | 76 * The minimum and maximum range to be used to clip zoom factor. |
77 */ | 77 */ |
78 Viewport.ZOOM_FACTOR_RANGE = { | 78 Viewport.ZOOM_FACTOR_RANGE = { |
79 min: Viewport.ZOOM_FACTORS[0], | 79 min: Viewport.ZOOM_FACTORS[0], |
80 max: Viewport.ZOOM_FACTORS[Viewport.ZOOM_FACTORS.length - 1] | 80 max: Viewport.ZOOM_FACTORS[Viewport.ZOOM_FACTORS.length - 1] |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 spaceOnLeft = Math.max(spaceOnLeft, 0); | 539 spaceOnLeft = Math.max(spaceOnLeft, 0); |
540 | 540 |
541 return { | 541 return { |
542 x: x * this.zoom_ + spaceOnLeft - this.window_.pageXOffset, | 542 x: x * this.zoom_ + spaceOnLeft - this.window_.pageXOffset, |
543 y: insetDimensions.y * this.zoom_ - this.window_.pageYOffset, | 543 y: insetDimensions.y * this.zoom_ - this.window_.pageYOffset, |
544 width: insetDimensions.width * this.zoom_, | 544 width: insetDimensions.width * this.zoom_, |
545 height: insetDimensions.height * this.zoom_ | 545 height: insetDimensions.height * this.zoom_ |
546 }; | 546 }; |
547 } | 547 } |
548 }; | 548 }; |
OLD | NEW |