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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 else | 313 else |
314 pageDownHandler(); | 314 pageDownHandler(); |
315 return; | 315 return; |
316 case 33: // Page up key. | 316 case 33: // Page up key. |
317 pageUpHandler(); | 317 pageUpHandler(); |
318 return; | 318 return; |
319 case 34: // Page down key. | 319 case 34: // Page down key. |
320 pageDownHandler(); | 320 pageDownHandler(); |
321 return; | 321 return; |
322 case 37: // Left arrow key. | 322 case 37: // Left arrow key. |
323 if (!(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)) { | 323 if (!hasKeyModifiers(e)) { |
324 // Go to the previous page if there are no horizontal scrollbars and | 324 // Go to the previous page if there are no horizontal scrollbars and |
325 // no form field is focused. | 325 // no form field is focused. |
326 if (!(this.viewport_.documentHasScrollbars().horizontal || | 326 if (!(this.viewport_.documentHasScrollbars().horizontal || |
327 this.isFormFieldFocused_)) { | 327 this.isFormFieldFocused_)) { |
328 this.viewport_.goToPage(this.viewport_.getMostVisiblePage() - 1); | 328 this.viewport_.goToPage(this.viewport_.getMostVisiblePage() - 1); |
329 // Since we do the movement of the page. | 329 // Since we do the movement of the page. |
330 e.preventDefault(); | 330 e.preventDefault(); |
331 } else if (fromScriptingAPI) { | 331 } else if (fromScriptingAPI) { |
332 position.x -= Viewport.SCROLL_INCREMENT; | 332 position.x -= Viewport.SCROLL_INCREMENT; |
333 this.viewport.position = position; | 333 this.viewport.position = position; |
334 } | 334 } |
335 } | 335 } |
336 return; | 336 return; |
337 case 38: // Up arrow key. | 337 case 38: // Up arrow key. |
338 if (fromScriptingAPI) { | 338 if (fromScriptingAPI) { |
339 position.y -= Viewport.SCROLL_INCREMENT; | 339 position.y -= Viewport.SCROLL_INCREMENT; |
340 this.viewport.position = position; | 340 this.viewport.position = position; |
341 } | 341 } |
342 return; | 342 return; |
343 case 39: // Right arrow key. | 343 case 39: // Right arrow key. |
344 if (!(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)) { | 344 if (!hasKeyModifiers(e)) { |
345 // Go to the next page if there are no horizontal scrollbars and no | 345 // Go to the next page if there are no horizontal scrollbars and no |
346 // form field is focused. | 346 // form field is focused. |
347 if (!(this.viewport_.documentHasScrollbars().horizontal || | 347 if (!(this.viewport_.documentHasScrollbars().horizontal || |
348 this.isFormFieldFocused_)) { | 348 this.isFormFieldFocused_)) { |
349 this.viewport_.goToPage(this.viewport_.getMostVisiblePage() + 1); | 349 this.viewport_.goToPage(this.viewport_.getMostVisiblePage() + 1); |
350 // Since we do the movement of the page. | 350 // Since we do the movement of the page. |
351 e.preventDefault(); | 351 e.preventDefault(); |
352 } else if (fromScriptingAPI) { | 352 } else if (fromScriptingAPI) { |
353 position.x += Viewport.SCROLL_INCREMENT; | 353 position.x += Viewport.SCROLL_INCREMENT; |
354 this.viewport.position = position; | 354 this.viewport.position = position; |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 * Each bookmark is an Object containing a: | 923 * Each bookmark is an Object containing a: |
924 * - title | 924 * - title |
925 * - page (optional) | 925 * - page (optional) |
926 * - array of children (themselves bookmarks) | 926 * - array of children (themselves bookmarks) |
927 * @type {Array} the top-level bookmarks of the PDF. | 927 * @type {Array} the top-level bookmarks of the PDF. |
928 */ | 928 */ |
929 get bookmarks() { | 929 get bookmarks() { |
930 return this.bookmarks_; | 930 return this.bookmarks_; |
931 } | 931 } |
932 }; | 932 }; |
OLD | NEW |