Chromium Code Reviews| 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..65c8613b4e59b9413a973ab0aa7d03ecc99a2638 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.pluginFormFieldFocus_ = false; |
|
raymes
2015/09/22 04:35:25
nit: maybe just:
isFormFieldFocused_
tsergeant
2015/09/22 04:55:28
Done.
|
| 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.pluginFormFieldFocus_)) { |
| 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.pluginFormFieldFocus_)) { |
| 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.pluginFormFieldFocus_ = message.data.focused; |
| + break; |
| } |
| }, |