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 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 /** | 63 /** |
64 * The increment to scroll a page by in pixels when up/down/left/right arrow | 64 * The increment to scroll a page by in pixels when up/down/left/right arrow |
65 * keys are pressed. Usually we just let the browser handle scrolling on the | 65 * keys are pressed. Usually we just let the browser handle scrolling on the |
66 * window when these keys are pressed but in certain cases we need to simulate | 66 * window when these keys are pressed but in certain cases we need to simulate |
67 * these events. | 67 * these events. |
68 */ | 68 */ |
69 Viewport.SCROLL_INCREMENT = 40; | 69 Viewport.SCROLL_INCREMENT = 40; |
70 | 70 |
71 /** | 71 /** |
72 * Predefined zoom factors to be used when zooming in/out. These are in | 72 * Predefined zoom factors to be used when zooming in/out. These are in |
73 * ascending order. | 73 * ascending order. This should match the list in |
| 74 * chrome/browser/chrome_page_zoom_constants.cc. |
74 */ | 75 */ |
75 Viewport.ZOOM_FACTORS = [0.25, 0.333, 0.5, 0.666, 0.75, 0.9, 1, | 76 Viewport.ZOOM_FACTORS = [0.25, 0.333, 0.5, 0.666, 0.75, 0.9, 1, |
76 1.1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5]; | 77 1.1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5]; |
77 | 78 |
78 /** | 79 /** |
79 * The width of the page shadow around pages in pixels. | 80 * The width of the page shadow around pages in pixels. |
80 */ | 81 */ |
81 Viewport.PAGE_SHADOW = {top: 3, bottom: 7, left: 5, right: 5}; | 82 Viewport.PAGE_SHADOW = {top: 3, bottom: 7, left: 5, right: 5}; |
82 | 83 |
83 Viewport.prototype = { | 84 Viewport.prototype = { |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 spaceOnLeft = Math.max(spaceOnLeft, 0); | 530 spaceOnLeft = Math.max(spaceOnLeft, 0); |
530 | 531 |
531 return { | 532 return { |
532 x: x * this.zoom_ + spaceOnLeft - this.window_.pageXOffset, | 533 x: x * this.zoom_ + spaceOnLeft - this.window_.pageXOffset, |
533 y: insetDimensions.y * this.zoom_ - this.window_.pageYOffset, | 534 y: insetDimensions.y * this.zoom_ - this.window_.pageYOffset, |
534 width: insetDimensions.width * this.zoom_, | 535 width: insetDimensions.width * this.zoom_, |
535 height: insetDimensions.height * this.zoom_ | 536 height: insetDimensions.height * this.zoom_ |
536 }; | 537 }; |
537 } | 538 } |
538 }; | 539 }; |
OLD | NEW |