Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: chrome/browser/resources/pdf/pdf.js

Issue 2283803003: PDF: Add shortcut to toggle fit-to-{page,width}. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 case 71: // g key. 389 case 71: // g key.
390 if (this.toolbar_ && (e.ctrlKey || e.metaKey) && e.altKey) { 390 if (this.toolbar_ && (e.ctrlKey || e.metaKey) && e.altKey) {
391 this.toolbarManager_.showToolbars(); 391 this.toolbarManager_.showToolbars();
392 this.toolbar_.selectPageNumber(); 392 this.toolbar_.selectPageNumber();
393 } 393 }
394 return; 394 return;
395 case 219: // left bracket. 395 case 219: // left bracket.
396 if (e.ctrlKey) 396 if (e.ctrlKey)
397 this.rotateCounterClockwise_(); 397 this.rotateCounterClockwise_();
398 return; 398 return;
399 case 220: // Backslash key.
400 if (e.ctrlKey) {
raymes 2016/08/29 03:35:09 Do you think it might be confusing that this might
Lei Zhang 2016/08/29 05:33:54 Probably. I'll take a closer look tomorrow.
Lei Zhang 2016/09/02 02:17:52 Today is tomorrow somewhere in the world.
401 if (this.viewport_.fittingType == Viewport.FittingType.FIT_TO_PAGE) {
402 this.fitToWidth_();
403 } else {
404 this.fitToPage_();
405 }
406 }
407 return;
399 case 221: // right bracket. 408 case 221: // right bracket.
400 if (e.ctrlKey) 409 if (e.ctrlKey)
401 this.rotateClockwise_(); 410 this.rotateClockwise_();
402 return; 411 return;
403 } 412 }
404 413
405 // Give print preview a chance to handle the key event. 414 // Give print preview a chance to handle the key event.
406 if (!fromScriptingAPI && this.isPrintPreview_) { 415 if (!fromScriptingAPI && this.isPrintPreview_) {
407 this.sendScriptingMessage_({ 416 this.sendScriptingMessage_({
408 type: 'sendKeyEvent', 417 type: 'sendKeyEvent',
(...skipping 26 matching lines...) Expand all
435 /** 444 /**
436 * @private 445 * @private
437 * Rotate the plugin counter-clockwise. 446 * Rotate the plugin counter-clockwise.
438 */ 447 */
439 rotateCounterClockwise_: function() { 448 rotateCounterClockwise_: function() {
440 this.plugin_.postMessage({ 449 this.plugin_.postMessage({
441 type: 'rotateCounterclockwise' 450 type: 'rotateCounterclockwise'
442 }); 451 });
443 }, 452 },
444 453
454 /**
455 * @private
456 * Set zoom to "fit to page".
457 */
445 fitToPage_: function() { 458 fitToPage_: function() {
446 this.viewport_.fitToPage(); 459 this.viewport_.fitToPage();
447 this.toolbarManager_.forceHideTopToolbar(); 460 this.toolbarManager_.forceHideTopToolbar();
448 }, 461 },
449 462
450 /** 463 /**
451 * @private 464 * @private
465 * Set zoom to "fit to width".
466 */
467 fitToWidth_: function() {
468 this.viewport_.fitToWidth();
469 this.toolbarManager_.forceHideTopToolbar();
470 },
471
472 /**
473 * @private
452 * Notify the plugin to print. 474 * Notify the plugin to print.
453 */ 475 */
454 print_: function() { 476 print_: function() {
455 this.plugin_.postMessage({ 477 this.plugin_.postMessage({
456 type: 'print' 478 type: 'print'
457 }); 479 });
458 }, 480 },
459 481
460 /** 482 /**
461 * @private 483 * @private
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 * Each bookmark is an Object containing a: 902 * Each bookmark is an Object containing a:
881 * - title 903 * - title
882 * - page (optional) 904 * - page (optional)
883 * - array of children (themselves bookmarks) 905 * - array of children (themselves bookmarks)
884 * @type {Array} the top-level bookmarks of the PDF. 906 * @type {Array} the top-level bookmarks of the PDF.
885 */ 907 */
886 get bookmarks() { 908 get bookmarks() {
887 return this.bookmarks_; 909 return this.bookmarks_;
888 } 910 }
889 }; 911 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698