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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 /** | 67 /** |
68 * The increment to scroll a page by in pixels when up/down/left/right arrow | 68 * The increment to scroll a page by in pixels when up/down/left/right arrow |
69 * keys are pressed. Usually we just let the browser handle scrolling on the | 69 * keys are pressed. Usually we just let the browser handle scrolling on the |
70 * window when these keys are pressed but in certain cases we need to simulate | 70 * window when these keys are pressed but in certain cases we need to simulate |
71 * these events. | 71 * these events. |
72 */ | 72 */ |
73 Viewport.SCROLL_INCREMENT = 40; | 73 Viewport.SCROLL_INCREMENT = 40; |
74 | 74 |
75 /** | 75 /** |
76 * Predefined zoom factors to be used when zooming in/out. These are in | 76 * Predefined zoom factors to be used when zooming in/out. These are in |
77 * ascending order. This should match the list in | 77 * ascending order. This should match the lists in |
78 * components/ui/zoom/page_zoom_constants.h | 78 * components/ui/zoom/page_zoom_constants.h and |
| 79 * chrome/browser/resources/settings/appearance_page/appearance_page.js |
79 */ | 80 */ |
80 Viewport.ZOOM_FACTORS = [0.25, 1 / 3, 0.5, 2 / 3, 0.75, 0.8, 0.9, | 81 Viewport.ZOOM_FACTORS = [0.25, 1 / 3, 0.5, 2 / 3, 0.75, 0.8, 0.9, |
81 1, 1.1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5]; | 82 1, 1.1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5]; |
82 | 83 |
83 /** | 84 /** |
84 * The minimum and maximum range to be used to clip zoom factor. | 85 * The minimum and maximum range to be used to clip zoom factor. |
85 */ | 86 */ |
86 Viewport.ZOOM_FACTOR_RANGE = { | 87 Viewport.ZOOM_FACTOR_RANGE = { |
87 min: Viewport.ZOOM_FACTORS[0], | 88 min: Viewport.ZOOM_FACTORS[0], |
88 max: Viewport.ZOOM_FACTORS[Viewport.ZOOM_FACTORS.length - 1] | 89 max: Viewport.ZOOM_FACTORS[Viewport.ZOOM_FACTORS.length - 1] |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 spaceOnLeft = Math.max(spaceOnLeft, 0); | 590 spaceOnLeft = Math.max(spaceOnLeft, 0); |
590 | 591 |
591 return { | 592 return { |
592 x: x * this.zoom_ + spaceOnLeft - this.window_.pageXOffset, | 593 x: x * this.zoom_ + spaceOnLeft - this.window_.pageXOffset, |
593 y: insetDimensions.y * this.zoom_ - this.window_.pageYOffset, | 594 y: insetDimensions.y * this.zoom_ - this.window_.pageYOffset, |
594 width: insetDimensions.width * this.zoom_, | 595 width: insetDimensions.width * this.zoom_, |
595 height: insetDimensions.height * this.zoom_ | 596 height: insetDimensions.height * this.zoom_ |
596 }; | 597 }; |
597 } | 598 } |
598 }; | 599 }; |
OLD | NEW |