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

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

Issue 2283803003: PDF: Add shortcut to toggle fit-to-{page,width}. (Closed)
Patch Set: sync button state 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 | « chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.js ('k') | 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) {
401 if (this.viewport_.fittingType == Viewport.FittingType.FIT_TO_PAGE) {
402 this.fitToWidth_();
403 } else {
404 this.fitToPage_();
405 }
406 this.zoomToolbar_.toggleFitButtonUIState();
raymes 2016/09/05 03:21:40 Could we just call fitToggle on the zoom toolbar?
Lei Zhang 2016/09/07 00:39:09 Done.
407 }
408 return;
399 case 221: // right bracket. 409 case 221: // right bracket.
400 if (e.ctrlKey) 410 if (e.ctrlKey)
401 this.rotateClockwise_(); 411 this.rotateClockwise_();
402 return; 412 return;
403 } 413 }
404 414
405 // Give print preview a chance to handle the key event. 415 // Give print preview a chance to handle the key event.
406 if (!fromScriptingAPI && this.isPrintPreview_) { 416 if (!fromScriptingAPI && this.isPrintPreview_) {
407 this.sendScriptingMessage_({ 417 this.sendScriptingMessage_({
408 type: 'sendKeyEvent', 418 type: 'sendKeyEvent',
(...skipping 26 matching lines...) Expand all
435 /** 445 /**
436 * @private 446 * @private
437 * Rotate the plugin counter-clockwise. 447 * Rotate the plugin counter-clockwise.
438 */ 448 */
439 rotateCounterClockwise_: function() { 449 rotateCounterClockwise_: function() {
440 this.plugin_.postMessage({ 450 this.plugin_.postMessage({
441 type: 'rotateCounterclockwise' 451 type: 'rotateCounterclockwise'
442 }); 452 });
443 }, 453 },
444 454
455 /**
456 * @private
457 * Set zoom to "fit to page".
458 */
445 fitToPage_: function() { 459 fitToPage_: function() {
446 this.viewport_.fitToPage(); 460 this.viewport_.fitToPage();
447 this.toolbarManager_.forceHideTopToolbar(); 461 this.toolbarManager_.forceHideTopToolbar();
448 }, 462 },
449 463
450 /** 464 /**
451 * @private 465 * @private
466 * Set zoom to "fit to width".
467 */
468 fitToWidth_: function() {
469 this.viewport_.fitToWidth();
470 this.toolbarManager_.forceHideTopToolbar();
471 },
472
473 /**
474 * @private
452 * Notify the plugin to print. 475 * Notify the plugin to print.
453 */ 476 */
454 print_: function() { 477 print_: function() {
455 this.plugin_.postMessage({ 478 this.plugin_.postMessage({
456 type: 'print' 479 type: 'print'
457 }); 480 });
458 }, 481 },
459 482
460 /** 483 /**
461 * @private 484 * @private
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 * Each bookmark is an Object containing a: 903 * Each bookmark is an Object containing a:
881 * - title 904 * - title
882 * - page (optional) 905 * - page (optional)
883 * - array of children (themselves bookmarks) 906 * - array of children (themselves bookmarks)
884 * @type {Array} the top-level bookmarks of the PDF. 907 * @type {Array} the top-level bookmarks of the PDF.
885 */ 908 */
886 get bookmarks() { 909 get bookmarks() {
887 return this.bookmarks_; 910 return this.bookmarks_;
888 } 911 }
889 }; 912 };
OLDNEW
« no previous file with comments | « chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698