diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-05-15 10:20:33 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-05-15 10:28:57 +0000 |
commit | d17ea114e5ef69ad5d5d7413280a13e6428098aa (patch) | |
tree | 2c01a75df69f30d27b1432467cfe7c1467a498da /chromium/chrome/browser/resources/pdf | |
parent | 8c5c43c7b138c9b4b0bf56d946e61d3bbc111bec (diff) |
BASELINE: Update Chromium to 67.0.3396.47
Change-Id: Idcb1341782e417561a2473eeecc82642dafda5b7
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'chromium/chrome/browser/resources/pdf')
10 files changed, 64 insertions, 28 deletions
diff --git a/chromium/chrome/browser/resources/pdf/OWNERS b/chromium/chrome/browser/resources/pdf/OWNERS index fe12ac0938b..81f6835646c 100644 --- a/chromium/chrome/browser/resources/pdf/OWNERS +++ b/chromium/chrome/browser/resources/pdf/OWNERS @@ -1,3 +1,4 @@ dsinclair@chromium.org +hnakashima@chromium.org # COMPONENT: Internals>Plugins>PDF diff --git a/chromium/chrome/browser/resources/pdf/content_script.js b/chromium/chrome/browser/resources/pdf/content_script.js deleted file mode 100644 index dce77e6fdd7..00000000000 --- a/chromium/chrome/browser/resources/pdf/content_script.js +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This is to work-around an issue where this extension is not granted -// permission to access chrome://resources when iframed for print preview. -// See https://crbug.com/444752. diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-error-screen/viewer-error-screen.html b/chromium/chrome/browser/resources/pdf/elements/viewer-error-screen/viewer-error-screen.html index 6844a004b41..b5032dbb7a2 100644 --- a/chromium/chrome/browser/resources/pdf/elements/viewer-error-screen/viewer-error-screen.html +++ b/chromium/chrome/browser/resources/pdf/elements/viewer-error-screen/viewer-error-screen.html @@ -6,7 +6,7 @@ <dom-module id="viewer-error-screen"> <template> <style include="cr-shared-style"></style> - <dialog is="cr-dialog" id="dialog" no-cancel> + <cr-dialog id="dialog" no-cancel> <div slot="title"> [[strings.errorDialogTitle]] </div> @@ -18,7 +18,7 @@ [[strings.pageReload]] </paper-button> </div> - </dialog> + </cr-dialog> </template> <script src="viewer-error-screen.js"></script> </dom-module> diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-password-screen/viewer-password-screen.html b/chromium/chrome/browser/resources/pdf/elements/viewer-password-screen/viewer-password-screen.html index 485a061243c..8259dacb19b 100644 --- a/chromium/chrome/browser/resources/pdf/elements/viewer-password-screen/viewer-password-screen.html +++ b/chromium/chrome/browser/resources/pdf/elements/viewer-password-screen/viewer-password-screen.html @@ -15,7 +15,7 @@ }; } </style> - <dialog is="cr-dialog" id="dialog" no-cancel> + <cr-dialog id="dialog" no-cancel> <div slot="title">[[strings.passwordDialogTitle]]</div> <div slot="body"> <div id="message">[[strings.passwordPrompt]]</div> @@ -32,7 +32,7 @@ [[strings.passwordSubmit]] </paper-button> </div> - </dialog> + </cr-dialog> </template> <script src="viewer-password-screen.js"></script> </dom-module> diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.html b/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.html index af50fd9f2ab..b7e067c3b89 100644 --- a/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.html +++ b/chromium/chrome/browser/resources/pdf/elements/viewer-pdf-toolbar/viewer-pdf-toolbar.html @@ -3,6 +3,7 @@ <link rel="import" href="chrome://resources/polymer/v1_0/neon-animation/animations/slide-up-animation.html"> <link rel="import" href="chrome://resources/polymer/v1_0/neon-animation/animations/transform-animation.html"> <link rel="import" href="chrome://resources/polymer/v1_0/neon-animation/neon-animation-runner-behavior.html"> +<link rel="import" href="chrome://resources/polymer/v1_0/neon-animation/web-animations.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper-icon-button.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-progress/paper-progress.html"> <link rel="import" href="chrome://resources/cr_elements/icons.html"> diff --git a/chromium/chrome/browser/resources/pdf/index.html b/chromium/chrome/browser/resources/pdf/index.html index 69c1c39c8c4..dcec3cc7343 100644 --- a/chromium/chrome/browser/resources/pdf/index.html +++ b/chromium/chrome/browser/resources/pdf/index.html @@ -1,7 +1,6 @@ <!doctype html> <html> <head> - <base href="chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/"> <meta charset="utf-8"> <link rel="import" href="elements/viewer-error-screen/viewer-error-screen.html"> <link rel="import" href="elements/viewer-page-indicator/viewer-page-indicator.html"> diff --git a/chromium/chrome/browser/resources/pdf/manifest.json b/chromium/chrome/browser/resources/pdf/manifest.json index c3d0a802dd8..6e09e51d69f 100644 --- a/chromium/chrome/browser/resources/pdf/manifest.json +++ b/chromium/chrome/browser/resources/pdf/manifest.json @@ -16,11 +16,5 @@ "application/pdf" ], "content_security_policy": "script-src 'self' blob: filesystem: chrome://resources; object-src * blob: externalfile: file: filesystem: data:; plugin-types application/x-google-chrome-pdf", - "mime_types_handler": "index.html", - "web_accessible_resources": [ - "*.js", - "*.html", - "*.css", - "*.png" - ] + "mime_types_handler": "index.html" } diff --git a/chromium/chrome/browser/resources/pdf/pdf.js b/chromium/chrome/browser/resources/pdf/pdf.js index 029f5b231af..0f032245af0 100644 --- a/chromium/chrome/browser/resources/pdf/pdf.js +++ b/chromium/chrome/browser/resources/pdf/pdf.js @@ -699,12 +699,10 @@ PDFViewer.prototype = { this.sendDocumentLoadedMessage_(); break; case 'setScrollPosition': - var position = this.viewport_.position; - if (message.data.x !== undefined) - position.x = message.data.x; - if (message.data.y !== undefined) - position.y = message.data.y; - this.viewport_.position = position; + this.viewport_.scrollTo(/** @type {!PartialPoint} */ (message.data)); + break; + case 'scrollBy': + this.viewport_.scrollBy(/** @type {!Point} */ (message.data)); break; case 'cancelStreamUrl': chrome.mimeHandlerPrivate.abortStream(); diff --git a/chromium/chrome/browser/resources/pdf/pdf_scripting_api.js b/chromium/chrome/browser/resources/pdf/pdf_scripting_api.js index a133b5268f5..b4ed5b9b944 100644 --- a/chromium/chrome/browser/resources/pdf/pdf_scripting_api.js +++ b/chromium/chrome/browser/resources/pdf/pdf_scripting_api.js @@ -231,13 +231,14 @@ PDFScriptingAPI.prototype = { * interface which provides access to various features of the viewer for use * by print preview and accessibility. * @param {string} src the source URL of the PDF to load initially. + * @param {string} baseUrl the base URL of the PDF viewer * @return {HTMLIFrameElement} the iframe element containing the PDF viewer. */ -function PDFCreateOutOfProcessPlugin(src) { +function PDFCreateOutOfProcessPlugin(src, baseUrl) { var client = new PDFScriptingAPI(window, null); var iframe = assertInstanceof( window.document.createElement('iframe'), HTMLIFrameElement); - iframe.setAttribute('src', 'pdf_preview.html?' + src); + iframe.setAttribute('src', baseUrl + '/index.html?' + src); // Prevent the frame from being tab-focusable. iframe.setAttribute('tabindex', '-1'); diff --git a/chromium/chrome/browser/resources/pdf/viewport.js b/chromium/chrome/browser/resources/pdf/viewport.js index 709b646ff6d..ddf9312491d 100644 --- a/chromium/chrome/browser/resources/pdf/viewport.js +++ b/chromium/chrome/browser/resources/pdf/viewport.js @@ -3,6 +3,22 @@ // found in the LICENSE file. /** + * @typedef {{ + * x: number, + * y: number + * }} + */ +let Point; + +/** + * @typedef {{ + * x: number | undefined, + * y: number | undefined + * }} + */ +let PartialPoint; + +/** * Returns the height of the intersection of two rectangles. * @param {Object} rect1 the first rect * @param {Object} rect2 the second rect @@ -254,7 +270,7 @@ Viewport.prototype = { /** * Scroll the viewport to the specified position. - * @type {Object} position the position to scroll to. + * @type {Object} position The position to scroll to. */ set position(position) { this.window_.scrollTo(position.x, position.y + this.topToolbarHeight_); @@ -906,5 +922,38 @@ Viewport.prototype = { return ( this.fittingType_ == FittingType.FIT_TO_PAGE || this.fittingType_ == FittingType.FIT_TO_HEIGHT); + }, + + /** + * Scroll the viewport to the specified position. + * + * @param {!PartialPoint} point The position to which to move the viewport. + */ + scrollTo: function(point) { + let changed = false; + const newPosition = this.position; + if (point.x !== undefined && point.x != newPosition.x) { + newPosition.x = point.x; + changed = true; + } + if (point.y !== undefined && point.y != newPosition.y) { + newPosition.y = point.y; + changed = true; + } + + if (changed) + this.position = newPosition; + }, + + /** + * Scroll the viewport by the specified delta. + * + * @param {!Point} delta The delta by which to move the viewport. + */ + scrollBy: function(delta) { + const newPosition = this.position; + newPosition.x += delta.x; + newPosition.y += delta.y; + this.scrollTo(newPosition); } }; |