OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * @return {number} Width of a scrollbar in pixels | 8 * @return {number} Width of a scrollbar in pixels |
9 */ | 9 */ |
10 function getScrollbarWidth() { | 10 function getScrollbarWidth() { |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 return; | 255 return; |
256 case 33: // Page up key. | 256 case 33: // Page up key. |
257 pageUpHandler(); | 257 pageUpHandler(); |
258 return; | 258 return; |
259 case 34: // Page down key. | 259 case 34: // Page down key. |
260 pageDownHandler(); | 260 pageDownHandler(); |
261 return; | 261 return; |
262 case 37: // Left arrow key. | 262 case 37: // Left arrow key. |
263 if (!(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)) { | 263 if (!(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)) { |
264 // Go to the previous page if there are no horizontal scrollbars. | 264 // Go to the previous page if there are no horizontal scrollbars. |
265 if (!this.viewport_.documentHasScrollbars().x) { | 265 if (!this.viewport_.documentHasScrollbars().horizontal) { |
266 this.viewport_.goToPage(this.viewport_.getMostVisiblePage() - 1); | 266 this.viewport_.goToPage(this.viewport_.getMostVisiblePage() - 1); |
267 // Since we do the movement of the page. | 267 // Since we do the movement of the page. |
268 e.preventDefault(); | 268 e.preventDefault(); |
269 } else if (fromScriptingAPI) { | 269 } else if (fromScriptingAPI) { |
270 position.x -= Viewport.SCROLL_INCREMENT; | 270 position.x -= Viewport.SCROLL_INCREMENT; |
271 this.viewport.position = position; | 271 this.viewport.position = position; |
272 } | 272 } |
273 } | 273 } |
274 return; | 274 return; |
275 case 38: // Up arrow key. | 275 case 38: // Up arrow key. |
276 if (fromScriptingAPI) { | 276 if (fromScriptingAPI) { |
277 position.y -= Viewport.SCROLL_INCREMENT; | 277 position.y -= Viewport.SCROLL_INCREMENT; |
278 this.viewport.position = position; | 278 this.viewport.position = position; |
279 } | 279 } |
280 return; | 280 return; |
281 case 39: // Right arrow key. | 281 case 39: // Right arrow key. |
282 if (!(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)) { | 282 if (!(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)) { |
283 // Go to the next page if there are no horizontal scrollbars. | 283 // Go to the next page if there are no horizontal scrollbars. |
284 if (!this.viewport_.documentHasScrollbars().x) { | 284 if (!this.viewport_.documentHasScrollbars().horizontal) { |
285 this.viewport_.goToPage(this.viewport_.getMostVisiblePage() + 1); | 285 this.viewport_.goToPage(this.viewport_.getMostVisiblePage() + 1); |
286 // Since we do the movement of the page. | 286 // Since we do the movement of the page. |
287 e.preventDefault(); | 287 e.preventDefault(); |
288 } else if (fromScriptingAPI) { | 288 } else if (fromScriptingAPI) { |
289 position.x += Viewport.SCROLL_INCREMENT; | 289 position.x += Viewport.SCROLL_INCREMENT; |
290 this.viewport.position = position; | 290 this.viewport.position = position; |
291 } | 291 } |
292 } | 292 } |
293 return; | 293 return; |
294 case 40: // Down arrow key. | 294 case 40: // Down arrow key. |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 * Each bookmark is an Object containing a: | 799 * Each bookmark is an Object containing a: |
800 * - title | 800 * - title |
801 * - page (optional) | 801 * - page (optional) |
802 * - array of children (themselves bookmarks) | 802 * - array of children (themselves bookmarks) |
803 * @type {Array} the top-level bookmarks of the PDF. | 803 * @type {Array} the top-level bookmarks of the PDF. |
804 */ | 804 */ |
805 get bookmarks() { | 805 get bookmarks() { |
806 return this.bookmarks_; | 806 return this.bookmarks_; |
807 } | 807 } |
808 }; | 808 }; |
OLD | NEW |