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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/pdf/pdf.js
diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js
index c7b172078d7778472af64c4fe851a35bca15b73e..a048c8e0cf282371e0488f970421004d63fe93b2 100644
--- a/chrome/browser/resources/pdf/pdf.js
+++ b/chrome/browser/resources/pdf/pdf.js
@@ -396,6 +396,16 @@ PDFViewer.prototype = {
if (e.ctrlKey)
this.rotateCounterClockwise_();
return;
+ case 220: // Backslash key.
+ if (e.ctrlKey) {
+ if (this.viewport_.fittingType == Viewport.FittingType.FIT_TO_PAGE) {
+ this.fitToWidth_();
+ } else {
+ this.fitToPage_();
+ }
+ 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.
+ }
+ return;
case 221: // right bracket.
if (e.ctrlKey)
this.rotateClockwise_();
@@ -442,6 +452,10 @@ PDFViewer.prototype = {
});
},
+ /**
+ * @private
+ * Set zoom to "fit to page".
+ */
fitToPage_: function() {
this.viewport_.fitToPage();
this.toolbarManager_.forceHideTopToolbar();
@@ -449,6 +463,15 @@ PDFViewer.prototype = {
/**
* @private
+ * Set zoom to "fit to width".
+ */
+ fitToWidth_: function() {
+ this.viewport_.fitToWidth();
+ this.toolbarManager_.forceHideTopToolbar();
+ },
+
+ /**
+ * @private
* Notify the plugin to print.
*/
print_: function() {
« 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