Index: chrome/browser/resources/pdf/pdf.js |
diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js |
index 536e7eab42f64138a56d2cf24648854b92f7ad6e..32b7e0c0fc0afeb2e3dbf00df249a802202da5a7 100644 |
--- a/chrome/browser/resources/pdf/pdf.js |
+++ b/chrome/browser/resources/pdf/pdf.js |
@@ -115,6 +115,7 @@ function PDFViewer(browserApi) { |
this.loadState_ = LoadState.LOADING; |
this.parentWindow_ = null; |
this.parentOrigin_ = null; |
+ this.isFormFieldFocused_ = false; |
this.delayedScriptingMessages_ = []; |
@@ -325,8 +326,10 @@ PDFViewer.prototype = { |
return; |
case 37: // Left arrow key. |
if (!(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)) { |
- // Go to the previous page if there are no horizontal scrollbars. |
- if (!this.viewport_.documentHasScrollbars().horizontal) { |
+ // Go to the previous page if there are no horizontal scrollbars and |
+ // no form field is focused. |
+ if (!(this.viewport_.documentHasScrollbars().horizontal || |
+ this.isFormFieldFocused_)) { |
this.viewport_.goToPage(this.viewport_.getMostVisiblePage() - 1); |
// Since we do the movement of the page. |
e.preventDefault(); |
@@ -344,8 +347,10 @@ PDFViewer.prototype = { |
return; |
case 39: // Right arrow key. |
if (!(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)) { |
- // Go to the next page if there are no horizontal scrollbars. |
- if (!this.viewport_.documentHasScrollbars().horizontal) { |
+ // Go to the next page if there are no horizontal scrollbars and no |
+ // form field is focused. |
+ if (!(this.viewport_.documentHasScrollbars().horizontal || |
+ this.isFormFieldFocused_)) { |
this.viewport_.goToPage(this.viewport_.getMostVisiblePage() + 1); |
// Since we do the movement of the page. |
e.preventDefault(); |
@@ -667,6 +672,9 @@ PDFViewer.prototype = { |
this.paramsParser_.onNamedDestinationReceived( |
message.data.pageNumber); |
break; |
+ case 'formFocusChange': |
+ this.isFormFieldFocused_ = message.data.focused; |
+ break; |
} |
}, |