Merge mozilla-central to autoland. a=merge CLOSED TREE

This commit is contained in:
Gurzau Raul 2019-05-18 00:46:18 +03:00
Родитель e5365ad42c 80a3d06820
Коммит bc953c3503
23 изменённых файлов: 585 добавлений и 384 удалений

Просмотреть файл

@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 2.2.167 Current extension version is: 2.2.177
Taken from upstream commit: ca2fee3d Taken from upstream commit: 1421b2f2

Просмотреть файл

@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict"; "use strict";
var pdfjsVersion = '2.2.167'; var pdfjsVersion = '2.2.177';
var pdfjsBuild = 'ca2fee3d'; var pdfjsBuild = '1421b2f2';
var pdfjsSharedUtil = __w_pdfjs_require__(1); var pdfjsSharedUtil = __w_pdfjs_require__(1);
@ -1304,7 +1304,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
return worker.messageHandler.sendWithPromise('GetDocRequest', { return worker.messageHandler.sendWithPromise('GetDocRequest', {
docId, docId,
apiVersion: '2.2.167', apiVersion: '2.2.177',
source: { source: {
data: source.data, data: source.data,
url: source.url, url: source.url,
@ -2547,14 +2547,14 @@ class WorkerTransport {
}, this); }, this);
messageHandler.on('obj', function (data) { messageHandler.on('obj', function (data) {
if (this.destroyed) { if (this.destroyed) {
return; return undefined;
} }
const [id, pageIndex, type, imageData] = data; const [id, pageIndex, type, imageData] = data;
const pageProxy = this.pageCache[pageIndex]; const pageProxy = this.pageCache[pageIndex];
if (pageProxy.objs.has(id)) { if (pageProxy.objs.has(id)) {
return; return undefined;
} }
switch (type) { switch (type) {
@ -2589,6 +2589,8 @@ class WorkerTransport {
default: default:
throw new Error(`Got unknown object type ${type}`); throw new Error(`Got unknown object type ${type}`);
} }
return undefined;
}, this); }, this);
messageHandler.on('DocProgress', function (data) { messageHandler.on('DocProgress', function (data) {
if (this.destroyed) { if (this.destroyed) {
@ -3098,9 +3100,9 @@ const InternalRenderTask = function InternalRenderTaskClosure() {
return InternalRenderTask; return InternalRenderTask;
}(); }();
const version = '2.2.167'; const version = '2.2.177';
exports.version = version; exports.version = version;
const build = 'ca2fee3d'; const build = '1421b2f2';
exports.build = build; exports.build = build;
/***/ }), /***/ }),
@ -3628,7 +3630,7 @@ class BaseFontLoader {
async bind(font) { async bind(font) {
if (font.attached || font.missingFile) { if (font.attached || font.missingFile) {
return; return undefined;
} }
font.attached = true; font.attached = true;
@ -3652,7 +3654,7 @@ class BaseFontLoader {
} }
} }
return; return undefined;
} }
const rule = font.createFontFaceRule(); const rule = font.createFontFaceRule();
@ -3661,7 +3663,7 @@ class BaseFontLoader {
this.insertRule(rule); this.insertRule(rule);
if (this.isSyncFontLoadingSupported) { if (this.isSyncFontLoadingSupported) {
return; return undefined;
} }
return new Promise(resolve => { return new Promise(resolve => {
@ -3670,6 +3672,8 @@ class BaseFontLoader {
this._prepareFontLoadEvent([rule], [font], request); this._prepareFontLoadEvent([rule], [font], request);
}); });
} }
return undefined;
} }
_queueLoadingCallback(callback) { _queueLoadingCallback(callback) {
@ -5175,7 +5179,7 @@ var CanvasGraphics = function CanvasGraphicsClosure() {
var fontSize = current.fontSize; var fontSize = current.fontSize;
if (fontSize === 0) { if (fontSize === 0) {
return; return undefined;
} }
var ctx = this.ctx; var ctx = this.ctx;
@ -6354,7 +6358,7 @@ var _util = __w_pdfjs_require__(1);
async function resolveCall(fn, args, thisArg = null) { async function resolveCall(fn, args, thisArg = null) {
if (!fn) { if (!fn) {
return; return undefined;
} }
return fn.apply(thisArg, args); return fn.apply(thisArg, args);
@ -7382,15 +7386,15 @@ exports.PDFDataTransportStream = void 0;
var _util = __w_pdfjs_require__(1); var _util = __w_pdfjs_require__(1);
var PDFDataTransportStream = function PDFDataTransportStreamClosure() { class PDFDataTransportStream {
function PDFDataTransportStream(params, pdfDataRangeTransport) { constructor(params, pdfDataRangeTransport) {
(0, _util.assert)(pdfDataRangeTransport); (0, _util.assert)(pdfDataRangeTransport);
this._queuedChunks = []; this._queuedChunks = [];
this._progressiveDone = params.progressiveDone || false; this._progressiveDone = params.progressiveDone || false;
const initialData = params.initialData; const initialData = params.initialData;
if (initialData && initialData.length > 0) { if (initialData && initialData.length > 0) {
let buffer = new Uint8Array(initialData).buffer; const buffer = new Uint8Array(initialData).buffer;
this._queuedChunks.push(buffer); this._queuedChunks.push(buffer);
} }
@ -7429,106 +7433,112 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
this._pdfDataRangeTransport.transportReady(); this._pdfDataRangeTransport.transportReady();
} }
PDFDataTransportStream.prototype = { _onReceiveData(args) {
_onReceiveData: function PDFDataTransportStream_onReceiveData(args) { const buffer = new Uint8Array(args.chunk).buffer;
let buffer = new Uint8Array(args.chunk).buffer;
if (args.begin === undefined) { if (args.begin === undefined) {
if (this._fullRequestReader) {
this._fullRequestReader._enqueue(buffer);
} else {
this._queuedChunks.push(buffer);
}
} else {
var found = this._rangeReaders.some(function (rangeReader) {
if (rangeReader._begin !== args.begin) {
return false;
}
rangeReader._enqueue(buffer);
return true;
});
(0, _util.assert)(found);
}
},
get _progressiveDataLength() {
return this._fullRequestReader ? this._fullRequestReader._loaded : 0;
},
_onProgress: function PDFDataTransportStream_onDataProgress(evt) {
if (evt.total === undefined) {
let firstReader = this._rangeReaders[0];
if (firstReader && firstReader.onProgress) {
firstReader.onProgress({
loaded: evt.loaded
});
}
} else {
let fullReader = this._fullRequestReader;
if (fullReader && fullReader.onProgress) {
fullReader.onProgress({
loaded: evt.loaded,
total: evt.total
});
}
}
},
_onProgressiveDone() {
if (this._fullRequestReader) { if (this._fullRequestReader) {
this._fullRequestReader.progressiveDone(); this._fullRequestReader._enqueue(buffer);
} else {
this._queuedChunks.push(buffer);
} }
} else {
const found = this._rangeReaders.some(function (rangeReader) {
if (rangeReader._begin !== args.begin) {
return false;
}
this._progressiveDone = true; rangeReader._enqueue(buffer);
},
_removeRangeReader: function PDFDataTransportStream_removeRangeReader(reader) { return true;
var i = this._rangeReaders.indexOf(reader);
if (i >= 0) {
this._rangeReaders.splice(i, 1);
}
},
getFullReader: function PDFDataTransportStream_getFullReader() {
(0, _util.assert)(!this._fullRequestReader);
var queuedChunks = this._queuedChunks;
this._queuedChunks = null;
return new PDFDataTransportStreamReader(this, queuedChunks, this._progressiveDone);
},
getRangeReader: function PDFDataTransportStream_getRangeReader(begin, end) {
if (end <= this._progressiveDataLength) {
return null;
}
var reader = new PDFDataTransportStreamRangeReader(this, begin, end);
this._pdfDataRangeTransport.requestDataRange(begin, end);
this._rangeReaders.push(reader);
return reader;
},
cancelAllRequests: function PDFDataTransportStream_cancelAllRequests(reason) {
if (this._fullRequestReader) {
this._fullRequestReader.cancel(reason);
}
var readers = this._rangeReaders.slice(0);
readers.forEach(function (rangeReader) {
rangeReader.cancel(reason);
}); });
this._pdfDataRangeTransport.abort(); (0, _util.assert)(found);
} }
}; }
function PDFDataTransportStreamReader(stream, queuedChunks, progressiveDone = false) { get _progressiveDataLength() {
return this._fullRequestReader ? this._fullRequestReader._loaded : 0;
}
_onProgress(evt) {
if (evt.total === undefined) {
const firstReader = this._rangeReaders[0];
if (firstReader && firstReader.onProgress) {
firstReader.onProgress({
loaded: evt.loaded
});
}
} else {
const fullReader = this._fullRequestReader;
if (fullReader && fullReader.onProgress) {
fullReader.onProgress({
loaded: evt.loaded,
total: evt.total
});
}
}
}
_onProgressiveDone() {
if (this._fullRequestReader) {
this._fullRequestReader.progressiveDone();
}
this._progressiveDone = true;
}
_removeRangeReader(reader) {
const i = this._rangeReaders.indexOf(reader);
if (i >= 0) {
this._rangeReaders.splice(i, 1);
}
}
getFullReader() {
(0, _util.assert)(!this._fullRequestReader);
const queuedChunks = this._queuedChunks;
this._queuedChunks = null;
return new PDFDataTransportStreamReader(this, queuedChunks, this._progressiveDone);
}
getRangeReader(begin, end) {
if (end <= this._progressiveDataLength) {
return null;
}
const reader = new PDFDataTransportStreamRangeReader(this, begin, end);
this._pdfDataRangeTransport.requestDataRange(begin, end);
this._rangeReaders.push(reader);
return reader;
}
cancelAllRequests(reason) {
if (this._fullRequestReader) {
this._fullRequestReader.cancel(reason);
}
const readers = this._rangeReaders.slice(0);
readers.forEach(function (rangeReader) {
rangeReader.cancel(reason);
});
this._pdfDataRangeTransport.abort();
}
}
exports.PDFDataTransportStream = PDFDataTransportStream;
class PDFDataTransportStreamReader {
constructor(stream, queuedChunks, progressiveDone = false) {
this._stream = stream; this._stream = stream;
this._done = progressiveDone || false; this._done = progressiveDone || false;
this._filename = null; this._filename = null;
@ -7545,94 +7555,94 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
this.onProgress = null; this.onProgress = null;
} }
PDFDataTransportStreamReader.prototype = { _enqueue(chunk) {
_enqueue: function PDFDataTransportStreamReader_enqueue(chunk) { if (this._done) {
if (this._done) { return;
return;
}
if (this._requests.length > 0) {
var requestCapability = this._requests.shift();
requestCapability.resolve({
value: chunk,
done: false
});
} else {
this._queuedChunks.push(chunk);
}
this._loaded += chunk.byteLength;
},
get headersReady() {
return this._headersReady;
},
get filename() {
return this._filename;
},
get isRangeSupported() {
return this._stream._isRangeSupported;
},
get isStreamingSupported() {
return this._stream._isStreamingSupported;
},
get contentLength() {
return this._stream._contentLength;
},
async read() {
if (this._queuedChunks.length > 0) {
var chunk = this._queuedChunks.shift();
return {
value: chunk,
done: false
};
}
if (this._done) {
return {
value: undefined,
done: true
};
}
var requestCapability = (0, _util.createPromiseCapability)();
this._requests.push(requestCapability);
return requestCapability.promise;
},
cancel: function PDFDataTransportStreamReader_cancel(reason) {
this._done = true;
this._requests.forEach(function (requestCapability) {
requestCapability.resolve({
value: undefined,
done: true
});
});
this._requests = [];
},
progressiveDone() {
if (this._done) {
return;
}
this._done = true;
} }
}; if (this._requests.length > 0) {
const requestCapability = this._requests.shift();
function PDFDataTransportStreamRangeReader(stream, begin, end) { requestCapability.resolve({
value: chunk,
done: false
});
} else {
this._queuedChunks.push(chunk);
}
this._loaded += chunk.byteLength;
}
get headersReady() {
return this._headersReady;
}
get filename() {
return this._filename;
}
get isRangeSupported() {
return this._stream._isRangeSupported;
}
get isStreamingSupported() {
return this._stream._isStreamingSupported;
}
get contentLength() {
return this._stream._contentLength;
}
async read() {
if (this._queuedChunks.length > 0) {
const chunk = this._queuedChunks.shift();
return {
value: chunk,
done: false
};
}
if (this._done) {
return {
value: undefined,
done: true
};
}
const requestCapability = (0, _util.createPromiseCapability)();
this._requests.push(requestCapability);
return requestCapability.promise;
}
cancel(reason) {
this._done = true;
this._requests.forEach(function (requestCapability) {
requestCapability.resolve({
value: undefined,
done: true
});
});
this._requests = [];
}
progressiveDone() {
if (this._done) {
return;
}
this._done = true;
}
}
class PDFDataTransportStreamRangeReader {
constructor(stream, begin, end) {
this._stream = stream; this._stream = stream;
this._begin = begin; this._begin = begin;
this._end = end; this._end = end;
@ -7642,67 +7652,20 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
this.onProgress = null; this.onProgress = null;
} }
PDFDataTransportStreamRangeReader.prototype = { _enqueue(chunk) {
_enqueue: function PDFDataTransportStreamRangeReader_enqueue(chunk) { if (this._done) {
if (this._done) { return;
return; }
}
if (this._requests.length === 0) { if (this._requests.length === 0) {
this._queuedChunk = chunk; this._queuedChunk = chunk;
} else { } else {
var requestsCapability = this._requests.shift(); const requestsCapability = this._requests.shift();
requestsCapability.resolve({ requestsCapability.resolve({
value: chunk, value: chunk,
done: false done: false
}); });
this._requests.forEach(function (requestCapability) {
requestCapability.resolve({
value: undefined,
done: true
});
});
this._requests = [];
}
this._done = true;
this._stream._removeRangeReader(this);
},
get isStreamingSupported() {
return false;
},
async read() {
if (this._queuedChunk) {
let chunk = this._queuedChunk;
this._queuedChunk = null;
return {
value: chunk,
done: false
};
}
if (this._done) {
return {
value: undefined,
done: true
};
}
var requestCapability = (0, _util.createPromiseCapability)();
this._requests.push(requestCapability);
return requestCapability.promise;
},
cancel: function PDFDataTransportStreamRangeReader_cancel(reason) {
this._done = true;
this._requests.forEach(function (requestCapability) { this._requests.forEach(function (requestCapability) {
requestCapability.resolve({ requestCapability.resolve({
@ -7712,14 +7675,57 @@ var PDFDataTransportStream = function PDFDataTransportStreamClosure() {
}); });
this._requests = []; this._requests = [];
this._stream._removeRangeReader(this);
} }
};
return PDFDataTransportStream;
}();
exports.PDFDataTransportStream = PDFDataTransportStream; this._done = true;
this._stream._removeRangeReader(this);
}
get isStreamingSupported() {
return false;
}
async read() {
if (this._queuedChunk) {
const chunk = this._queuedChunk;
this._queuedChunk = null;
return {
value: chunk,
done: false
};
}
if (this._done) {
return {
value: undefined,
done: true
};
}
const requestCapability = (0, _util.createPromiseCapability)();
this._requests.push(requestCapability);
return requestCapability.promise;
}
cancel(reason) {
this._done = true;
this._requests.forEach(function (requestCapability) {
requestCapability.resolve({
value: undefined,
done: true
});
});
this._requests = [];
this._stream._removeRangeReader(this);
}
}
/***/ }), /***/ }),
/* 17 */ /* 17 */

Просмотреть файл

@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
"use strict"; "use strict";
const pdfjsVersion = '2.2.167'; const pdfjsVersion = '2.2.177';
const pdfjsBuild = 'ca2fee3d'; const pdfjsBuild = '1421b2f2';
const pdfjsCoreWorker = __w_pdfjs_require__(1); const pdfjsCoreWorker = __w_pdfjs_require__(1);
@ -378,7 +378,7 @@ var WorkerMessageHandler = {
var WorkerTasks = []; var WorkerTasks = [];
const verbosity = (0, _util.getVerbosityLevel)(); const verbosity = (0, _util.getVerbosityLevel)();
let apiVersion = docParams.apiVersion; let apiVersion = docParams.apiVersion;
let workerVersion = '2.2.167'; let workerVersion = '2.2.177';
if (apiVersion !== workerVersion) { if (apiVersion !== workerVersion) {
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`); throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
@ -3638,6 +3638,8 @@ class Catalog {
} else if (this.catDict.has('Dests')) { } else if (this.catDict.has('Dests')) {
return this.catDict.get('Dests'); return this.catDict.get('Dests');
} }
return undefined;
} }
get pageLabels() { get pageLabels() {
@ -4983,7 +4985,7 @@ var XRef = function XRefClosure() {
} }
if (recoveryMode) { if (recoveryMode) {
return; return undefined;
} }
throw new _core_utils.XRefParseException(); throw new _core_utils.XRefParseException();
@ -12942,6 +12944,7 @@ var JpegImage = function JpegImageClosure() {
} }
this.numComponents = this.components.length; this.numComponents = this.components.length;
return undefined;
}, },
_getLinearizedBlockData(width, height, isSourcePDF = false) { _getLinearizedBlockData(width, height, isSourcePDF = false) {
@ -18195,7 +18198,7 @@ class AnnotationFactory {
let dict = xref.fetchIfRef(ref); let dict = xref.fetchIfRef(ref);
if (!(0, _primitives.isDict)(dict)) { if (!(0, _primitives.isDict)(dict)) {
return; return undefined;
} }
let id = (0, _primitives.isRef)(ref) ? ref.toString() : `annot_${idFactory.createObjId()}`; let id = (0, _primitives.isRef)(ref) ? ref.toString() : `annot_${idFactory.createObjId()}`;
@ -18204,7 +18207,6 @@ class AnnotationFactory {
let parameters = { let parameters = {
xref, xref,
dict, dict,
ref: (0, _primitives.isRef)(ref) ? ref : null,
subtype, subtype,
id, id,
pdfManager pdfManager
@ -18491,7 +18493,7 @@ class Annotation {
loadResources(keys) { loadResources(keys) {
return this.appearance.dict.getAsync('Resources').then(resources => { return this.appearance.dict.getAsync('Resources').then(resources => {
if (!resources) { if (!resources) {
return; return undefined;
} }
let objectLoader = new _obj.ObjectLoader(resources, keys, resources.xref); let objectLoader = new _obj.ObjectLoader(resources, keys, resources.xref);
@ -19200,6 +19202,8 @@ var QueueOptimizer = function QueueOptimizerClosure() {
case 3: case 3:
return fnArray[i] === _util.OPS.restore; return fnArray[i] === _util.OPS.restore;
} }
throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
}, function foundInlineImageGroup(context, i) { }, function foundInlineImageGroup(context, i) {
var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10; var MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200; var MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
@ -19306,6 +19310,8 @@ var QueueOptimizer = function QueueOptimizerClosure() {
case 3: case 3:
return fnArray[i] === _util.OPS.restore; return fnArray[i] === _util.OPS.restore;
} }
throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
}, function foundImageMaskGroup(context, i) { }, function foundImageMaskGroup(context, i) {
var MIN_IMAGES_IN_MASKS_BLOCK = 10; var MIN_IMAGES_IN_MASKS_BLOCK = 10;
var MAX_IMAGES_IN_MASKS_BLOCK = 100; var MAX_IMAGES_IN_MASKS_BLOCK = 100;
@ -19388,7 +19394,7 @@ var QueueOptimizer = function QueueOptimizerClosure() {
var argsArray = context.argsArray; var argsArray = context.argsArray;
var iFirstTransform = context.iCurr - 2; var iFirstTransform = context.iCurr - 2;
return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0; return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
}, function (context, i) { }, function iterateImageGroup(context, i) {
var fnArray = context.fnArray, var fnArray = context.fnArray,
argsArray = context.argsArray; argsArray = context.argsArray;
var iFirstSave = context.iCurr - 3; var iFirstSave = context.iCurr - 3;
@ -19430,6 +19436,8 @@ var QueueOptimizer = function QueueOptimizerClosure() {
case 3: case 3:
return fnArray[i] === _util.OPS.restore; return fnArray[i] === _util.OPS.restore;
} }
throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
}, function (context, i) { }, function (context, i) {
var MIN_IMAGES_IN_BLOCK = 3; var MIN_IMAGES_IN_BLOCK = 3;
var MAX_IMAGES_IN_BLOCK = 1000; var MAX_IMAGES_IN_BLOCK = 1000;
@ -19462,7 +19470,7 @@ var QueueOptimizer = function QueueOptimizerClosure() {
argsArray.splice(iFirstSave, count * 4, args); argsArray.splice(iFirstSave, count * 4, args);
return iFirstSave + 1; return iFirstSave + 1;
}); });
addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function (context, i) { addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
var fnArray = context.fnArray, var fnArray = context.fnArray,
argsArray = context.argsArray; argsArray = context.argsArray;
var iFirstSave = context.iCurr - 4; var iFirstSave = context.iCurr - 4;
@ -19496,6 +19504,8 @@ var QueueOptimizer = function QueueOptimizerClosure() {
case 4: case 4:
return fnArray[i] === _util.OPS.endText; return fnArray[i] === _util.OPS.endText;
} }
throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
}, function (context, i) { }, function (context, i) {
var MIN_CHARS_IN_BLOCK = 3; var MIN_CHARS_IN_BLOCK = 3;
var MAX_CHARS_IN_BLOCK = 1000; var MAX_CHARS_IN_BLOCK = 1000;
@ -20123,14 +20133,14 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
if (!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h))) { if (!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h))) {
(0, _util.warn)('Image dimensions are missing, or not numbers.'); (0, _util.warn)('Image dimensions are missing, or not numbers.');
return; return undefined;
} }
var maxImageSize = this.options.maxImageSize; var maxImageSize = this.options.maxImageSize;
if (maxImageSize !== -1 && w * h > maxImageSize) { if (maxImageSize !== -1 && w * h > maxImageSize) {
(0, _util.warn)('Image exceeded maximum allowed size and was removed.'); (0, _util.warn)('Image exceeded maximum allowed size and was removed.');
return; return undefined;
} }
var imageMask = dict.get('ImageMask', 'IM') || false; var imageMask = dict.get('ImageMask', 'IM') || false;
@ -20160,7 +20170,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}; };
} }
return; return undefined;
} }
var softMask = dict.get('SMask', 'SM') || false; var softMask = dict.get('SMask', 'SM') || false;
@ -20177,7 +20187,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}); });
imgData = imageObj.createImageData(true); imgData = imageObj.createImageData(true);
operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]); operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]);
return; return undefined;
} }
const nativeImageDecoderSupport = forceDisableNativeImageDecoder ? _util.NativeImageDecoding.NONE : this.options.nativeImageDecoderSupport; const nativeImageDecoderSupport = forceDisableNativeImageDecoder ? _util.NativeImageDecoding.NONE : this.options.nativeImageDecoderSupport;
@ -20245,6 +20255,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
} }
this.handler.send('obj', [objId, this.pageIndex, 'Image', imgData], [imgData.data.buffer]); this.handler.send('obj', [objId, this.pageIndex, 'Image', imgData], [imgData.data.buffer]);
return undefined;
}).catch(reason => { }).catch(reason => {
(0, _util.warn)('Unable to decode image: ' + reason); (0, _util.warn)('Unable to decode image: ' + reason);
@ -20253,6 +20264,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
} }
this.handler.send('obj', [objId, this.pageIndex, 'Image', null]); this.handler.send('obj', [objId, this.pageIndex, 'Image', null]);
return undefined;
}); });
if (this.parsingType3Font) { if (this.parsingType3Font) {
@ -20267,6 +20279,8 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
args args
}; };
} }
return undefined;
}, },
handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) { handleSMask: function PartialEvaluator_handleSmask(smask, resources, operatorList, task, stateManager) {
@ -21605,7 +21619,8 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}, },
extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, properties) { extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, properties) {
var xref = this.xref; let xref = this.xref,
cidToGidBytes;
var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode'); var toUnicode = dict.get('ToUnicode') || baseDict.get('ToUnicode');
var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined); var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined);
@ -21623,7 +21638,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
var cidToGidMap = dict.get('CIDToGIDMap'); var cidToGidMap = dict.get('CIDToGIDMap');
if ((0, _primitives.isStream)(cidToGidMap)) { if ((0, _primitives.isStream)(cidToGidMap)) {
properties.cidToGidMap = this.readCidToGidMap(cidToGidMap); cidToGidBytes = cidToGidMap.getBytes();
} }
} }
@ -21698,8 +21713,13 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
return toUnicodePromise.then(toUnicode => { return toUnicodePromise.then(toUnicode => {
properties.toUnicode = toUnicode; properties.toUnicode = toUnicode;
return this.buildToUnicode(properties); return this.buildToUnicode(properties);
}).then(function (toUnicode) { }).then(toUnicode => {
properties.toUnicode = toUnicode; properties.toUnicode = toUnicode;
if (cidToGidBytes) {
properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, toUnicode);
}
return properties; return properties;
}); });
}, },
@ -21883,23 +21903,24 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
return Promise.resolve(null); return Promise.resolve(null);
}, },
readCidToGidMap: function PartialEvaluator_readCidToGidMap(cidToGidStream) {
var glyphsData = cidToGidStream.getBytes(); readCidToGidMap(glyphsData, toUnicode) {
var result = []; var result = [];
for (var j = 0, jj = glyphsData.length; j < jj; j++) { for (var j = 0, jj = glyphsData.length; j < jj; j++) {
var glyphID = glyphsData[j++] << 8 | glyphsData[j]; var glyphID = glyphsData[j++] << 8 | glyphsData[j];
const code = j >> 1;
if (glyphID === 0) { if (glyphID === 0 && !toUnicode.has(code)) {
continue; continue;
} }
var code = j >> 1;
result[code] = glyphID; result[code] = glyphID;
} }
return result; return result;
}, },
extractWidths: function PartialEvaluator_extractWidths(dict, descriptor, properties) { extractWidths: function PartialEvaluator_extractWidths(dict, descriptor, properties) {
var xref = this.xref; var xref = this.xref;
var glyphsWidths = []; var glyphsWidths = [];
@ -25355,7 +25376,7 @@ var Font = function FontClosure() {
}; };
} }
function sanitizeMetrics(font, header, metrics, numGlyphs) { function sanitizeMetrics(font, header, metrics, numGlyphs, dupFirstEntry) {
if (!header) { if (!header) {
if (metrics) { if (metrics) {
metrics.data = null; metrics.data = null;
@ -25393,6 +25414,12 @@ var Font = function FontClosure() {
if (numMissing > 0) { if (numMissing > 0) {
var entries = new Uint8Array(metrics.length + numMissing * 2); var entries = new Uint8Array(metrics.length + numMissing * 2);
entries.set(metrics.data); entries.set(metrics.data);
if (dupFirstEntry) {
entries[metrics.length] = metrics.data[2];
entries[metrics.length + 1] = metrics.data[3];
}
metrics.data = entries; metrics.data = entries;
} }
} }
@ -26148,7 +26175,7 @@ var Font = function FontClosure() {
delete tables['cvt ']; delete tables['cvt '];
} }
sanitizeMetrics(font, tables['hhea'], tables['hmtx'], numGlyphsOut); sanitizeMetrics(font, tables['hhea'], tables['hmtx'], numGlyphsOut, dupFirstEntry);
if (!tables['head']) { if (!tables['head']) {
throw new _util.FormatError('Required "head" table is not found'); throw new _util.FormatError('Required "head" table is not found');
@ -44576,7 +44603,7 @@ var _util = __w_pdfjs_require__(2);
async function resolveCall(fn, args, thisArg = null) { async function resolveCall(fn, args, thisArg = null) {
if (!fn) { if (!fn) {
return; return undefined;
} }
return fn.apply(thisArg, args); return fn.apply(thisArg, args);

Просмотреть файл

@ -439,7 +439,7 @@ let PDFViewerApplication = {
async _parseHashParameters() { async _parseHashParameters() {
if (!_app_options.AppOptions.get('pdfBugEnabled')) { if (!_app_options.AppOptions.get('pdfBugEnabled')) {
return; return undefined;
} }
const waitOn = []; const waitOn = [];
@ -780,7 +780,7 @@ let PDFViewerApplication = {
errorWrapper.setAttribute('hidden', 'true'); errorWrapper.setAttribute('hidden', 'true');
if (!this.pdfLoadingTask) { if (!this.pdfLoadingTask) {
return; return undefined;
} }
let promise = this.pdfLoadingTask.destroy(); let promise = this.pdfLoadingTask.destroy();
@ -875,7 +875,7 @@ let PDFViewerApplication = {
this.load(pdfDocument); this.load(pdfDocument);
}, exception => { }, exception => {
if (loadingTask !== this.pdfLoadingTask) { if (loadingTask !== this.pdfLoadingTask) {
return; return undefined;
} }
let message = exception && exception.message; let message = exception && exception.message;
@ -3688,6 +3688,8 @@ function isLeftMouseReleased(event) {
if (isChrome15OrOpera15plus || isSafari6plus) { if (isChrome15OrOpera15plus || isSafari6plus) {
return event.which === 0; return event.which === 0;
} }
return false;
} }
/***/ }), /***/ }),
@ -4377,7 +4379,7 @@ class PasswordPrompt {
if (password && password.length > 0) { if (password && password.length > 0) {
this.close(); this.close();
return this.updateCallback(password); this.updateCallback(password);
} }
} }
@ -4733,11 +4735,11 @@ class PDFDocumentProperties {
} }
} }
_parseFileSize(fileSize = 0) { async _parseFileSize(fileSize = 0) {
let kb = fileSize / 1024; let kb = fileSize / 1024;
if (!kb) { if (!kb) {
return Promise.resolve(undefined); return undefined;
} else if (kb < 1024) { } else if (kb < 1024) {
return this.l10n.get('document_properties_kb', { return this.l10n.get('document_properties_kb', {
size_kb: (+kb.toPrecision(3)).toLocaleString(), size_kb: (+kb.toPrecision(3)).toLocaleString(),
@ -4751,9 +4753,9 @@ class PDFDocumentProperties {
}, '{{size_mb}} MB ({{size_b}} bytes)'); }, '{{size_mb}} MB ({{size_b}} bytes)');
} }
_parsePageSize(pageSizeInches, pagesRotation) { async _parsePageSize(pageSizeInches, pagesRotation) {
if (!pageSizeInches) { if (!pageSizeInches) {
return Promise.resolve(undefined); return undefined;
} }
if (pagesRotation % 180 !== 0) { if (pagesRotation % 180 !== 0) {
@ -4816,17 +4818,17 @@ class PDFDocumentProperties {
}); });
} }
_parseDate(inputDate) { async _parseDate(inputDate) {
const dateObject = _pdfjsLib.PDFDateString.toDateObject(inputDate); const dateObject = _pdfjsLib.PDFDateString.toDateObject(inputDate);
if (dateObject) { if (!dateObject) {
const dateString = dateObject.toLocaleDateString(); return undefined;
const timeString = dateObject.toLocaleTimeString();
return this.l10n.get('document_properties_date_string', {
date: dateString,
time: timeString
}, '{{date}}, {{time}}');
} }
return this.l10n.get('document_properties_date_string', {
date: dateObject.toLocaleDateString(),
time: dateObject.toLocaleTimeString()
}, '{{date}}, {{time}}');
} }
_parseLinearization(isLinearized) { _parseLinearization(isLinearized) {

Просмотреть файл

@ -20,7 +20,7 @@ origin:
# Human-readable identifier for this version/release # Human-readable identifier for this version/release
# Generally "version NNN", "tag SSS", "bookmark SSS" # Generally "version NNN", "tag SSS", "bookmark SSS"
release: version 2.2.167 release: version 2.2.177
# The package's license, where possible using the mnemonic from # The package's license, where possible using the mnemonic from
# https://spdx.org/licenses/ # https://spdx.org/licenses/

Просмотреть файл

@ -12916,7 +12916,7 @@ void nsDocShell::SetIsPrinting(bool aIsPrinting) {
} }
NS_IMETHODIMP NS_IMETHODIMP
nsDocShell::GetPrintPreview(nsIWebBrowserPrint** aPrintPreview) { nsDocShell::InitOrReusePrintPreviewViewer(nsIWebBrowserPrint** aPrintPreview) {
*aPrintPreview = nullptr; *aPrintPreview = nullptr;
#if NS_PRINT_PREVIEW #if NS_PRINT_PREVIEW
nsCOMPtr<nsIDocumentViewerPrint> print = do_QueryInterface(mContentViewer); nsCOMPtr<nsIDocumentViewerPrint> print = do_QueryInterface(mContentViewer);
@ -12947,6 +12947,19 @@ nsDocShell::GetPrintPreview(nsIWebBrowserPrint** aPrintPreview) {
#endif #endif
} }
NS_IMETHODIMP nsDocShell::ExitPrintPreview() {
#if NS_PRINT_PREVIEW
# ifdef DEBUG
nsCOMPtr<nsIDocumentViewerPrint> vp = do_QueryInterface(mContentViewer);
MOZ_ASSERT(vp && vp->IsInitializedForPrintPreview());
# endif
nsCOMPtr<nsIWebBrowserPrint> viewer = do_QueryInterface(mContentViewer);
return viewer->ExitPrintPreview();
#else
return NS_OK;
#endif
}
#ifdef DEBUG #ifdef DEBUG
unsigned long nsDocShell::gNumberOfDocShells = 0; unsigned long nsDocShell::gNumberOfDocShells = 0;
#endif #endif

Просмотреть файл

@ -549,11 +549,28 @@ interface nsIDocShell : nsIDocShellTreeItem
[noscript, notxpcom] void setIsPrinting(in boolean aIsPrinting); [noscript, notxpcom] void setIsPrinting(in boolean aIsPrinting);
/** /**
* If the current content viewer isn't initialized for print preview, * This method should only be called on a docShell that has been specifically
* it is replaced with one which is and to which an about:blank document * created to display a print preview document. If the current document
* is loaded. * viewer isn't initialized for print preview when this method is called, it
* is replaced with a new viewer with an about:blank document (with the URL
* about:printpreview). The viewer is then returned, ready for the print
* preview document to be constructed when viewer.printPreview() is called.
*
* The same viewer will be returned on subsequent calls since various bits of
* code assume that, once created, the viewer is never replaced. Note,
* however, that the viewer's document will be replaced with a new document
* each time printPreview() is called on it (which is what we do to take
* account of print preview settings changes). Replacing the document
* viewer's document breaks the normally unchanging 1:1 relationship between
* a document and its viewer, but that seems to be okay.
*/ */
readonly attribute nsIWebBrowserPrint printPreview; nsIWebBrowserPrint initOrReusePrintPreviewViewer();
/**
* Propagated to the print preview document viewer. Must only be called on
* a document viewer that has been initialized for print preview.
*/
void exitPrintPreview();
/** /**
* Whether this docshell can execute scripts based on its hierarchy. * Whether this docshell can execute scripts based on its hierarchy.

Просмотреть файл

@ -7044,7 +7044,7 @@ nsresult PrepareDatastoreOp::DatabaseWork() {
} }
if (hasDataForMigration) { if (hasDataForMigration) {
MOZ_ASSERT(mUsage == 0); MOZ_DIAGNOSTIC_ASSERT(mUsage == 0);
rv = AttachArchiveDatabase(quotaManager->GetStoragePath(), connection); rv = AttachArchiveDatabase(quotaManager->GetStoragePath(), connection);
if (NS_WARN_IF(NS_FAILED(rv))) { if (NS_WARN_IF(NS_FAILED(rv))) {

Просмотреть файл

@ -1318,7 +1318,7 @@ impl BatchBuilder {
PrimitiveInstanceData::from(instance), PrimitiveInstanceData::from(instance),
); );
} }
Filter::DropShadowStack(shadows) => { Filter::DropShadows(shadows) => {
// Draw an instance per shadow first, following by the content. // Draw an instance per shadow first, following by the content.
// The shadows and the content get drawn as a brush image. // The shadows and the content get drawn as a brush image.
@ -1431,7 +1431,7 @@ impl BatchBuilder {
Filter::Sepia(..) => 6, Filter::Sepia(..) => 6,
Filter::Brightness(..) => 7, Filter::Brightness(..) => 7,
Filter::Opacity(..) => 8, Filter::Opacity(..) => 8,
Filter::DropShadowStack(..) => 9, Filter::DropShadows(..) => 9,
Filter::ColorMatrix(..) => 10, Filter::ColorMatrix(..) => 10,
Filter::SrgbToLinear => 11, Filter::SrgbToLinear => 11,
Filter::LinearToSrgb => 12, Filter::LinearToSrgb => 12,
@ -1455,7 +1455,7 @@ impl BatchBuilder {
} }
// Go through different paths // Go through different paths
Filter::Blur(..) | Filter::Blur(..) |
Filter::DropShadowStack(..) => { Filter::DropShadows(..) => {
unreachable!(); unreachable!();
} }
Filter::ColorMatrix(_) => { Filter::ColorMatrix(_) => {

Просмотреть файл

@ -50,7 +50,7 @@ pub enum Filter {
Opacity(api::PropertyBinding<f32>, f32), Opacity(api::PropertyBinding<f32>, f32),
Saturate(f32), Saturate(f32),
Sepia(f32), Sepia(f32),
DropShadowStack(SmallVec<[Shadow; 1]>), DropShadows(SmallVec<[Shadow; 1]>),
ColorMatrix(Box<[f32; 20]>), ColorMatrix(Box<[f32; 20]>),
SrgbToLinear, SrgbToLinear,
LinearToSrgb, LinearToSrgb,
@ -65,7 +65,7 @@ impl Filter {
Filter::Blur(ref mut radius) => { Filter::Blur(ref mut radius) => {
*radius = radius.min(MAX_BLUR_RADIUS); *radius = radius.min(MAX_BLUR_RADIUS);
} }
Filter::DropShadowStack(ref mut stack) => { Filter::DropShadows(ref mut stack) => {
for shadow in stack { for shadow in stack {
shadow.blur_radius = shadow.blur_radius.min(MAX_BLUR_RADIUS); shadow.blur_radius = shadow.blur_radius.min(MAX_BLUR_RADIUS);
} }
@ -85,7 +85,7 @@ impl Filter {
Filter::Invert(..) | Filter::Invert(..) |
Filter::Saturate(..) | Filter::Saturate(..) |
Filter::Sepia(..) | Filter::Sepia(..) |
Filter::DropShadowStack(..) | Filter::DropShadows(..) |
Filter::ColorMatrix(..) | Filter::ColorMatrix(..) |
Filter::SrgbToLinear | Filter::SrgbToLinear |
Filter::LinearToSrgb | Filter::LinearToSrgb |
@ -108,7 +108,7 @@ impl Filter {
Filter::Opacity(_, amount) => amount >= 1.0, Filter::Opacity(_, amount) => amount >= 1.0,
Filter::Saturate(amount) => amount == 1.0, Filter::Saturate(amount) => amount == 1.0,
Filter::Sepia(amount) => amount == 0.0, Filter::Sepia(amount) => amount == 0.0,
Filter::DropShadowStack(ref shadows) => { Filter::DropShadows(ref shadows) => {
for shadow in shadows { for shadow in shadows {
if shadow.offset.x != 0.0 || shadow.offset.y != 0.0 || shadow.blur_radius != 0.0 { if shadow.offset.x != 0.0 || shadow.offset.y != 0.0 || shadow.blur_radius != 0.0 {
return false; return false;
@ -150,7 +150,7 @@ impl From<FilterOp> for Filter {
FilterOp::SrgbToLinear => Filter::SrgbToLinear, FilterOp::SrgbToLinear => Filter::SrgbToLinear,
FilterOp::LinearToSrgb => Filter::LinearToSrgb, FilterOp::LinearToSrgb => Filter::LinearToSrgb,
FilterOp::ComponentTransfer => Filter::ComponentTransfer, FilterOp::ComponentTransfer => Filter::ComponentTransfer,
FilterOp::DropShadow(shadow) => Filter::DropShadowStack(smallvec![shadow]), FilterOp::DropShadow(shadow) => Filter::DropShadows(smallvec![shadow]),
} }
} }
} }

Просмотреть файл

@ -2528,7 +2528,7 @@ impl PicturePrimitive {
(blur_render_task_id, picture_task_id) (blur_render_task_id, picture_task_id)
} }
PictureCompositeMode::Filter(Filter::DropShadowStack(ref shadows)) => { PictureCompositeMode::Filter(Filter::DropShadows(ref shadows)) => {
let mut max_std_deviation = 0.0; let mut max_std_deviation = 0.0;
for shadow in shadows { for shadow in shadows {
// TODO(nical) presumably we should compute the clipped rect for each shadow // TODO(nical) presumably we should compute the clipped rect for each shadow
@ -3132,7 +3132,7 @@ impl PicturePrimitive {
// blur sample scale. Should we do this here as well? // blur sample scale. Should we do this here as well?
let inflation_size = match raster_config.composite_mode { let inflation_size = match raster_config.composite_mode {
PictureCompositeMode::Filter(Filter::Blur(_)) => surface.inflation_factor, PictureCompositeMode::Filter(Filter::Blur(_)) => surface.inflation_factor,
PictureCompositeMode::Filter(Filter::DropShadowStack(ref shadows)) => { PictureCompositeMode::Filter(Filter::DropShadows(ref shadows)) => {
let mut max = 0.0; let mut max = 0.0;
for shadow in shadows { for shadow in shadows {
max = f32::max(max, shadow.blur_radius * BLUR_SAMPLE_SCALE); max = f32::max(max, shadow.blur_radius * BLUR_SAMPLE_SCALE);
@ -3167,7 +3167,7 @@ impl PicturePrimitive {
// Drop shadows draw both a content and shadow rect, so need to expand the local // Drop shadows draw both a content and shadow rect, so need to expand the local
// rect of any surfaces to be composited in parent surfaces correctly. // rect of any surfaces to be composited in parent surfaces correctly.
match raster_config.composite_mode { match raster_config.composite_mode {
PictureCompositeMode::Filter(Filter::DropShadowStack(ref shadows)) => { PictureCompositeMode::Filter(Filter::DropShadows(ref shadows)) => {
for shadow in shadows { for shadow in shadows {
let content_rect = surface_rect; let content_rect = surface_rect;
let shadow_rect = surface_rect.translate(&shadow.offset); let shadow_rect = surface_rect.translate(&shadow.offset);
@ -3225,7 +3225,7 @@ impl PicturePrimitive {
match raster_config.composite_mode { match raster_config.composite_mode {
PictureCompositeMode::TileCache { .. } => {} PictureCompositeMode::TileCache { .. } => {}
PictureCompositeMode::Filter(Filter::Blur(..)) => {} PictureCompositeMode::Filter(Filter::Blur(..)) => {}
PictureCompositeMode::Filter(Filter::DropShadowStack(ref shadows)) => { PictureCompositeMode::Filter(Filter::DropShadows(ref shadows)) => {
self.extra_gpu_data_handles.resize(shadows.len(), GpuCacheHandle::new()); self.extra_gpu_data_handles.resize(shadows.len(), GpuCacheHandle::new());
for (shadow, extra_handle) in shadows.iter().zip(self.extra_gpu_data_handles.iter_mut()) { for (shadow, extra_handle) in shadows.iter().zip(self.extra_gpu_data_handles.iter_mut()) {
if let Some(mut request) = frame_state.gpu_cache.request(extra_handle) { if let Some(mut request) = frame_state.gpu_cache.request(extra_handle) {

Просмотреть файл

@ -1881,7 +1881,7 @@ impl PrimitiveStore {
Some(ref rc) => match rc.composite_mode { Some(ref rc) => match rc.composite_mode {
// If we have a drop shadow filter, we also need to include the shadow in // If we have a drop shadow filter, we also need to include the shadow in
// our local rect for the purpose of calculating the size of the picture. // our local rect for the purpose of calculating the size of the picture.
PictureCompositeMode::Filter(Filter::DropShadowStack(ref shadows)) => { PictureCompositeMode::Filter(Filter::DropShadows(ref shadows)) => {
let mut rect = LayoutRect::zero(); let mut rect = LayoutRect::zero();
for shadow in shadows { for shadow in shadows {
rect = rect.union(&pic.snapped_local_rect.translate(&shadow.offset)); rect = rect.union(&pic.snapped_local_rect.translate(&shadow.offset));
@ -2171,7 +2171,7 @@ impl PrimitiveStore {
// This inflaction factor is to be applied to the surface itself. // This inflaction factor is to be applied to the surface itself.
let inflation_size = match raster_config.composite_mode { let inflation_size = match raster_config.composite_mode {
PictureCompositeMode::Filter(Filter::Blur(_)) => surface.inflation_factor, PictureCompositeMode::Filter(Filter::Blur(_)) => surface.inflation_factor,
PictureCompositeMode::Filter(Filter::DropShadowStack(ref shadows)) => { PictureCompositeMode::Filter(Filter::DropShadows(ref shadows)) => {
let mut max = 0.0; let mut max = 0.0;
for shadow in shadows { for shadow in shadows {
max = f32::max(max, shadow.blur_radius * BLUR_SAMPLE_SCALE); max = f32::max(max, shadow.blur_radius * BLUR_SAMPLE_SCALE);
@ -2187,7 +2187,7 @@ impl PrimitiveStore {
let pic_local_rect = surface_rect * TypedScale::new(1.0); let pic_local_rect = surface_rect * TypedScale::new(1.0);
if pic.snapped_local_rect != pic_local_rect { if pic.snapped_local_rect != pic_local_rect {
match raster_config.composite_mode { match raster_config.composite_mode {
PictureCompositeMode::Filter(Filter::DropShadowStack(..)) => { PictureCompositeMode::Filter(Filter::DropShadows(..)) => {
for handle in &pic.extra_gpu_data_handles { for handle in &pic.extra_gpu_data_handles {
frame_state.gpu_cache.invalidate(handle); frame_state.gpu_cache.invalidate(handle);
} }

Просмотреть файл

@ -38,7 +38,7 @@ pub enum PictureCompositeKey {
OpacityBinding(PropertyBindingId, Au), OpacityBinding(PropertyBindingId, Au),
Saturate(Au), Saturate(Au),
Sepia(Au), Sepia(Au),
DropShadowStack(Vec<(VectorKey, Au, ColorU)>), DropShadows(Vec<(VectorKey, Au, ColorU)>),
ColorMatrix([Au; 20]), ColorMatrix([Au; 20]),
SrgbToLinear, SrgbToLinear,
LinearToSrgb, LinearToSrgb,
@ -98,8 +98,8 @@ impl From<Option<PictureCompositeMode>> for PictureCompositeKey {
Filter::SrgbToLinear => PictureCompositeKey::SrgbToLinear, Filter::SrgbToLinear => PictureCompositeKey::SrgbToLinear,
Filter::LinearToSrgb => PictureCompositeKey::LinearToSrgb, Filter::LinearToSrgb => PictureCompositeKey::LinearToSrgb,
Filter::Identity => PictureCompositeKey::Identity, Filter::Identity => PictureCompositeKey::Identity,
Filter::DropShadowStack(ref shadows) => { Filter::DropShadows(ref shadows) => {
PictureCompositeKey::DropShadowStack( PictureCompositeKey::DropShadows(
shadows.iter().map(|shadow| { shadows.iter().map(|shadow| {
(shadow.offset.into(), Au::from_f32_px(shadow.blur_radius), shadow.color.into()) (shadow.offset.into(), Au::from_f32_px(shadow.blur_radius), shadow.color.into())
}).collect() }).collect()

Просмотреть файл

@ -3551,7 +3551,7 @@ nsDocumentViewer::PrintPreview(nsIPrintSettings* aPrintSettings,
# if defined(NS_PRINTING) && defined(NS_PRINT_PREVIEW) # if defined(NS_PRINTING) && defined(NS_PRINT_PREVIEW)
MOZ_ASSERT(IsInitializedForPrintPreview(), MOZ_ASSERT(IsInitializedForPrintPreview(),
"For print preview nsIWebBrowserPrint must be from " "For print preview nsIWebBrowserPrint must be from "
"docshell.printPreview!"); "docshell.initOrReusePrintPreviewViewer!");
NS_ENSURE_ARG_POINTER(aChildDOMWin); NS_ENSURE_ARG_POINTER(aChildDOMWin);
nsresult rv = NS_OK; nsresult rv = NS_OK;

Просмотреть файл

@ -17,7 +17,7 @@ var todo = window.opener.wrappedJSObject.todo;
var SimpleTest = window.opener.wrappedJSObject.SimpleTest; var SimpleTest = window.opener.wrappedJSObject.SimpleTest;
var gWbp; var gWbp;
function printpreview() { function printpreview() {
gWbp = window.frames[1].docShell.printPreview; gWbp = window.frames[1].docShell.initOrReusePrintPreviewViewer();
var listener = { var listener = {
onLocationChange: function(webProgress, request, location, flags) { }, onLocationChange: function(webProgress, request, location, flags) { },
onProgressChange: function(webProgress, request, curSelfProgress, onProgressChange: function(webProgress, request, curSelfProgress,
@ -44,7 +44,7 @@ function printpreview() {
} }
function exitprintpreview() { function exitprintpreview() {
window.frames[1].docShell.printPreview.exitPrintPreview(); window.frames[1].docShell.exitPrintPreview();
} }
function finish() { function finish() {
@ -90,7 +90,7 @@ function run2() {
} }
function run3() { function run3() {
gWbp = window.frames[1].docShell.printPreview; gWbp = window.frames[1].docShell.initOrReusePrintPreviewViewer();
ok(gWbp.doingPrintPreview, "Should be doing print preview"); ok(gWbp.doingPrintPreview, "Should be doing print preview");
exitprintpreview(); exitprintpreview();
setTimeout(run4, 0); setTimeout(run4, 0);
@ -105,11 +105,11 @@ function run4() {
}; };
i.addEventListener("load", loadhandler, true); i.addEventListener("load", loadhandler, true);
document.documentElement.getBoundingClientRect(); document.documentElement.getBoundingClientRect();
document.documentElement.appendChild(i); document.documentElement.prepend(i);
} }
function run5() { function run5() {
gWbp = window.frames[0].docShell.printPreview; gWbp = window.frames[1].docShell.initOrReusePrintPreviewViewer();
ok(!gWbp.doingPrintPreview, "Should not be doing print preview anymore2"); ok(!gWbp.doingPrintPreview, "Should not be doing print preview anymore2");
//XXX this shouldn't be necessary, see bug 405555 //XXX this shouldn't be necessary, see bug 405555

Просмотреть файл

@ -17,7 +17,7 @@ var todo = window.opener.wrappedJSObject.todo;
var SimpleTest = window.opener.wrappedJSObject.SimpleTest; var SimpleTest = window.opener.wrappedJSObject.SimpleTest;
var gWbp; var gWbp;
function printpreview() { function printpreview() {
gWbp = window.frames[1].docShell.printPreview; gWbp = window.frames[1].docShell.initOrReusePrintPreviewViewer();
var listener = { var listener = {
onLocationChange: function(webProgress, request, location, flags) { }, onLocationChange: function(webProgress, request, location, flags) { },
onProgressChange: function(webProgress, request, curSelfProgress, onProgressChange: function(webProgress, request, curSelfProgress,
@ -44,7 +44,7 @@ function printpreview() {
} }
function exitprintpreview() { function exitprintpreview() {
window.frames[1].docShell.printPreview.exitPrintPreview(); window.frames[1].docShell.exitPrintPreview();
} }
function finish() { function finish() {

Просмотреть файл

@ -24,7 +24,7 @@ var file = Cc["@mozilla.org/file/directory_service;1"]
filePath = file.path; filePath = file.path;
function printpreview(hasMozPrintCallback) { function printpreview(hasMozPrintCallback) {
gWbp = window.frames[1].docShell.printPreview; gWbp = window.frames[1].docShell.initOrReusePrintPreviewViewer();
var listener = { var listener = {
onLocationChange: function(webProgress, request, location, flags) { }, onLocationChange: function(webProgress, request, location, flags) { },
onProgressChange: function(webProgress, request, curSelfProgress, onProgressChange: function(webProgress, request, curSelfProgress,
@ -65,7 +65,7 @@ function printpreview(hasMozPrintCallback) {
} }
function exitprintpreview() { function exitprintpreview() {
window.frames[1].docShell.printPreview.exitPrintPreview(); window.frames[1].docShell.exitPrintPreview();
} }
function finish() { function finish() {

Просмотреть файл

@ -2424,44 +2424,80 @@ nsStyleImageLayers::nsStyleImageLayers(const nsStyleImageLayers& aSource)
} }
} }
nsChangeHint nsStyleImageLayers::CalcDifference( static bool IsElementImage(const nsStyleImageLayers::Layer& aLayer) {
const nsStyleImageLayers& aNewLayers, return aLayer.mImage.GetType() == eStyleImageType_Element;
nsStyleImageLayers::LayerType aType) const { }
nsChangeHint hint = nsChangeHint(0);
const nsStyleImageLayers& moreLayers = static bool AnyLayerIsElementImage(const nsStyleImageLayers& aLayers) {
mImageCount > aNewLayers.mImageCount ? *this : aNewLayers; NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, aLayers) {
const nsStyleImageLayers& lessLayers = if (IsElementImage(aLayers.mLayers[i])) {
mImageCount > aNewLayers.mImageCount ? aNewLayers : *this; return true;
NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, moreLayers) {
if (i < lessLayers.mImageCount) {
nsChangeHint layerDifference =
moreLayers.mLayers[i].CalcDifference(lessLayers.mLayers[i]);
hint |= layerDifference;
if (layerDifference && ((moreLayers.mLayers[i].mImage.GetType() ==
eStyleImageType_Element) ||
(lessLayers.mLayers[i].mImage.GetType() ==
eStyleImageType_Element))) {
hint |= nsChangeHint_UpdateEffects | nsChangeHint_RepaintFrame;
}
} else {
hint |= nsChangeHint_RepaintFrame;
if (moreLayers.mLayers[i].mImage.GetType() == eStyleImageType_Element) {
hint |= nsChangeHint_UpdateEffects | nsChangeHint_RepaintFrame;
}
} }
} }
return false;
}
if (aType == nsStyleImageLayers::LayerType::Mask && nsChangeHint nsStyleImageLayers::CalcDifference(
mImageCount != aNewLayers.mImageCount) { const nsStyleImageLayers& aNewLayers, LayerType aType) const {
hint |= nsChangeHint_UpdateEffects;
}
if (hint) { nsChangeHint hint = nsChangeHint(0);
// If the number of visible images changes, then it's easy-peasy.
if (mImageCount != aNewLayers.mImageCount) {
hint |= nsChangeHint_RepaintFrame;
if (aType == nsStyleImageLayers::LayerType::Mask ||
AnyLayerIsElementImage(*this) || AnyLayerIsElementImage(aNewLayers)) {
hint |= nsChangeHint_UpdateEffects;
}
return hint; return hint;
} }
const nsStyleImageLayers& moreLayers =
mLayers.Length() > aNewLayers.mLayers.Length() ? *this : aNewLayers;
const nsStyleImageLayers& lessLayers =
mLayers.Length() > aNewLayers.mLayers.Length() ? aNewLayers : *this;
for (size_t i = 0; i < moreLayers.mLayers.Length(); ++i) {
const Layer& moreLayersLayer = moreLayers.mLayers[i];
if (i < moreLayers.mImageCount) {
// This is a visible image we're diffing, we may need to repaint.
const Layer& lessLayersLayer = lessLayers.mLayers[i];
nsChangeHint layerDifference =
moreLayersLayer.CalcDifference(lessLayersLayer);
if (layerDifference && (IsElementImage(moreLayersLayer) ||
IsElementImage(lessLayersLayer))) {
layerDifference |= nsChangeHint_UpdateEffects |
nsChangeHint_RepaintFrame;
}
hint |= layerDifference;
continue;
}
if (hint) {
// If they're different by now, we're done.
return hint;
}
if (i >= lessLayers.mLayers.Length()) {
// The layer count differs, we know some property has changed, but if we
// got here we know it won't affect rendering.
return nsChangeHint_NeutralChange;
}
const Layer& lessLayersLayer = lessLayers.mLayers[i];
MOZ_ASSERT(moreLayersLayer.mImage.GetType() == eStyleImageType_Null);
MOZ_ASSERT(lessLayersLayer.mImage.GetType() == eStyleImageType_Null);
if (moreLayersLayer.CalcDifference(lessLayersLayer)) {
// We don't care about the difference returned, we know it's not visible,
// but if something changed, then we need to return the neutral change.
return nsChangeHint_NeutralChange;
}
}
if (hint) {
// If they're different by now, we're done.
return hint;
}
// We could have same layers and values, but different count still.
if (mAttachmentCount != aNewLayers.mAttachmentCount || if (mAttachmentCount != aNewLayers.mAttachmentCount ||
mBlendModeCount != aNewLayers.mBlendModeCount || mBlendModeCount != aNewLayers.mBlendModeCount ||
mClipCount != aNewLayers.mClipCount || mClipCount != aNewLayers.mClipCount ||
@ -3309,7 +3345,8 @@ nsChangeHint nsStyleDisplay::CalcDifference(
mAnimationIterationCountCount != mAnimationIterationCountCount !=
aNewData.mAnimationIterationCountCount || aNewData.mAnimationIterationCountCount ||
mScrollSnapCoordinate != aNewData.mScrollSnapCoordinate || mScrollSnapCoordinate != aNewData.mScrollSnapCoordinate ||
mWillChange != aNewData.mWillChange)) { mWillChange != aNewData.mWillChange ||
mOverflowAnchor != aNewData.mOverflowAnchor)) {
hint |= nsChangeHint_NeutralChange; hint |= nsChangeHint_NeutralChange;
} }

Просмотреть файл

@ -180,6 +180,7 @@ support-files = file_bug1443344.css
skip-if = toolkit == 'android' skip-if = toolkit == 'android'
[test_computed_style.html] [test_computed_style.html]
[test_computed_style_bfcache_display_none.html] [test_computed_style_bfcache_display_none.html]
[test_computed_style_difference.html]
[test_computed_style_grid_with_pseudo.html] [test_computed_style_grid_with_pseudo.html]
[test_computed_style_in_created_document.html] [test_computed_style_in_created_document.html]
[test_computed_style_min_size_auto.html] [test_computed_style_min_size_auto.html]

Просмотреть файл

@ -0,0 +1,104 @@
<!doctype html>
<title>Test that the difference of the computed style of an element is always correctly propagated</title>
<!--
There are CSS property changes that don't have an effect in computed style.
It's relatively easy to return `nsChangeHint(0)` for the case where the
property changes but it should have no rendering difference.
That's however incorrect, since if it's an inherited property, or a
descendant explicitly inherits it, we should still propagate the change
downwards.
This test tests that computed style diffing is correct.
-->
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="property_database.js"></script>
<div id="outer">
<div id="inner"></div>
</div>
<script>
// We need to skip checking for properties for which the value returned by
// getComputedStyle depends on the parent.
//
// TODO(emilio): We could test a subset of these, see below.
const kWhitelist = [
// Could test display values that don't force blockification of children.
"display",
// Could avoid testing only the ones that have percentages.
"transform",
"transform-origin",
"perspective-origin",
"padding-bottom",
"padding-left",
"padding-right",
"padding-top",
"padding-inline-end",
"padding-inline-start",
"padding-block-end",
"padding-block-start",
"margin-bottom",
"margin-left",
"margin-right",
"margin-top",
"margin-inline-end",
"margin-inline-start",
"margin-block-end",
"margin-block-start",
"width",
"height",
"block-size",
"inline-size",
"min-height",
"min-width",
"min-block-size",
"min-inline-size",
];
const outer = document.getElementById("outer");
const inner = document.getElementById("inner");
function testValue(prop, value) {
outer.style.setProperty(prop, value);
const computed = getComputedStyle(outer).getPropertyValue(prop);
assert_equals(
getComputedStyle(inner).getPropertyValue(prop), computed,
"Didn't handle the inherited change correctly?"
)
}
// Note that we intentionally ignore the "prerequisites" here, since that's
// the most likely place where the diffing could potentially go wrong.
function testProperty(prop, info) {
// We only care about longhands, changing shorthands is not that interesting,
// since we're interested of changing as little as possible, and changing
// them would be equivalent to changing all the longhands at the same time.
if (info.type !== CSS_TYPE_LONGHAND)
return;
if (kWhitelist.includes(prop))
return;
inner.style.setProperty(prop, "inherit");
for (const v of info.initial_values)
testValue(prop, v);
for (const v of info.other_values)
testValue(prop, v);
// Test again the first value so that we test changing to it, not just from
// it.
//
// TODO(emilio): We could test every value against every-value if we wanted,
// might be worth it.
testValue(prop, info.initial_values[0]);
inner.style.removeProperty(prop);
}
for (let prop in gCSSProperties)
test(() => testProperty(prop, gCSSProperties[prop]), "Diffing for " + prop);
</script>

Просмотреть файл

@ -446,19 +446,15 @@ def target_tasks_nightly_fennec(full_task_graph, parameters, graph_config):
nightly build process involves a pipeline of builds, signing, nightly build process involves a pipeline of builds, signing,
and, eventually, uploading the tasks to balrog.""" and, eventually, uploading the tasks to balrog."""
def filter(task): def filter(task):
platform = task.attributes.get('build_platform') # XXX Starting 69, we don't ship Fennec Nightly anymore. We just want geckoview to be
if not filter_for_project(task, parameters): # uploaded
return False return task.label in (
if platform in ('android-aarch64-nightly', 'beetmover-geckoview-android-aarch64-nightly/opt',
'android-api-16-nightly', 'beetmover-geckoview-android-api-16-nightly/opt',
'android-nightly', 'beetmover-geckoview-android-x86-nightly/opt',
'android-x86-nightly', 'beetmover-geckoview-android-x86_64-nightly/opt',
'android-x86_64-nightly', )
):
if not task.attributes.get('nightly', False):
return False
return filter_for_project(task, parameters)
filter
return [l for l, t in full_task_graph.tasks.iteritems() if filter(t)] return [l for l, t in full_task_graph.tasks.iteritems() if filter(t)]

Просмотреть файл

@ -288,7 +288,7 @@ class PrintingChild extends ActorChild {
let listener = new PrintingListener(this.mm); let listener = new PrintingListener(this.mm);
this.printPreviewInitializingInfo = { changingBrowsers }; this.printPreviewInitializingInfo = { changingBrowsers };
docShell.printPreview.printPreview(printSettings, contentWindow, listener); docShell.initOrReusePrintPreviewViewer().printPreview(printSettings, contentWindow, listener);
} catch (error) { } catch (error) {
// This might fail if we, for example, attempt to print a XUL document. // This might fail if we, for example, attempt to print a XUL document.
// In that case, we inform the parent to bail out of print preview. // In that case, we inform the parent to bail out of print preview.
@ -318,7 +318,7 @@ class PrintingChild extends ActorChild {
exitPrintPreview(glo) { exitPrintPreview(glo) {
this.printPreviewInitializingInfo = null; this.printPreviewInitializingInfo = null;
this.docShell.printPreview.exitPrintPreview(); this.docShell.initOrReusePrintPreviewViewer().exitPrintPreview();
} }
print(contentWindow, simplifiedMode, defaultPrinterName) { print(contentWindow, simplifiedMode, defaultPrinterName) {
@ -385,14 +385,14 @@ class PrintingChild extends ActorChild {
} }
updatePageCount() { updatePageCount() {
let numPages = this.docShell.printPreview.printPreviewNumPages; let numPages = this.docShell.initOrReusePrintPreviewViewer().printPreviewNumPages;
this.mm.sendAsyncMessage("Printing:Preview:UpdatePageCount", { this.mm.sendAsyncMessage("Printing:Preview:UpdatePageCount", {
numPages, numPages,
}); });
} }
navigate(navType, pageNum) { navigate(navType, pageNum) {
this.docShell.printPreview.printPreviewNavigate(navType, pageNum); this.docShell.initOrReusePrintPreviewViewer().printPreviewNavigate(navType, pageNum);
} }
} }

Просмотреть файл

@ -123,12 +123,10 @@ var PrintUtils = {
* The <xul:browser> that the nsIDOMWindow for aWindowID belongs to. * The <xul:browser> that the nsIDOMWindow for aWindowID belongs to.
*/ */
printWindow(aWindowID, aBrowser) { printWindow(aWindowID, aBrowser) {
let mm = aBrowser.messageManager; aBrowser.messageManager.sendAsyncMessage("Printing:Print", {
let defaultPrinterName = this._getDefaultPrinterName();
mm.sendAsyncMessage("Printing:Print", {
windowID: aWindowID, windowID: aWindowID,
simplifiedMode: this._shouldSimplify, simplifiedMode: this._shouldSimplify,
defaultPrinterName, defaultPrinterName: this._getDefaultPrinterName(),
}); });
}, },