| Index: chrome/browser/resources/pdf/pdf.js
|
| diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js
|
| index 97b7fa095aed2354f975e821e937f50c8b7af3ba..2cc2a70639924a055e599a1e758d57003afc4ca9 100644
|
| --- a/chrome/browser/resources/pdf/pdf.js
|
| +++ b/chrome/browser/resources/pdf/pdf.js
|
| @@ -52,6 +52,21 @@ function onNavigateInNewTab(url) {
|
| }
|
|
|
| /**
|
| + * Whether keydown events should currently be ignored. Events are ignored when
|
| + * an editable element has focus, to allow for proper editing controls.
|
| + * @param {HTMLElement} activeElement The currently selected DOM node.
|
| + * @return {boolean} True if keydown events should be ignored.
|
| + */
|
| +function shouldIgnoreKeyEvents(activeElement) {
|
| + while (activeElement.shadowRoot != null)
|
| + activeElement = activeElement.shadowRoot.activeElement;
|
| +
|
| + return (activeElement.isContentEditable ||
|
| + activeElement.tagName == 'INPUT' ||
|
| + activeElement.tagName == 'TEXTAREA');
|
| +}
|
| +
|
| +/**
|
| * The minimum number of pixels to offset the toolbar by from the bottom and
|
| * right side of the screen.
|
| */
|
| @@ -206,6 +221,9 @@ PDFViewer.prototype = {
|
| // Certain scroll events may be sent from outside of the extension.
|
| var fromScriptingAPI = e.fromScriptingAPI;
|
|
|
| + if (shouldIgnoreKeyEvents(document.activeElement) || e.defaultPrevented)
|
| + return;
|
| +
|
| var pageUpHandler = function() {
|
| // Go to the previous page if we are fit-to-page.
|
| if (this.viewport_.fittingType == Viewport.FittingType.FIT_TO_PAGE) {
|
| @@ -623,7 +641,7 @@ PDFViewer.prototype = {
|
| // Update the page indicator.
|
| var visiblePage = this.viewport_.getMostVisiblePage();
|
| if (this.isMaterial_) {
|
| - this.materialToolbar_.pageIndex = visiblePage;
|
| + this.materialToolbar_.pageNo = visiblePage + 1;
|
| } else {
|
| this.pageIndicator_.index = visiblePage;
|
| if (this.documentDimensions_.pageDimensions.length > 1 &&
|
|
|