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

Unified Diff: chrome/browser/resources/pdf/pdf.js

Issue 2283803003: PDF: Add shortcut to toggle fit-to-{page,width}. (Closed)
Patch Set: Created 4 years, 4 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 | « no previous file | 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..05c717330a00bf0770144ec919c2cb04fb92bbe5 100644
--- a/chrome/browser/resources/pdf/pdf.js
+++ b/chrome/browser/resources/pdf/pdf.js
@@ -396,6 +396,15 @@ PDFViewer.prototype = {
if (e.ctrlKey)
this.rotateCounterClockwise_();
return;
+ case 220: // Backslash key.
+ 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.
+ if (this.viewport_.fittingType == Viewport.FittingType.FIT_TO_PAGE) {
+ this.fitToWidth_();
+ } else {
+ this.fitToPage_();
+ }
+ }
+ return;
case 221: // right bracket.
if (e.ctrlKey)
this.rotateClockwise_();
@@ -442,6 +451,10 @@ PDFViewer.prototype = {
});
},
+ /**
+ * @private
+ * Set zoom to "fit to page".
+ */
fitToPage_: function() {
this.viewport_.fitToPage();
this.toolbarManager_.forceHideTopToolbar();
@@ -449,6 +462,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 | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698