summaryrefslogtreecommitdiff
path: root/third-party/pdfjs/epiphany-pdfjs-changes.patch
diff options
context:
space:
mode:
Diffstat (limited to 'third-party/pdfjs/epiphany-pdfjs-changes.patch')
-rw-r--r--third-party/pdfjs/epiphany-pdfjs-changes.patch124
1 files changed, 124 insertions, 0 deletions
diff --git a/third-party/pdfjs/epiphany-pdfjs-changes.patch b/third-party/pdfjs/epiphany-pdfjs-changes.patch
new file mode 100644
index 000000000..aad19fd2e
--- /dev/null
+++ b/third-party/pdfjs/epiphany-pdfjs-changes.patch
@@ -0,0 +1,124 @@
+diff -urN web2/locale/bn/viewer.properties web/locale/bn/viewer.properties
+diff -urN web2/locale/bo/viewer.properties web/locale/bo/viewer.properties
+diff -urN web2/locale/dsb/viewer.properties web/locale/dsb/viewer.properties
+diff -urN web2/locale/trs/viewer.properties web/locale/trs/viewer.properties
+diff -urN web2/viewer.css web/viewer.css
+--- web2/viewer.css 2019-10-03 23:09:02.000000000 +0200
++++ web/viewer.css 2020-01-02 00:24:02.404916203 +0100
+@@ -1,4 +1,5 @@
+ /* Copyright 2014 Mozilla Foundation
++ * Modifications made for Epiphany by Jan-Michael Brummer <jan.brummer@tabos.org>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -1189,6 +1190,7 @@
+ }
+
+ .dropdownToolbarButton > select {
++ -webkit-appearance: none;
+ min-width: 140px;
+ font-size: 12px;
+ color: hsl(0,0%,95%);
+@@ -1523,6 +1525,7 @@
+ }
+
+ .toolbarField.pageNumber {
++ -webkit-appearance: none;
+ -moz-appearance: textfield; /* hides the spinner in moz */
+ min-width: 16px;
+ text-align: right;
+diff -urN web2/viewer.html web/viewer.html
+--- web2/viewer.html 2019-10-03 23:09:02.000000000 +0200
++++ web/viewer.html 2020-01-03 10:26:10.089369058 +0100
+@@ -1,6 +1,7 @@
+ <!DOCTYPE html>
+ <!--
+ Copyright 2012 Mozilla Foundation
++* Modifications made for Epiphany by Jan-Michael Brummer <jan.brummer@tabos.org>
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+@@ -21,7 +22,7 @@
+ See https://github.com/adobe-type-tools/cmap-resources
+ -->
+ <html dir="ltr" mozdisallowselectionprint>
+- <head>
++ <head pdf_data="%s" pdf_name="%s">
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+ <meta name="google" content="notranslate">
+@@ -29,6 +30,7 @@
+ <title>PDF.js viewer</title>
+
+
++ <base href="ephy-resource:///org/gnome/epiphany/pdfjs/web/">
+ <link rel="stylesheet" href="viewer.css">
+
+
+diff -urN web2/viewer.js web/viewer.js
+--- web2/viewer.js 2019-10-03 23:09:32.000000000 +0200
++++ web/viewer.js 2020-01-03 12:10:34.247711756 +0100
+@@ -3,6 +3,7 @@
+ * Javascript code in this page
+ *
+ * Copyright 2019 Mozilla Foundation
++ * Modifications made for Epiphany by Jan-Michael Brummer <jan.brummer@tabos.org>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+@@ -1829,8 +1830,7 @@
+ var file;
+ var queryString = document.location.search.substring(1);
+ var params = (0, _ui_utils.parseQueryString)(queryString);
+- file = 'file' in params ? params.file : _app_options.AppOptions.get('defaultUrl');
+- validateFileURL(file);
++ file = ''
+ var fileInput = document.createElement('input');
+ fileInput.id = appConfig.openFileInputName;
+ fileInput.className = 'fileInput';
+@@ -1838,12 +1838,10 @@
+ fileInput.oncontextmenu = _ui_utils.noContextMenuHandler;
+ document.body.appendChild(fileInput);
+
+- if (!window.File || !window.FileReader || !window.FileList || !window.Blob) {
+- appConfig.toolbar.openFile.setAttribute('hidden', 'true');
+- appConfig.secondaryToolbar.openFileButton.setAttribute('hidden', 'true');
+- } else {
+- fileInput.value = null;
+- }
++ appConfig.toolbar.openFile.setAttribute('hidden', 'true');
++ appConfig.secondaryToolbar.openFileButton.setAttribute('hidden', 'true');
++
++ appConfig.toolbar.viewBookmark.setAttribute('hidden', 'true');
+
+ fileInput.addEventListener('change', function (evt) {
+ var files = evt.target.files;
+@@ -1897,8 +1895,18 @@
+ }
+ }, true);
+
++ var file_name = document.head.getAttribute('pdf_name')
++ var raw = atob(document.head.getAttribute('pdf_data'));
++ var raw_length = raw.length;
++ var array = new Uint8Array(new ArrayBuffer(raw_length));
++
++ for(var i = 0; i < raw_length; i++) {
++ array[i] = raw.charCodeAt(i);
++ }
++
+ try {
+- webViewerOpenFileViaURL(file);
++ PDFViewerApplication.open(array);
++ PDFViewerApplication.setTitleUsingUrl(file_name);
+ } catch (reason) {
+ PDFViewerApplication.l10n.get('loading_error', null, 'An error occurred while loading the PDF.').then(function (msg) {
+ PDFViewerApplication.error(msg, reason);
+@@ -7785,6 +7793,8 @@
+ }
+ }
+
++ // FIXME: This currently breaks Epiphany due to rewriting history with baseUrl
++ return;
+ if (shouldReplace) {
+ if (newUrl) {
+ window.history.replaceState(newState, '', newUrl);