mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 861399 - Update pdf.js to version 0.8.47. r=bdahl
This commit is contained in:
parent
ac1916de10
commit
93bff3fb3d
@ -1,4 +1,4 @@
|
||||
This is the pdf.js project output, https://github.com/mozilla/pdf.js
|
||||
|
||||
Current extension version is: 0.7.423
|
||||
Current extension version is: 0.8.47
|
||||
|
||||
|
@ -101,23 +101,6 @@ function getDOMWindow(aChannel) {
|
||||
return win;
|
||||
}
|
||||
|
||||
function isEnabled() {
|
||||
if (MOZ_CENTRAL) {
|
||||
var disabled = getBoolPref(PREF_PREFIX + '.disabled', false);
|
||||
if (disabled)
|
||||
return false;
|
||||
// To also be considered enabled the "Preview in Firefox" option must be
|
||||
// selected in the Application preferences.
|
||||
var handlerInfo = Svc.mime
|
||||
.getFromTypeAndExtension('application/pdf', 'pdf');
|
||||
return !handlerInfo.alwaysAskBeforeHandling &&
|
||||
handlerInfo.preferredAction == Ci.nsIHandlerInfo.handleInternally;
|
||||
}
|
||||
// Always returns true for the extension since enabling/disabling is handled
|
||||
// by the add-on manager.
|
||||
return true;
|
||||
}
|
||||
|
||||
function getLocalizedStrings(path) {
|
||||
var stringBundle = Cc['@mozilla.org/intl/stringbundle;1'].
|
||||
getService(Ci.nsIStringBundleService).
|
||||
@ -268,10 +251,13 @@ ChromeActions.prototype = {
|
||||
var channel = Cc['@mozilla.org/network/input-stream-channel;1'].
|
||||
createInstance(Ci.nsIInputStreamChannel);
|
||||
channel.QueryInterface(Ci.nsIChannel);
|
||||
channel.contentDisposition = Ci.nsIChannel.DISPOSITION_ATTACHMENT;
|
||||
if (self.contentDispositionFilename) {
|
||||
channel.contentDispositionFilename = self.contentDispositionFilename;
|
||||
}
|
||||
try {
|
||||
// contentDisposition/contentDispositionFilename is readonly before FF18
|
||||
channel.contentDisposition = Ci.nsIChannel.DISPOSITION_ATTACHMENT;
|
||||
if (self.contentDispositionFilename) {
|
||||
channel.contentDispositionFilename = self.contentDispositionFilename;
|
||||
}
|
||||
} catch (e) {}
|
||||
channel.setURI(originalUri);
|
||||
channel.contentStream = aInputStream;
|
||||
if ('nsIPrivateBrowsingChannel' in Ci &&
|
||||
@ -380,6 +366,9 @@ ChromeActions.prototype = {
|
||||
var prefGfx = getBoolPref('gfx.downloadable_fonts.enabled', true);
|
||||
return (!!prefBrowser && prefGfx);
|
||||
},
|
||||
supportsDocumentColors: function() {
|
||||
return getBoolPref('browser.display.use_document_colors', true);
|
||||
},
|
||||
fallback: function(url, sendResponse) {
|
||||
var self = this;
|
||||
var domWindow = this.domWindow;
|
||||
@ -577,9 +566,6 @@ PdfStreamConverter.prototype = {
|
||||
|
||||
// nsIStreamConverter::asyncConvertData
|
||||
asyncConvertData: function(aFromType, aToType, aListener, aCtxt) {
|
||||
if (!isEnabled())
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
||||
// Store the listener passed to us
|
||||
this.listener = aListener;
|
||||
},
|
||||
|
@ -28,6 +28,8 @@ const PREF_PREVIOUS_ACTION = PREF_PREFIX + '.previousHandler.preferredAction';
|
||||
const PREF_PREVIOUS_ASK = PREF_PREFIX + '.previousHandler.alwaysAskBeforeHandling';
|
||||
const PREF_DISABLED_PLUGIN_TYPES = 'plugin.disable_full_page_plugin_for_types';
|
||||
const TOPIC_PDFJS_HANDLER_CHANGED = 'pdfjs:handlerChanged';
|
||||
const TOPIC_PLUGINS_LIST_UPDATED = "plugins-list-updated";
|
||||
const TOPIC_PLUGIN_INFO_UPDATED = "plugin-info-updated";
|
||||
const PDF_CONTENT_TYPE = 'application/pdf';
|
||||
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
@ -112,7 +114,10 @@ let PdfJs = {
|
||||
// Listen for when pdf.js is completely disabled or a different pdf handler
|
||||
// is chosen.
|
||||
Services.prefs.addObserver(PREF_DISABLED, this, false);
|
||||
Services.prefs.addObserver(PREF_DISABLED_PLUGIN_TYPES, this, false);
|
||||
Services.obs.addObserver(this, TOPIC_PDFJS_HANDLER_CHANGED, false);
|
||||
Services.obs.addObserver(this, TOPIC_PLUGINS_LIST_UPDATED, false);
|
||||
Services.obs.addObserver(this, TOPIC_PLUGIN_INFO_UPDATED, false);
|
||||
},
|
||||
|
||||
_migrate: function migrate() {
|
||||
@ -186,14 +191,39 @@ let PdfJs = {
|
||||
*/
|
||||
get enabled() {
|
||||
var disabled = getBoolPref(PREF_DISABLED, true);
|
||||
if (disabled)
|
||||
if (disabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var handlerInfo = Svc.mime.
|
||||
getFromTypeAndExtension('application/pdf', 'pdf');
|
||||
return handlerInfo.alwaysAskBeforeHandling == false &&
|
||||
handlerInfo.plugin == null &&
|
||||
handlerInfo.preferredAction == Ci.nsIHandlerInfo.handleInternally;
|
||||
// the 'application/pdf' handler is selected as internal?
|
||||
var handlerInfo = Svc.mime
|
||||
.getFromTypeAndExtension(PDF_CONTENT_TYPE, 'pdf');
|
||||
if (handlerInfo.alwaysAskBeforeHandling ||
|
||||
handlerInfo.preferredAction !== Ci.nsIHandlerInfo.handleInternally) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// we also need to check if pdf plugin is not present or disabled...
|
||||
let tags = Cc["@mozilla.org/plugin/host;1"].
|
||||
getService(Ci.nsIPluginHost).
|
||||
getPluginTags();
|
||||
let enabledPluginFound = tags.some(function(tag) {
|
||||
if (tag.disabled) {
|
||||
return false;
|
||||
}
|
||||
let mimeTypes = tag.getMimeTypes();
|
||||
return mimeTypes.some(function(mimeType) {
|
||||
return mimeType.type === PDF_CONTENT_TYPE;
|
||||
});
|
||||
});
|
||||
if (!enabledPluginFound) {
|
||||
return true; // no plugins for this type, it's good
|
||||
}
|
||||
// ... and full page plugins list must have 'application/pdf' type,
|
||||
// in case when enabled pdf plugin exists.
|
||||
return Services.prefs.prefHasUserValue(PREF_DISABLED_PLUGIN_TYPES) ?
|
||||
(Services.prefs.getCharPref(PREF_DISABLED_PLUGIN_TYPES).split(',').
|
||||
indexOf(PDF_CONTENT_TYPE) >= 0) : false;
|
||||
},
|
||||
|
||||
_ensureRegistered: function _ensureRegistered() {
|
||||
@ -205,7 +235,7 @@ let PdfJs = {
|
||||
|
||||
this._pdfRedirectorFactory = new Factory();
|
||||
this._pdfRedirectorFactory.register(PdfRedirector);
|
||||
Svc.pluginHost.registerPlayPreviewMimeType('application/pdf', true,
|
||||
Svc.pluginHost.registerPlayPreviewMimeType(PDF_CONTENT_TYPE, true,
|
||||
'data:application/x-moz-playpreview-pdfjs;,');
|
||||
|
||||
this._registered = true;
|
||||
@ -220,7 +250,7 @@ let PdfJs = {
|
||||
|
||||
this._pdfRedirectorFactory.unregister;
|
||||
delete this._pdfRedirectorFactory;
|
||||
Svc.pluginHost.unregisterPlayPreviewMimeType('application/pdf');
|
||||
Svc.pluginHost.unregisterPlayPreviewMimeType(PDF_CONTENT_TYPE);
|
||||
|
||||
this._registered = false;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -46,7 +46,7 @@ var FontInspector = (function FontInspectorClosure() {
|
||||
}
|
||||
}
|
||||
function textLayerClick(e) {
|
||||
if (!e.target.dataset.fontName || e.target.tagName != 'DIV')
|
||||
if (!e.target.dataset.fontName || e.target.tagName.toUpperCase() !== 'DIV')
|
||||
return;
|
||||
var fontName = e.target.dataset.fontName;
|
||||
var selects = document.getElementsByTagName('input');
|
||||
|
@ -88,6 +88,18 @@ select {
|
||||
margin-bottom: 100%;
|
||||
}
|
||||
|
||||
:-webkit-full-screen a:not(.internalLink) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:-moz-full-screen a:not(.internalLink) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:fullscreen a:not(.internalLink) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#viewerContainer.presentationControls {
|
||||
cursor: default;
|
||||
}
|
||||
@ -391,12 +403,14 @@ html[dir='ltr'] #toolbarViewerLeft > *,
|
||||
html[dir='ltr'] #toolbarViewerMiddle > *,
|
||||
html[dir='ltr'] #toolbarViewerRight > *,
|
||||
html[dir='ltr'] .findbar > * {
|
||||
position: relative;
|
||||
float: left;
|
||||
}
|
||||
html[dir='rtl'] #toolbarViewerLeft > *,
|
||||
html[dir='rtl'] #toolbarViewerMiddle > *,
|
||||
html[dir='rtl'] #toolbarViewerRight > *,
|
||||
html[dir='rtl'] .findbar > * {
|
||||
position: relative;
|
||||
float: right;
|
||||
}
|
||||
|
||||
@ -747,6 +761,14 @@ html[dir='rtl'] #findPrevious {
|
||||
html[dir='rtl'] #findNext {
|
||||
margin-left: 3px;
|
||||
}
|
||||
.toolbarButton::before {
|
||||
/* All matching images have a size of 16x16
|
||||
* (except for the print button: 18x16)
|
||||
* All relevant containers have a size of 32x25 */
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
left: 7px;
|
||||
}
|
||||
|
||||
html[dir='ltr'] .toolbarButton.findPrevious::before {
|
||||
display: inline-block;
|
||||
@ -806,6 +828,7 @@ html[dir='rtl'] .toolbarButton.pageDown::before {
|
||||
.toolbarButton.print::before {
|
||||
display: inline-block;
|
||||
content: url(images/toolbarButton-print.png);
|
||||
left: 6px;
|
||||
}
|
||||
|
||||
.toolbarButton.openFile::before {
|
||||
@ -1038,7 +1061,6 @@ html[dir='rtl'] .outlineItem > a {
|
||||
color: hsla(0,0%,100%,1);
|
||||
}
|
||||
|
||||
.noOutline,
|
||||
.noResults {
|
||||
font-size: 12px;
|
||||
color: hsla(0,0%,100%,.8);
|
||||
|
@ -922,7 +922,7 @@ var PDFView = {
|
||||
doc.webkitRequestFullScreen;
|
||||
|
||||
// Disable fullscreen button if we're in an iframe
|
||||
if (!!window.frameElement)
|
||||
if (window.parent !== window)
|
||||
support = false;
|
||||
|
||||
Object.defineProperty(this, 'supportsFullScreen', { value: support,
|
||||
@ -952,6 +952,16 @@ var PDFView = {
|
||||
return support;
|
||||
},
|
||||
|
||||
get supportsDocumentColors() {
|
||||
var support = true;
|
||||
support = FirefoxCom.requestSync('supportsDocumentColors');
|
||||
Object.defineProperty(this, 'supportsDocumentColors', { value: support,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: false });
|
||||
return support;
|
||||
},
|
||||
|
||||
get isHorizontalScrollbarEnabled() {
|
||||
var div = document.getElementById('viewerContainer');
|
||||
return div.scrollWidth > div.clientWidth;
|
||||
@ -1370,6 +1380,7 @@ var PDFView = {
|
||||
PDFJS.Promise.all(promises).then(function() {
|
||||
pdfDocument.getOutline().then(function(outline) {
|
||||
self.outline = new DocumentOutlineView(outline);
|
||||
document.getElementById('viewOutline').disabled = !outline;
|
||||
});
|
||||
|
||||
// Make all navigation keys work on document load,
|
||||
@ -1979,6 +1990,7 @@ var PageView = function pageView(container, id, scale,
|
||||
PDFView.navigateTo(dest);
|
||||
return false;
|
||||
};
|
||||
link.className = 'internalLink';
|
||||
}
|
||||
function createElementWithStyle(tagName, item, rect) {
|
||||
if (!rect) {
|
||||
@ -2233,6 +2245,13 @@ var PageView = function pageView(container, id, scale,
|
||||
'Web fonts are disabled: unable to use embedded PDF fonts.'));
|
||||
PDFView.fallback();
|
||||
}
|
||||
if (self.textLayer && self.textLayer.textDivs &&
|
||||
self.textLayer.textDivs.length > 0 &&
|
||||
!PDFView.supportsDocumentColors) {
|
||||
console.error(mozL10n.get('web_colors_disabled', null,
|
||||
'Web colors are disabled.'));
|
||||
PDFView.fallback();
|
||||
}
|
||||
if (error) {
|
||||
PDFView.error(mozL10n.get('rendering_error', null,
|
||||
'An error occurred while rendering the page.'), error);
|
||||
@ -2536,9 +2555,17 @@ var ThumbnailView = function thumbnailView(container, id, defaultViewport) {
|
||||
|
||||
var DocumentOutlineView = function documentOutlineView(outline) {
|
||||
var outlineView = document.getElementById('outlineView');
|
||||
var outlineButton = document.getElementById('viewOutline');
|
||||
while (outlineView.firstChild)
|
||||
outlineView.removeChild(outlineView.firstChild);
|
||||
|
||||
if (!outline) {
|
||||
if (!outlineView.classList.contains('hidden'))
|
||||
PDFView.switchSidebarView('thumbs');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function bindItemLink(domObj, item) {
|
||||
domObj.href = PDFView.getDestinationHash(item.dest);
|
||||
domObj.onclick = function documentOutlineViewOnclick(e) {
|
||||
@ -2547,14 +2574,6 @@ var DocumentOutlineView = function documentOutlineView(outline) {
|
||||
};
|
||||
}
|
||||
|
||||
if (!outline) {
|
||||
var noOutline = document.createElement('div');
|
||||
noOutline.classList.add('noOutline');
|
||||
noOutline.textContent = mozL10n.get('no_outline', null,
|
||||
'No Outline Available');
|
||||
outlineView.appendChild(noOutline);
|
||||
return;
|
||||
}
|
||||
|
||||
var queue = [{parent: outlineView, items: outline}];
|
||||
while (queue.length > 0) {
|
||||
@ -2643,7 +2662,6 @@ var TextLayerBuilder = function textLayerBuilder(textLayerDiv, pageIdx) {
|
||||
|
||||
this.beginLayout = function textLayerBuilderBeginLayout() {
|
||||
this.textDivs = [];
|
||||
this.textLayerQueue = [];
|
||||
this.renderingDone = false;
|
||||
};
|
||||
|
||||
@ -3418,9 +3436,9 @@ window.addEventListener('keydown', function keydown(evt) {
|
||||
|
||||
// Some shortcuts should not get handled if a control/input element
|
||||
// is selected.
|
||||
var curElement = document.activeElement;
|
||||
if (curElement && (curElement.tagName == 'INPUT' ||
|
||||
curElement.tagName == 'SELECT')) {
|
||||
var curElement = document.activeElement || document.querySelector(':focus');
|
||||
if (curElement && (curElement.tagName.toUpperCase() === 'INPUT' ||
|
||||
curElement.tagName.toUpperCase() === 'SELECT')) {
|
||||
return;
|
||||
}
|
||||
var controlsElement = document.getElementById('toolbar');
|
||||
|
@ -53,9 +53,6 @@ thumbs_label=Thumbnails
|
||||
findbar.title=Find in Document
|
||||
findbar_label=Find
|
||||
|
||||
# Document outline messages
|
||||
no_outline=No Outline Available
|
||||
|
||||
# Thumbnails panel item (tooltip and alt text for images)
|
||||
# LOCALIZATION NOTE (thumb_page_title): "{{page}}" will be replaced by the page
|
||||
# number.
|
||||
@ -123,3 +120,4 @@ request_password=PDF is protected by a password:
|
||||
printing_not_supported=Warning: Printing is not fully supported by this browser.
|
||||
printing_not_ready=Warning: The PDF is not fully loaded for printing.
|
||||
web_fonts_disabled=Web fonts are disabled: unable to use embedded PDF fonts.
|
||||
web_colors_disabled=Web colors are disabled.
|
||||
|
Loading…
Reference in New Issue
Block a user