зеркало из https://github.com/mozilla/gecko-dev.git
Merge inbound to mozilla-central. a=merge
This commit is contained in:
Коммит
0b0e657cc1
|
@ -1,5 +1,5 @@
|
|||
This is the PDF.js project output, https://github.com/mozilla/pdf.js
|
||||
|
||||
Current extension version is: 2.1.132
|
||||
Current extension version is: 2.1.145
|
||||
|
||||
Taken from upstream commit: d3868e1b
|
||||
Taken from upstream commit: d8f201ea
|
||||
|
|
|
@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
"use strict";
|
||||
|
||||
|
||||
var pdfjsVersion = '2.1.132';
|
||||
var pdfjsBuild = 'd3868e1b';
|
||||
var pdfjsVersion = '2.1.145';
|
||||
var pdfjsBuild = 'd8f201ea';
|
||||
|
||||
var pdfjsSharedUtil = __w_pdfjs_require__(1);
|
||||
|
||||
|
@ -235,7 +235,7 @@ Object.defineProperty(exports, "URL", {
|
|||
return _url_polyfill.URL;
|
||||
}
|
||||
});
|
||||
exports.createObjectURL = exports.FormatError = exports.XRefParseException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = void 0;
|
||||
exports.createObjectURL = exports.FormatError = exports.XRefParseException = exports.XRefEntryException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = void 0;
|
||||
|
||||
__w_pdfjs_require__(2);
|
||||
|
||||
|
@ -695,6 +695,19 @@ var MissingDataException = function MissingDataExceptionClosure() {
|
|||
|
||||
exports.MissingDataException = MissingDataException;
|
||||
|
||||
const XRefEntryException = function XRefEntryExceptionClosure() {
|
||||
function XRefEntryException(msg) {
|
||||
this.message = msg;
|
||||
}
|
||||
|
||||
XRefEntryException.prototype = new Error();
|
||||
XRefEntryException.prototype.name = 'XRefEntryException';
|
||||
XRefEntryException.constructor = XRefEntryException;
|
||||
return XRefEntryException;
|
||||
}();
|
||||
|
||||
exports.XRefEntryException = XRefEntryException;
|
||||
|
||||
var XRefParseException = function XRefParseExceptionClosure() {
|
||||
function XRefParseException(msg) {
|
||||
this.message = msg;
|
||||
|
@ -5141,7 +5154,7 @@ function _fetchDocument(worker, source, pdfDataRangeTransport, docId) {
|
|||
|
||||
return worker.messageHandler.sendWithPromise('GetDocRequest', {
|
||||
docId,
|
||||
apiVersion: '2.1.132',
|
||||
apiVersion: '2.1.145',
|
||||
source: {
|
||||
data: source.data,
|
||||
url: source.url,
|
||||
|
@ -6872,9 +6885,9 @@ const InternalRenderTask = function InternalRenderTaskClosure() {
|
|||
return InternalRenderTask;
|
||||
}();
|
||||
|
||||
const version = '2.1.132';
|
||||
const version = '2.1.145';
|
||||
exports.version = version;
|
||||
const build = 'd3868e1b';
|
||||
const build = 'd8f201ea';
|
||||
exports.build = build;
|
||||
|
||||
/***/ }),
|
||||
|
@ -8784,11 +8797,10 @@ var CanvasGraphics = function CanvasGraphicsClosure() {
|
|||
var name = fontObj.loadedName || 'sans-serif';
|
||||
var bold = fontObj.black ? '900' : fontObj.bold ? 'bold' : 'normal';
|
||||
var italic = fontObj.italic ? 'italic' : 'normal';
|
||||
var typeface = '"' + name + '", ' + fontObj.fallbackName;
|
||||
var typeface = `"${name}", ${fontObj.fallbackName}`;
|
||||
var browserFontSize = size < MIN_FONT_SIZE ? MIN_FONT_SIZE : size > MAX_FONT_SIZE ? MAX_FONT_SIZE : size;
|
||||
this.current.fontSizeScale = size / browserFontSize;
|
||||
var rule = italic + ' ' + bold + ' ' + browserFontSize + 'px ' + typeface;
|
||||
this.ctx.font = rule;
|
||||
this.ctx.font = `${italic} ${bold} ${browserFontSize}px ${typeface}`;
|
||||
},
|
||||
setTextRenderingMode: function CanvasGraphics_setTextRenderingMode(mode) {
|
||||
this.current.textRenderingMode = mode;
|
||||
|
@ -12344,14 +12356,14 @@ var renderTextLayer = function renderTextLayerClosure() {
|
|||
|
||||
if (textDivProperties.canvasWidth !== 0 && width > 0) {
|
||||
textDivProperties.scale = textDivProperties.canvasWidth / width;
|
||||
transform = 'scaleX(' + textDivProperties.scale + ')';
|
||||
transform = `scaleX(${textDivProperties.scale})`;
|
||||
}
|
||||
|
||||
if (textDivProperties.angle !== 0) {
|
||||
transform = 'rotate(' + textDivProperties.angle + 'deg) ' + transform;
|
||||
transform = `rotate(${textDivProperties.angle}deg) ${transform}`;
|
||||
}
|
||||
|
||||
if (transform !== '') {
|
||||
if (transform.length > 0) {
|
||||
textDivProperties.originalTransform = transform;
|
||||
textDiv.style.transform = transform;
|
||||
}
|
||||
|
|
|
@ -123,8 +123,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
"use strict";
|
||||
|
||||
|
||||
var pdfjsVersion = '2.1.132';
|
||||
var pdfjsBuild = 'd3868e1b';
|
||||
var pdfjsVersion = '2.1.145';
|
||||
var pdfjsBuild = 'd8f201ea';
|
||||
|
||||
var pdfjsCoreWorker = __w_pdfjs_require__(1);
|
||||
|
||||
|
@ -375,7 +375,7 @@ var WorkerMessageHandler = {
|
|||
var cancelXHRs = null;
|
||||
var WorkerTasks = [];
|
||||
let apiVersion = docParams.apiVersion;
|
||||
let workerVersion = '2.1.132';
|
||||
let workerVersion = '2.1.145';
|
||||
|
||||
if (apiVersion !== workerVersion) {
|
||||
throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
|
||||
|
@ -403,28 +403,20 @@ var WorkerMessageHandler = {
|
|||
WorkerTasks.splice(i, 1);
|
||||
}
|
||||
|
||||
function loadDocument(recoveryMode) {
|
||||
var loadDocumentCapability = (0, _util.createPromiseCapability)();
|
||||
async function loadDocument(recoveryMode) {
|
||||
await pdfManager.ensureDoc('checkHeader');
|
||||
await pdfManager.ensureDoc('parseStartXRef');
|
||||
await pdfManager.ensureDoc('parse', [recoveryMode]);
|
||||
|
||||
var parseSuccess = function parseSuccess() {
|
||||
Promise.all([pdfManager.ensureDoc('numPages'), pdfManager.ensureDoc('fingerprint')]).then(function ([numPages, fingerprint]) {
|
||||
loadDocumentCapability.resolve({
|
||||
if (!recoveryMode) {
|
||||
await pdfManager.ensureDoc('checkFirstPage');
|
||||
}
|
||||
|
||||
const [numPages, fingerprint] = await Promise.all([pdfManager.ensureDoc('numPages'), pdfManager.ensureDoc('fingerprint')]);
|
||||
return {
|
||||
numPages,
|
||||
fingerprint
|
||||
});
|
||||
}, parseFailure);
|
||||
};
|
||||
|
||||
var parseFailure = function parseFailure(e) {
|
||||
loadDocumentCapability.reject(e);
|
||||
};
|
||||
|
||||
pdfManager.ensureDoc('checkHeader', []).then(function () {
|
||||
pdfManager.ensureDoc('parseStartXRef', []).then(function () {
|
||||
pdfManager.ensureDoc('parse', [recoveryMode]).then(parseSuccess, parseFailure);
|
||||
}, parseFailure);
|
||||
}, parseFailure);
|
||||
return loadDocumentCapability.promise;
|
||||
}
|
||||
|
||||
function getPdfManager(data, evaluatorOptions) {
|
||||
|
@ -880,7 +872,7 @@ Object.defineProperty(exports, "URL", {
|
|||
return _url_polyfill.URL;
|
||||
}
|
||||
});
|
||||
exports.createObjectURL = exports.FormatError = exports.XRefParseException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = void 0;
|
||||
exports.createObjectURL = exports.FormatError = exports.XRefParseException = exports.XRefEntryException = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.NativeImageDecoding = exports.MissingPDFException = exports.MissingDataException = exports.InvalidPDFException = exports.AbortException = exports.CMapCompressionType = exports.ImageKind = exports.FontType = exports.AnnotationType = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.UNSUPPORTED_FEATURES = exports.VerbosityLevel = exports.OPS = exports.IDENTITY_MATRIX = exports.FONT_IDENTITY_MATRIX = void 0;
|
||||
|
||||
__w_pdfjs_require__(3);
|
||||
|
||||
|
@ -1340,6 +1332,19 @@ var MissingDataException = function MissingDataExceptionClosure() {
|
|||
|
||||
exports.MissingDataException = MissingDataException;
|
||||
|
||||
const XRefEntryException = function XRefEntryExceptionClosure() {
|
||||
function XRefEntryException(msg) {
|
||||
this.message = msg;
|
||||
}
|
||||
|
||||
XRefEntryException.prototype = new Error();
|
||||
XRefEntryException.prototype.name = 'XRefEntryException';
|
||||
XRefEntryException.constructor = XRefEntryException;
|
||||
return XRefEntryException;
|
||||
}();
|
||||
|
||||
exports.XRefEntryException = XRefEntryException;
|
||||
|
||||
var XRefParseException = function XRefParseExceptionClosure() {
|
||||
function XRefParseException(msg) {
|
||||
this.message = msg;
|
||||
|
@ -6372,15 +6377,15 @@ var _evaluator = __w_pdfjs_require__(28);
|
|||
|
||||
var _function = __w_pdfjs_require__(42);
|
||||
|
||||
var Page = function PageClosure() {
|
||||
var DEFAULT_USER_UNIT = 1.0;
|
||||
var LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
|
||||
const DEFAULT_USER_UNIT = 1.0;
|
||||
const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
|
||||
|
||||
function isAnnotationRenderable(annotation, intent) {
|
||||
function isAnnotationRenderable(annotation, intent) {
|
||||
return intent === 'display' && annotation.viewable || intent === 'print' && annotation.printable;
|
||||
}
|
||||
}
|
||||
|
||||
function Page({
|
||||
class Page {
|
||||
constructor({
|
||||
pdfManager,
|
||||
xref,
|
||||
pageIndex,
|
||||
|
@ -6400,8 +6405,8 @@ var Page = function PageClosure() {
|
|||
this.pdfFunctionFactory = pdfFunctionFactory;
|
||||
this.evaluatorOptions = pdfManager.evaluatorOptions;
|
||||
this.resourcesPromise = null;
|
||||
var uniquePrefix = 'p' + this.pageIndex + '_';
|
||||
var idCounters = {
|
||||
const uniquePrefix = `p${this.pageIndex}_`;
|
||||
const idCounters = {
|
||||
obj: 0
|
||||
};
|
||||
this.idFactory = {
|
||||
|
@ -6412,9 +6417,8 @@ var Page = function PageClosure() {
|
|||
};
|
||||
}
|
||||
|
||||
Page.prototype = {
|
||||
_getInheritableProperty(key, getArray = false) {
|
||||
let value = (0, _util.getInheritableProperty)({
|
||||
const value = (0, _util.getInheritableProperty)({
|
||||
dict: this.pageDict,
|
||||
key,
|
||||
getArray,
|
||||
|
@ -6430,61 +6434,61 @@ var Page = function PageClosure() {
|
|||
}
|
||||
|
||||
return _primitives.Dict.merge(this.xref, value);
|
||||
},
|
||||
}
|
||||
|
||||
get content() {
|
||||
return this.pageDict.get('Contents');
|
||||
},
|
||||
}
|
||||
|
||||
get resources() {
|
||||
return (0, _util.shadow)(this, 'resources', this._getInheritableProperty('Resources') || _primitives.Dict.empty);
|
||||
},
|
||||
}
|
||||
|
||||
get mediaBox() {
|
||||
var mediaBox = this._getInheritableProperty('MediaBox', true);
|
||||
const mediaBox = this._getInheritableProperty('MediaBox', true);
|
||||
|
||||
if (!Array.isArray(mediaBox) || mediaBox.length !== 4) {
|
||||
return (0, _util.shadow)(this, 'mediaBox', LETTER_SIZE_MEDIABOX);
|
||||
}
|
||||
|
||||
return (0, _util.shadow)(this, 'mediaBox', mediaBox);
|
||||
},
|
||||
}
|
||||
|
||||
get cropBox() {
|
||||
var cropBox = this._getInheritableProperty('CropBox', true);
|
||||
const cropBox = this._getInheritableProperty('CropBox', true);
|
||||
|
||||
if (!Array.isArray(cropBox) || cropBox.length !== 4) {
|
||||
return (0, _util.shadow)(this, 'cropBox', this.mediaBox);
|
||||
}
|
||||
|
||||
return (0, _util.shadow)(this, 'cropBox', cropBox);
|
||||
},
|
||||
}
|
||||
|
||||
get userUnit() {
|
||||
var obj = this.pageDict.get('UserUnit');
|
||||
let obj = this.pageDict.get('UserUnit');
|
||||
|
||||
if (!(0, _util.isNum)(obj) || obj <= 0) {
|
||||
obj = DEFAULT_USER_UNIT;
|
||||
}
|
||||
|
||||
return (0, _util.shadow)(this, 'userUnit', obj);
|
||||
},
|
||||
}
|
||||
|
||||
get view() {
|
||||
var mediaBox = this.mediaBox,
|
||||
const mediaBox = this.mediaBox,
|
||||
cropBox = this.cropBox;
|
||||
|
||||
if (mediaBox === cropBox) {
|
||||
return (0, _util.shadow)(this, 'view', mediaBox);
|
||||
}
|
||||
|
||||
var intersection = _util.Util.intersect(cropBox, mediaBox);
|
||||
const intersection = _util.Util.intersect(cropBox, mediaBox);
|
||||
|
||||
return (0, _util.shadow)(this, 'view', intersection || mediaBox);
|
||||
},
|
||||
}
|
||||
|
||||
get rotate() {
|
||||
var rotate = this._getInheritableProperty('Rotate') || 0;
|
||||
let rotate = this._getInheritableProperty('Rotate') || 0;
|
||||
|
||||
if (rotate % 90 !== 0) {
|
||||
rotate = 0;
|
||||
|
@ -6495,20 +6499,18 @@ var Page = function PageClosure() {
|
|||
}
|
||||
|
||||
return (0, _util.shadow)(this, 'rotate', rotate);
|
||||
},
|
||||
}
|
||||
|
||||
getContentStream: function Page_getContentStream() {
|
||||
var content = this.content;
|
||||
var stream;
|
||||
getContentStream() {
|
||||
const content = this.content;
|
||||
let stream;
|
||||
|
||||
if (Array.isArray(content)) {
|
||||
var xref = this.xref;
|
||||
var i,
|
||||
n = content.length;
|
||||
var streams = [];
|
||||
const xref = this.xref;
|
||||
const streams = [];
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
streams.push(xref.fetchIfRef(content[i]));
|
||||
for (const stream of content) {
|
||||
streams.push(xref.fetchIfRef(stream));
|
||||
}
|
||||
|
||||
stream = new _stream.StreamsSequenceStream(streams);
|
||||
|
@ -6519,17 +6521,18 @@ var Page = function PageClosure() {
|
|||
}
|
||||
|
||||
return stream;
|
||||
},
|
||||
loadResources: function Page_loadResources(keys) {
|
||||
}
|
||||
|
||||
loadResources(keys) {
|
||||
if (!this.resourcesPromise) {
|
||||
this.resourcesPromise = this.pdfManager.ensure(this, 'resources');
|
||||
}
|
||||
|
||||
return this.resourcesPromise.then(() => {
|
||||
let objectLoader = new _obj.ObjectLoader(this.resources, keys, this.xref);
|
||||
const objectLoader = new _obj.ObjectLoader(this.resources, keys, this.xref);
|
||||
return objectLoader.load();
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
getOperatorList({
|
||||
handler,
|
||||
|
@ -6537,9 +6540,9 @@ var Page = function PageClosure() {
|
|||
intent,
|
||||
renderInteractiveForms
|
||||
}) {
|
||||
var contentStreamPromise = this.pdfManager.ensure(this, 'getContentStream');
|
||||
var resourcesPromise = this.loadResources(['ExtGState', 'ColorSpace', 'Pattern', 'Shading', 'XObject', 'Font']);
|
||||
var partialEvaluator = new _evaluator.PartialEvaluator({
|
||||
const contentStreamPromise = this.pdfManager.ensure(this, 'getContentStream');
|
||||
const resourcesPromise = this.loadResources(['ExtGState', 'ColorSpace', 'Pattern', 'Shading', 'XObject', 'Font']);
|
||||
const partialEvaluator = new _evaluator.PartialEvaluator({
|
||||
pdfManager: this.pdfManager,
|
||||
xref: this.xref,
|
||||
handler,
|
||||
|
@ -6550,9 +6553,9 @@ var Page = function PageClosure() {
|
|||
options: this.evaluatorOptions,
|
||||
pdfFunctionFactory: this.pdfFunctionFactory
|
||||
});
|
||||
var dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
|
||||
var pageListPromise = dataPromises.then(([contentStream]) => {
|
||||
var opList = new _operator_list.OperatorList(intent, handler, this.pageIndex);
|
||||
const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
|
||||
const pageListPromise = dataPromises.then(([contentStream]) => {
|
||||
const opList = new _operator_list.OperatorList(intent, handler, this.pageIndex);
|
||||
handler.send('StartRenderPage', {
|
||||
transparency: partialEvaluator.hasBlendModes(this.resources),
|
||||
pageIndex: this.pageIndex,
|
||||
|
@ -6573,21 +6576,19 @@ var Page = function PageClosure() {
|
|||
return pageOpList;
|
||||
}
|
||||
|
||||
var i,
|
||||
ii,
|
||||
opListPromises = [];
|
||||
const opListPromises = [];
|
||||
|
||||
for (i = 0, ii = annotations.length; i < ii; i++) {
|
||||
if (isAnnotationRenderable(annotations[i], intent)) {
|
||||
opListPromises.push(annotations[i].getOperatorList(partialEvaluator, task, renderInteractiveForms));
|
||||
for (const annotation of annotations) {
|
||||
if (isAnnotationRenderable(annotation, intent)) {
|
||||
opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms));
|
||||
}
|
||||
}
|
||||
|
||||
return Promise.all(opListPromises).then(function (opLists) {
|
||||
pageOpList.addOp(_util.OPS.beginAnnotations, []);
|
||||
|
||||
for (i = 0, ii = opLists.length; i < ii; i++) {
|
||||
pageOpList.addOpList(opLists[i]);
|
||||
for (const opList of opLists) {
|
||||
pageOpList.addOpList(opList);
|
||||
}
|
||||
|
||||
pageOpList.addOp(_util.OPS.endAnnotations, []);
|
||||
|
@ -6595,7 +6596,7 @@ var Page = function PageClosure() {
|
|||
return pageOpList;
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
extractTextContent({
|
||||
handler,
|
||||
|
@ -6604,11 +6605,11 @@ var Page = function PageClosure() {
|
|||
sink,
|
||||
combineTextItems
|
||||
}) {
|
||||
var contentStreamPromise = this.pdfManager.ensure(this, 'getContentStream');
|
||||
var resourcesPromise = this.loadResources(['ExtGState', 'XObject', 'Font']);
|
||||
var dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
|
||||
const contentStreamPromise = this.pdfManager.ensure(this, 'getContentStream');
|
||||
const resourcesPromise = this.loadResources(['ExtGState', 'XObject', 'Font']);
|
||||
const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
|
||||
return dataPromises.then(([contentStream]) => {
|
||||
var partialEvaluator = new _evaluator.PartialEvaluator({
|
||||
const partialEvaluator = new _evaluator.PartialEvaluator({
|
||||
pdfManager: this.pdfManager,
|
||||
xref: this.xref,
|
||||
handler,
|
||||
|
@ -6628,11 +6629,11 @@ var Page = function PageClosure() {
|
|||
sink
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
getAnnotationsData(intent) {
|
||||
return this._parsedAnnotations.then(function (annotations) {
|
||||
let annotationsData = [];
|
||||
const annotationsData = [];
|
||||
|
||||
for (let i = 0, ii = annotations.length; i < ii; i++) {
|
||||
if (!intent || isAnnotationRenderable(annotations[i], intent)) {
|
||||
|
@ -6642,11 +6643,11 @@ var Page = function PageClosure() {
|
|||
|
||||
return annotationsData;
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
get annotations() {
|
||||
return (0, _util.shadow)(this, 'annotations', this._getInheritableProperty('Annots') || []);
|
||||
},
|
||||
}
|
||||
|
||||
get _parsedAnnotations() {
|
||||
const parsedAnnotations = this.pdfManager.ensure(this, 'annotations').then(() => {
|
||||
|
@ -6669,18 +6670,41 @@ var Page = function PageClosure() {
|
|||
return (0, _util.shadow)(this, '_parsedAnnotations', parsedAnnotations);
|
||||
}
|
||||
|
||||
};
|
||||
return Page;
|
||||
}();
|
||||
}
|
||||
|
||||
exports.Page = Page;
|
||||
const FINGERPRINT_FIRST_BYTES = 1024;
|
||||
const EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00\x00';
|
||||
|
||||
var PDFDocument = function PDFDocumentClosure() {
|
||||
var FINGERPRINT_FIRST_BYTES = 1024;
|
||||
var EMPTY_FINGERPRINT = '\x00\x00\x00\x00\x00\x00\x00' + '\x00\x00\x00\x00\x00\x00\x00\x00\x00';
|
||||
function find(stream, needle, limit, backwards) {
|
||||
const pos = stream.pos;
|
||||
const end = stream.end;
|
||||
|
||||
function PDFDocument(pdfManager, arg) {
|
||||
var stream;
|
||||
if (pos + limit > end) {
|
||||
limit = end - pos;
|
||||
}
|
||||
|
||||
const strBuf = [];
|
||||
|
||||
for (let i = 0; i < limit; ++i) {
|
||||
strBuf.push(String.fromCharCode(stream.getByte()));
|
||||
}
|
||||
|
||||
const str = strBuf.join('');
|
||||
stream.pos = pos;
|
||||
const index = backwards ? str.lastIndexOf(needle) : str.indexOf(needle);
|
||||
|
||||
if (index === -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
stream.pos += index;
|
||||
return true;
|
||||
}
|
||||
|
||||
class PDFDocument {
|
||||
constructor(pdfManager, arg) {
|
||||
let stream;
|
||||
|
||||
if ((0, _primitives.isStream)(arg)) {
|
||||
stream = arg;
|
||||
|
@ -6691,60 +6715,22 @@ var PDFDocument = function PDFDocumentClosure() {
|
|||
}
|
||||
|
||||
if (stream.length <= 0) {
|
||||
throw new Error('PDFDocument: stream must have data');
|
||||
throw new Error('PDFDocument: Stream must have data');
|
||||
}
|
||||
|
||||
this.pdfManager = pdfManager;
|
||||
this.stream = stream;
|
||||
this.xref = new _obj.XRef(stream, pdfManager);
|
||||
let evaluatorOptions = pdfManager.evaluatorOptions;
|
||||
this.pdfFunctionFactory = new _function.PDFFunctionFactory({
|
||||
xref: this.xref,
|
||||
isEvalSupported: evaluatorOptions.isEvalSupported
|
||||
isEvalSupported: pdfManager.evaluatorOptions.isEvalSupported
|
||||
});
|
||||
this._pagePromises = [];
|
||||
}
|
||||
|
||||
function find(stream, needle, limit, backwards) {
|
||||
var pos = stream.pos;
|
||||
var end = stream.end;
|
||||
var strBuf = [];
|
||||
|
||||
if (pos + limit > end) {
|
||||
limit = end - pos;
|
||||
}
|
||||
|
||||
for (var n = 0; n < limit; ++n) {
|
||||
strBuf.push(String.fromCharCode(stream.getByte()));
|
||||
}
|
||||
|
||||
var str = strBuf.join('');
|
||||
stream.pos = pos;
|
||||
var index = backwards ? str.lastIndexOf(needle) : str.indexOf(needle);
|
||||
|
||||
if (index === -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
stream.pos += index;
|
||||
return true;
|
||||
}
|
||||
|
||||
const DocumentInfoValidators = {
|
||||
Title: _util.isString,
|
||||
Author: _util.isString,
|
||||
Subject: _util.isString,
|
||||
Keywords: _util.isString,
|
||||
Creator: _util.isString,
|
||||
Producer: _util.isString,
|
||||
CreationDate: _util.isString,
|
||||
ModDate: _util.isString,
|
||||
Trapped: _primitives.isName
|
||||
};
|
||||
PDFDocument.prototype = {
|
||||
parse: function PDFDocument_parse(recoveryMode) {
|
||||
parse(recoveryMode) {
|
||||
this.setup(recoveryMode);
|
||||
var version = this.catalog.catDict.get('Version');
|
||||
const version = this.catalog.catDict.get('Version');
|
||||
|
||||
if ((0, _primitives.isName)(version)) {
|
||||
this.pdfFormatVersion = version.name;
|
||||
|
@ -6755,7 +6741,7 @@ var PDFDocument = function PDFDocumentClosure() {
|
|||
|
||||
if (this.acroForm) {
|
||||
this.xfa = this.acroForm.get('XFA');
|
||||
var fields = this.acroForm.get('Fields');
|
||||
const fields = this.acroForm.get('Fields');
|
||||
|
||||
if ((!fields || !Array.isArray(fields) || fields.length === 0) && !this.xfa) {
|
||||
this.acroForm = null;
|
||||
|
@ -6766,10 +6752,10 @@ var PDFDocument = function PDFDocumentClosure() {
|
|||
throw ex;
|
||||
}
|
||||
|
||||
(0, _util.info)('Something wrong with AcroForm entry');
|
||||
(0, _util.info)('Cannot fetch AcroForm entry; assuming no AcroForms are present');
|
||||
this.acroForm = null;
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
get linearization() {
|
||||
let linearization = null;
|
||||
|
@ -6785,26 +6771,26 @@ var PDFDocument = function PDFDocumentClosure() {
|
|||
}
|
||||
|
||||
return (0, _util.shadow)(this, 'linearization', linearization);
|
||||
},
|
||||
}
|
||||
|
||||
get startXRef() {
|
||||
var stream = this.stream;
|
||||
var startXRef = 0;
|
||||
var linearization = this.linearization;
|
||||
const stream = this.stream;
|
||||
let startXRef = 0;
|
||||
|
||||
if (linearization) {
|
||||
if (this.linearization) {
|
||||
stream.reset();
|
||||
|
||||
if (find(stream, 'endobj', 1024)) {
|
||||
startXRef = stream.pos + 6;
|
||||
}
|
||||
} else {
|
||||
var step = 1024;
|
||||
var found = false,
|
||||
const step = 1024;
|
||||
const startXRefLength = 'startxref'.length;
|
||||
let found = false,
|
||||
pos = stream.end;
|
||||
|
||||
while (!found && pos > 0) {
|
||||
pos -= step - 'startxref'.length;
|
||||
pos -= step - startXRefLength;
|
||||
|
||||
if (pos < 0) {
|
||||
pos = 0;
|
||||
|
@ -6816,13 +6802,13 @@ var PDFDocument = function PDFDocumentClosure() {
|
|||
|
||||
if (found) {
|
||||
stream.skip(9);
|
||||
var ch;
|
||||
let ch;
|
||||
|
||||
do {
|
||||
ch = stream.getByte();
|
||||
} while ((0, _util.isSpace)(ch));
|
||||
|
||||
var str = '';
|
||||
let str = '';
|
||||
|
||||
while (ch >= 0x20 && ch <= 0x39) {
|
||||
str += String.fromCharCode(ch);
|
||||
|
@ -6838,20 +6824,23 @@ var PDFDocument = function PDFDocumentClosure() {
|
|||
}
|
||||
|
||||
return (0, _util.shadow)(this, 'startXRef', startXRef);
|
||||
},
|
||||
}
|
||||
|
||||
checkHeader: function PDFDocument_checkHeader() {
|
||||
var stream = this.stream;
|
||||
checkHeader() {
|
||||
const stream = this.stream;
|
||||
stream.reset();
|
||||
|
||||
if (find(stream, '%PDF-', 1024)) {
|
||||
if (!find(stream, '%PDF-', 1024)) {
|
||||
return;
|
||||
}
|
||||
|
||||
stream.moveStart();
|
||||
var MAX_VERSION_LENGTH = 12;
|
||||
var version = '',
|
||||
const MAX_PDF_VERSION_LENGTH = 12;
|
||||
let version = '',
|
||||
ch;
|
||||
|
||||
while ((ch = stream.getByte()) > 0x20) {
|
||||
if (version.length >= MAX_VERSION_LENGTH) {
|
||||
if (version.length >= MAX_PDF_VERSION_LENGTH) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -6861,26 +6850,35 @@ var PDFDocument = function PDFDocumentClosure() {
|
|||
if (!this.pdfFormatVersion) {
|
||||
this.pdfFormatVersion = version.substring(5);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
},
|
||||
parseStartXRef: function PDFDocument_parseStartXRef() {
|
||||
var startXRef = this.startXRef;
|
||||
this.xref.setStartXRef(startXRef);
|
||||
},
|
||||
setup: function PDFDocument_setup(recoveryMode) {
|
||||
|
||||
parseStartXRef() {
|
||||
this.xref.setStartXRef(this.startXRef);
|
||||
}
|
||||
|
||||
setup(recoveryMode) {
|
||||
this.xref.parse(recoveryMode);
|
||||
this.catalog = new _obj.Catalog(this.pdfManager, this.xref);
|
||||
},
|
||||
}
|
||||
|
||||
get numPages() {
|
||||
var linearization = this.linearization;
|
||||
var num = linearization ? linearization.numPages : this.catalog.numPages;
|
||||
const linearization = this.linearization;
|
||||
const num = linearization ? linearization.numPages : this.catalog.numPages;
|
||||
return (0, _util.shadow)(this, 'numPages', num);
|
||||
},
|
||||
}
|
||||
|
||||
get documentInfo() {
|
||||
const DocumentInfoValidators = {
|
||||
Title: _util.isString,
|
||||
Author: _util.isString,
|
||||
Subject: _util.isString,
|
||||
Keywords: _util.isString,
|
||||
Creator: _util.isString,
|
||||
Producer: _util.isString,
|
||||
CreationDate: _util.isString,
|
||||
ModDate: _util.isString,
|
||||
Trapped: _primitives.isName
|
||||
};
|
||||
const docInfo = {
|
||||
PDFFormatVersion: this.pdfFormatVersion,
|
||||
IsLinearized: !!this.linearization,
|
||||
|
@ -6900,7 +6898,7 @@ var PDFDocument = function PDFDocumentClosure() {
|
|||
}
|
||||
|
||||
if ((0, _primitives.isDict)(infoDict)) {
|
||||
for (let key of infoDict.getKeys()) {
|
||||
for (const key of infoDict.getKeys()) {
|
||||
const value = infoDict.get(key);
|
||||
|
||||
if (DocumentInfoValidators[key]) {
|
||||
|
@ -6931,13 +6929,11 @@ var PDFDocument = function PDFDocumentClosure() {
|
|||
}
|
||||
|
||||
return (0, _util.shadow)(this, 'documentInfo', docInfo);
|
||||
},
|
||||
}
|
||||
|
||||
get fingerprint() {
|
||||
var xref = this.xref,
|
||||
hash,
|
||||
fileID = '';
|
||||
var idArray = xref.trailer.get('ID');
|
||||
let hash;
|
||||
const idArray = this.xref.trailer.get('ID');
|
||||
|
||||
if (Array.isArray(idArray) && idArray[0] && (0, _util.isString)(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
|
||||
hash = (0, _util.stringToBytes)(idArray[0]);
|
||||
|
@ -6949,13 +6945,15 @@ var PDFDocument = function PDFDocumentClosure() {
|
|||
hash = (0, _crypto.calculateMD5)(this.stream.bytes.subarray(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
|
||||
}
|
||||
|
||||
for (var i = 0, n = hash.length; i < n; i++) {
|
||||
var hex = hash[i].toString(16);
|
||||
fileID += hex.length === 1 ? '0' + hex : hex;
|
||||
let fingerprint = '';
|
||||
|
||||
for (const hashPart of hash) {
|
||||
const hex = hashPart.toString(16);
|
||||
fingerprint += hex.length === 1 ? '0' + hex : hex;
|
||||
}
|
||||
|
||||
return (0, _util.shadow)(this, 'fingerprint', fileID);
|
||||
},
|
||||
return (0, _util.shadow)(this, 'fingerprint', fingerprint);
|
||||
}
|
||||
|
||||
_getLinearizationPage(pageIndex) {
|
||||
const {
|
||||
|
@ -6978,7 +6976,7 @@ var PDFDocument = function PDFDocumentClosure() {
|
|||
(0, _util.info)(reason);
|
||||
return catalog.getPageDict(pageIndex);
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
getPage(pageIndex) {
|
||||
if (this._pagePromises[pageIndex] !== undefined) {
|
||||
|
@ -7002,14 +7000,23 @@ var PDFDocument = function PDFDocumentClosure() {
|
|||
pdfFunctionFactory: this.pdfFunctionFactory
|
||||
});
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
cleanup: function PDFDocument_cleanup() {
|
||||
checkFirstPage() {
|
||||
return this.getPage(0).catch(reason => {
|
||||
if (reason instanceof _util.XRefEntryException) {
|
||||
this._pagePromises.length = 0;
|
||||
this.cleanup();
|
||||
throw new _util.XRefParseException();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
return this.catalog.cleanup();
|
||||
}
|
||||
};
|
||||
return PDFDocument;
|
||||
}();
|
||||
|
||||
}
|
||||
|
||||
exports.PDFDocument = PDFDocument;
|
||||
|
||||
|
@ -8503,7 +8510,7 @@ var XRef = function XRefClosure() {
|
|||
if (xrefEntry.uncompressed) {
|
||||
xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
|
||||
} else {
|
||||
xrefEntry = this.fetchCompressed(xrefEntry, suppressEncryption);
|
||||
xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
|
||||
}
|
||||
|
||||
if ((0, _primitives.isDict)(xrefEntry)) {
|
||||
|
@ -8514,12 +8521,13 @@ var XRef = function XRefClosure() {
|
|||
|
||||
return xrefEntry;
|
||||
},
|
||||
fetchUncompressed: function XRef_fetchUncompressed(ref, xrefEntry, suppressEncryption) {
|
||||
|
||||
fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
|
||||
var gen = ref.gen;
|
||||
var num = ref.num;
|
||||
|
||||
if (xrefEntry.gen !== gen) {
|
||||
throw new _util.FormatError('inconsistent generation in XRef');
|
||||
throw new _util.XRefEntryException(`Inconsistent generation in XRef: ${ref}`);
|
||||
}
|
||||
|
||||
var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
|
||||
|
@ -8537,7 +8545,7 @@ var XRef = function XRefClosure() {
|
|||
}
|
||||
|
||||
if (obj1 !== num || obj2 !== gen || !(0, _primitives.isCmd)(obj3)) {
|
||||
throw new _util.FormatError('bad XRef entry');
|
||||
throw new _util.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
|
||||
}
|
||||
|
||||
if (obj3.cmd !== 'obj') {
|
||||
|
@ -8549,7 +8557,7 @@ var XRef = function XRefClosure() {
|
|||
}
|
||||
}
|
||||
|
||||
throw new _util.FormatError('bad XRef entry');
|
||||
throw new _util.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
|
||||
}
|
||||
|
||||
if (this.encrypt && !suppressEncryption) {
|
||||
|
@ -8564,7 +8572,8 @@ var XRef = function XRefClosure() {
|
|||
|
||||
return xrefEntry;
|
||||
},
|
||||
fetchCompressed: function XRef_fetchCompressed(xrefEntry, suppressEncryption) {
|
||||
|
||||
fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
|
||||
var tableOffset = xrefEntry.offset;
|
||||
var stream = this.fetch(new _primitives.Ref(tableOffset, 0));
|
||||
|
||||
|
@ -8619,7 +8628,7 @@ var XRef = function XRefClosure() {
|
|||
xrefEntry = entries[xrefEntry.gen];
|
||||
|
||||
if (xrefEntry === undefined) {
|
||||
throw new _util.FormatError('bad XRef entry for compressed object');
|
||||
throw new _util.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
|
||||
}
|
||||
|
||||
return xrefEntry;
|
||||
|
@ -9240,13 +9249,11 @@ var Ref = function RefClosure() {
|
|||
|
||||
Ref.prototype = {
|
||||
toString: function Ref_toString() {
|
||||
var str = this.num + 'R';
|
||||
|
||||
if (this.gen !== 0) {
|
||||
str += this.gen;
|
||||
return `${this.num}R${this.gen}`;
|
||||
}
|
||||
|
||||
return str;
|
||||
return `${this.num}R`;
|
||||
}
|
||||
};
|
||||
return Ref;
|
||||
|
@ -21977,13 +21984,17 @@ class AnnotationBorderStyle {
|
|||
}
|
||||
|
||||
setWidth(width) {
|
||||
if ((0, _primitives.isName)(width)) {
|
||||
width = parseFloat(width.name);
|
||||
}
|
||||
|
||||
if (Number.isInteger(width)) {
|
||||
this.width = width;
|
||||
}
|
||||
}
|
||||
|
||||
setStyle(style) {
|
||||
if (!style) {
|
||||
if (!(0, _primitives.isName)(style)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,8 @@
|
|||
background-color: rgb(0, 100, 0);
|
||||
}
|
||||
|
||||
.textLayer ::-moz-selection { background: rgb(0,0,255); }
|
||||
|
||||
.textLayer ::selection { background: rgb(0,0,255); }
|
||||
|
||||
.textLayer .endOfContent {
|
||||
|
@ -1675,6 +1677,7 @@ html[dir='rtl'] .outlineItemToggler::before {
|
|||
/* TODO: file FF bug to support ::-moz-selection:window-inactive
|
||||
so we can override the opaque grey background when the window is inactive;
|
||||
see https://bugzilla.mozilla.org/show_bug.cgi?id=706209 */
|
||||
::-moz-selection { background: rgba(0,0,255,0.3); }
|
||||
::selection { background: rgba(0,0,255,0.3); }
|
||||
|
||||
#errorWrapper {
|
||||
|
|
|
@ -20,7 +20,7 @@ origin:
|
|||
|
||||
# Human-readable identifier for this version/release
|
||||
# Generally "version NNN", "tag SSS", "bookmark SSS"
|
||||
release: version 2.1.132
|
||||
release: version 2.1.145
|
||||
|
||||
# The package's license, where possible using the mnemonic from
|
||||
# https://spdx.org/licenses/
|
||||
|
|
|
@ -22,13 +22,13 @@
|
|||
#include "nsMargin.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsStringFwd.h"
|
||||
#include "SVGAttrValueWrapper.h"
|
||||
#include "nsTArrayForwardDeclare.h"
|
||||
#include "nsAtom.h"
|
||||
#include "mozilla/AtomArray.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/AtomArray.h"
|
||||
#include "mozilla/EnumTypeTraits.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/SVGAttrValueWrapper.h"
|
||||
|
||||
class nsIDocument;
|
||||
class nsIURI;
|
||||
|
|
|
@ -108,7 +108,6 @@
|
|||
#include "nsGlobalWindow.h"
|
||||
#include "GLContext.h"
|
||||
#include "GLContextProvider.h"
|
||||
#include "SVGContentUtils.h"
|
||||
#include "nsIScreenManager.h"
|
||||
#include "nsFilterInstance.h"
|
||||
#include "nsSVGLength2.h"
|
||||
|
@ -117,11 +116,12 @@
|
|||
#include "Units.h"
|
||||
#include "CanvasUtils.h"
|
||||
#include "mozilla/CycleCollectedJSRuntime.h"
|
||||
#include "mozilla/ServoCSSParser.h"
|
||||
#include "mozilla/ServoStyleSet.h"
|
||||
#include "mozilla/SVGContentUtils.h"
|
||||
#include "mozilla/layers/CanvasClient.h"
|
||||
#include "mozilla/layers/WebRenderUserData.h"
|
||||
#include "mozilla/layers/WebRenderCanvasRenderer.h"
|
||||
#include "mozilla/ServoCSSParser.h"
|
||||
|
||||
#undef free // apparently defined by some windows header, clashing with a
|
||||
// free() method in SkTypes.h
|
||||
|
|
|
@ -329,7 +329,7 @@ void SMILAnimationController::DoSample(bool aSkipUnchangedContainers) {
|
|||
// (i) Here we sample the timed elements (fetched from the
|
||||
// SVGAnimationElements) which determine from the active time if the
|
||||
// element is active and what its simple time etc. is. This information is
|
||||
// then passed to its time client (nsSMILAnimationFunction).
|
||||
// then passed to its time client (SMILAnimationFunction).
|
||||
//
|
||||
// (ii) During the same loop we also build up a table that contains one
|
||||
// compositor for each animated attribute and which maps animated elements to
|
||||
|
@ -570,7 +570,7 @@ void SMILAnimationController::DoMilestoneSamples() {
|
|||
// Something's wrong/missing about animation's target; skip this animation
|
||||
return;
|
||||
|
||||
nsSMILAnimationFunction& func = aElement->AnimationFunction();
|
||||
SMILAnimationFunction& func = aElement->AnimationFunction();
|
||||
|
||||
// Only add active animation functions. If there are no active animations
|
||||
// targeting an attribute, no compositor will be created and any previously
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsSMILAnimationFunction.h"
|
||||
#include "SMILAnimationFunction.h"
|
||||
|
||||
#include "mozilla/dom/SVGAnimationElement.h"
|
||||
#include "mozilla/Move.h"
|
||||
|
@ -26,16 +26,18 @@
|
|||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Static members
|
||||
|
||||
nsAttrValue::EnumTable nsSMILAnimationFunction::sAccumulateTable[] = {
|
||||
nsAttrValue::EnumTable SMILAnimationFunction::sAccumulateTable[] = {
|
||||
{"none", false}, {"sum", true}, {nullptr, 0}};
|
||||
|
||||
nsAttrValue::EnumTable nsSMILAnimationFunction::sAdditiveTable[] = {
|
||||
nsAttrValue::EnumTable SMILAnimationFunction::sAdditiveTable[] = {
|
||||
{"replace", false}, {"sum", true}, {nullptr, 0}};
|
||||
|
||||
nsAttrValue::EnumTable nsSMILAnimationFunction::sCalcModeTable[] = {
|
||||
nsAttrValue::EnumTable SMILAnimationFunction::sCalcModeTable[] = {
|
||||
{"linear", CALC_LINEAR},
|
||||
{"discrete", CALC_DISCRETE},
|
||||
{"paced", CALC_PACED},
|
||||
|
@ -49,7 +51,7 @@ nsAttrValue::EnumTable nsSMILAnimationFunction::sCalcModeTable[] = {
|
|||
//----------------------------------------------------------------------
|
||||
// Constructors etc.
|
||||
|
||||
nsSMILAnimationFunction::nsSMILAnimationFunction()
|
||||
SMILAnimationFunction::SMILAnimationFunction()
|
||||
: mSampleTime(-1),
|
||||
mRepeatIteration(0),
|
||||
mBeginTime(INT64_MIN),
|
||||
|
@ -63,13 +65,12 @@ nsSMILAnimationFunction::nsSMILAnimationFunction()
|
|||
mPrevSampleWasSingleValueAnimation(false),
|
||||
mWasSkippedInPrevSample(false) {}
|
||||
|
||||
void nsSMILAnimationFunction::SetAnimationElement(
|
||||
void SMILAnimationFunction::SetAnimationElement(
|
||||
SVGAnimationElement* aAnimationElement) {
|
||||
mAnimationElement = aAnimationElement;
|
||||
}
|
||||
|
||||
bool nsSMILAnimationFunction::SetAttr(nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
bool SMILAnimationFunction::SetAttr(nsAtom* aAttribute, const nsAString& aValue,
|
||||
nsAttrValue& aResult,
|
||||
nsresult* aParseResult) {
|
||||
bool foundMatch = true;
|
||||
|
@ -106,7 +107,7 @@ bool nsSMILAnimationFunction::SetAttr(nsAtom* aAttribute,
|
|||
return foundMatch;
|
||||
}
|
||||
|
||||
bool nsSMILAnimationFunction::UnsetAttr(nsAtom* aAttribute) {
|
||||
bool SMILAnimationFunction::UnsetAttr(nsAtom* aAttribute) {
|
||||
bool foundMatch = true;
|
||||
|
||||
if (aAttribute == nsGkAtoms::by || aAttribute == nsGkAtoms::from ||
|
||||
|
@ -129,7 +130,7 @@ bool nsSMILAnimationFunction::UnsetAttr(nsAtom* aAttribute) {
|
|||
return foundMatch;
|
||||
}
|
||||
|
||||
void nsSMILAnimationFunction::SampleAt(nsSMILTime aSampleTime,
|
||||
void SMILAnimationFunction::SampleAt(nsSMILTime aSampleTime,
|
||||
const nsSMILTimeValue& aSimpleDuration,
|
||||
uint32_t aRepeatIteration) {
|
||||
// * Update mHasChanged ("Might this sample be different from prev one?")
|
||||
|
@ -152,7 +153,7 @@ void nsSMILAnimationFunction::SampleAt(nsSMILTime aSampleTime,
|
|||
mLastValue = false;
|
||||
}
|
||||
|
||||
void nsSMILAnimationFunction::SampleLastValue(uint32_t aRepeatIteration) {
|
||||
void SMILAnimationFunction::SampleLastValue(uint32_t aRepeatIteration) {
|
||||
if (mHasChanged || !mLastValue || mRepeatIteration != aRepeatIteration) {
|
||||
mHasChanged = true;
|
||||
}
|
||||
|
@ -161,20 +162,20 @@ void nsSMILAnimationFunction::SampleLastValue(uint32_t aRepeatIteration) {
|
|||
mLastValue = true;
|
||||
}
|
||||
|
||||
void nsSMILAnimationFunction::Activate(nsSMILTime aBeginTime) {
|
||||
void SMILAnimationFunction::Activate(nsSMILTime aBeginTime) {
|
||||
mBeginTime = aBeginTime;
|
||||
mIsActive = true;
|
||||
mIsFrozen = false;
|
||||
mHasChanged = true;
|
||||
}
|
||||
|
||||
void nsSMILAnimationFunction::Inactivate(bool aIsFrozen) {
|
||||
void SMILAnimationFunction::Inactivate(bool aIsFrozen) {
|
||||
mIsActive = false;
|
||||
mIsFrozen = aIsFrozen;
|
||||
mHasChanged = true;
|
||||
}
|
||||
|
||||
void nsSMILAnimationFunction::ComposeResult(const nsISMILAttr& aSMILAttr,
|
||||
void SMILAnimationFunction::ComposeResult(const nsISMILAttr& aSMILAttr,
|
||||
nsSMILValue& aResult) {
|
||||
mHasChanged = false;
|
||||
mPrevSampleWasSingleValueAnimation = false;
|
||||
|
@ -237,8 +238,8 @@ void nsSMILAnimationFunction::ComposeResult(const nsISMILAttr& aSMILAttr,
|
|||
}
|
||||
}
|
||||
|
||||
int8_t nsSMILAnimationFunction::CompareTo(
|
||||
const nsSMILAnimationFunction* aOther) const {
|
||||
int8_t SMILAnimationFunction::CompareTo(
|
||||
const SMILAnimationFunction* aOther) const {
|
||||
NS_ENSURE_TRUE(aOther, 0);
|
||||
|
||||
NS_ASSERTION(aOther != this, "Trying to compare to self");
|
||||
|
@ -272,7 +273,7 @@ int8_t nsSMILAnimationFunction::CompareTo(
|
|||
: 1;
|
||||
}
|
||||
|
||||
bool nsSMILAnimationFunction::WillReplace() const {
|
||||
bool SMILAnimationFunction::WillReplace() const {
|
||||
/*
|
||||
* In IsAdditive() we don't consider to-animation to be additive as it is
|
||||
* a special case that is dealt with differently in the compositing method.
|
||||
|
@ -282,11 +283,11 @@ bool nsSMILAnimationFunction::WillReplace() const {
|
|||
return !mErrorFlags && !(IsAdditive() || IsToAnimation());
|
||||
}
|
||||
|
||||
bool nsSMILAnimationFunction::HasChanged() const {
|
||||
bool SMILAnimationFunction::HasChanged() const {
|
||||
return mHasChanged || mValueNeedsReparsingEverySample;
|
||||
}
|
||||
|
||||
bool nsSMILAnimationFunction::UpdateCachedTarget(
|
||||
bool SMILAnimationFunction::UpdateCachedTarget(
|
||||
const nsSMILTargetIdentifier& aNewTarget) {
|
||||
if (!mLastTarget.Equals(aNewTarget)) {
|
||||
mLastTarget = aNewTarget;
|
||||
|
@ -298,7 +299,7 @@ bool nsSMILAnimationFunction::UpdateCachedTarget(
|
|||
//----------------------------------------------------------------------
|
||||
// Implementation helpers
|
||||
|
||||
nsresult nsSMILAnimationFunction::InterpolateResult(
|
||||
nsresult SMILAnimationFunction::InterpolateResult(
|
||||
const nsSMILValueArray& aValues, nsSMILValue& aResult,
|
||||
nsSMILValue& aBaseValue) {
|
||||
// Sanity check animation values
|
||||
|
@ -452,7 +453,7 @@ nsresult nsSMILAnimationFunction::InterpolateResult(
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsSMILAnimationFunction::AccumulateResult(
|
||||
nsresult SMILAnimationFunction::AccumulateResult(
|
||||
const nsSMILValueArray& aValues, nsSMILValue& aResult) {
|
||||
if (!IsToAnimation() && GetAccumulate() && mRepeatIteration) {
|
||||
const nsSMILValue& lastValue = aValues[aValues.Length() - 1];
|
||||
|
@ -475,7 +476,7 @@ nsresult nsSMILAnimationFunction::AccumulateResult(
|
|||
* Returns NS_OK, or NS_ERROR_FAILURE if our values don't support distance
|
||||
* computation.
|
||||
*/
|
||||
nsresult nsSMILAnimationFunction::ComputePacedPosition(
|
||||
nsresult SMILAnimationFunction::ComputePacedPosition(
|
||||
const nsSMILValueArray& aValues, double aSimpleProgress,
|
||||
double& aIntervalProgress, const nsSMILValue*& aFrom,
|
||||
const nsSMILValue*& aTo) {
|
||||
|
@ -568,7 +569,7 @@ nsresult nsSMILAnimationFunction::ComputePacedPosition(
|
|||
* Returns the total distance, or returns COMPUTE_DISTANCE_ERROR if
|
||||
* our values don't support distance computation.
|
||||
*/
|
||||
double nsSMILAnimationFunction::ComputePacedTotalDistance(
|
||||
double SMILAnimationFunction::ComputePacedTotalDistance(
|
||||
const nsSMILValueArray& aValues) const {
|
||||
NS_ASSERTION(GetCalcMode() == CALC_PACED,
|
||||
"Calling paced-specific function, but not in paced mode");
|
||||
|
@ -592,7 +593,7 @@ double nsSMILAnimationFunction::ComputePacedTotalDistance(
|
|||
return totalDistance;
|
||||
}
|
||||
|
||||
double nsSMILAnimationFunction::ScaleSimpleProgress(double aProgress,
|
||||
double SMILAnimationFunction::ScaleSimpleProgress(double aProgress,
|
||||
nsSMILCalcMode aCalcMode) {
|
||||
if (!HasAttr(nsGkAtoms::keyTimes)) return aProgress;
|
||||
|
||||
|
@ -628,7 +629,7 @@ double nsSMILAnimationFunction::ScaleSimpleProgress(double aProgress,
|
|||
double(numTimes - 1);
|
||||
}
|
||||
|
||||
double nsSMILAnimationFunction::ScaleIntervalProgress(double aProgress,
|
||||
double SMILAnimationFunction::ScaleIntervalProgress(double aProgress,
|
||||
uint32_t aIntervalIndex) {
|
||||
if (GetCalcMode() != CALC_SPLINE) return aProgress;
|
||||
|
||||
|
@ -640,15 +641,15 @@ double nsSMILAnimationFunction::ScaleIntervalProgress(double aProgress,
|
|||
return spline.GetSplineValue(aProgress);
|
||||
}
|
||||
|
||||
bool nsSMILAnimationFunction::HasAttr(nsAtom* aAttName) const {
|
||||
bool SMILAnimationFunction::HasAttr(nsAtom* aAttName) const {
|
||||
return mAnimationElement->HasAttr(aAttName);
|
||||
}
|
||||
|
||||
const nsAttrValue* nsSMILAnimationFunction::GetAttr(nsAtom* aAttName) const {
|
||||
const nsAttrValue* SMILAnimationFunction::GetAttr(nsAtom* aAttName) const {
|
||||
return mAnimationElement->GetParsedAttr(aAttName);
|
||||
}
|
||||
|
||||
bool nsSMILAnimationFunction::GetAttr(nsAtom* aAttName,
|
||||
bool SMILAnimationFunction::GetAttr(nsAtom* aAttName,
|
||||
nsAString& aResult) const {
|
||||
return mAnimationElement->GetAttr(aAttName, aResult);
|
||||
}
|
||||
|
@ -669,7 +670,7 @@ bool nsSMILAnimationFunction::GetAttr(nsAtom* aAttName,
|
|||
*
|
||||
* Returns false if a parse error occurred, otherwise returns true.
|
||||
*/
|
||||
bool nsSMILAnimationFunction::ParseAttr(nsAtom* aAttName,
|
||||
bool SMILAnimationFunction::ParseAttr(nsAtom* aAttName,
|
||||
const nsISMILAttr& aSMILAttr,
|
||||
nsSMILValue& aResult,
|
||||
bool& aPreventCachingOfSandwich) const {
|
||||
|
@ -701,7 +702,7 @@ bool nsSMILAnimationFunction::ParseAttr(nsAtom* aAttName,
|
|||
* This helper method applies these rules to fill in the values list and to set
|
||||
* some internal state.
|
||||
*/
|
||||
nsresult nsSMILAnimationFunction::GetValues(const nsISMILAttr& aSMILAttr,
|
||||
nsresult SMILAnimationFunction::GetValues(const nsISMILAttr& aSMILAttr,
|
||||
nsSMILValueArray& aResult) {
|
||||
if (!mAnimationElement) return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -737,26 +738,26 @@ nsresult nsSMILAnimationFunction::GetValues(const nsISMILAttr& aSMILAttr,
|
|||
mValueNeedsReparsingEverySample = true;
|
||||
}
|
||||
|
||||
if (!parseOk || !result.SetCapacity(2, mozilla::fallible)) {
|
||||
if (!parseOk || !result.SetCapacity(2, fallible)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// AppendElement() below must succeed, because SetCapacity() succeeded.
|
||||
if (!to.IsNull()) {
|
||||
if (!from.IsNull()) {
|
||||
MOZ_ALWAYS_TRUE(result.AppendElement(from, mozilla::fallible));
|
||||
MOZ_ALWAYS_TRUE(result.AppendElement(to, mozilla::fallible));
|
||||
MOZ_ALWAYS_TRUE(result.AppendElement(from, fallible));
|
||||
MOZ_ALWAYS_TRUE(result.AppendElement(to, fallible));
|
||||
} else {
|
||||
MOZ_ALWAYS_TRUE(result.AppendElement(to, mozilla::fallible));
|
||||
MOZ_ALWAYS_TRUE(result.AppendElement(to, fallible));
|
||||
}
|
||||
} else if (!by.IsNull()) {
|
||||
nsSMILValue effectiveFrom(by.mType);
|
||||
if (!from.IsNull()) effectiveFrom = from;
|
||||
// Set values to 'from; from + by'
|
||||
MOZ_ALWAYS_TRUE(result.AppendElement(effectiveFrom, mozilla::fallible));
|
||||
MOZ_ALWAYS_TRUE(result.AppendElement(effectiveFrom, fallible));
|
||||
nsSMILValue effectiveTo(effectiveFrom);
|
||||
if (!effectiveTo.IsNull() && NS_SUCCEEDED(effectiveTo.Add(by))) {
|
||||
MOZ_ALWAYS_TRUE(result.AppendElement(effectiveTo, mozilla::fallible));
|
||||
MOZ_ALWAYS_TRUE(result.AppendElement(effectiveTo, fallible));
|
||||
} else {
|
||||
// Using by-animation with non-additive type or bad base-value
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -772,8 +773,7 @@ nsresult nsSMILAnimationFunction::GetValues(const nsISMILAttr& aSMILAttr,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsSMILAnimationFunction::CheckValueListDependentAttrs(
|
||||
uint32_t aNumValues) {
|
||||
void SMILAnimationFunction::CheckValueListDependentAttrs(uint32_t aNumValues) {
|
||||
CheckKeyTimes(aNumValues);
|
||||
CheckKeySplines(aNumValues);
|
||||
}
|
||||
|
@ -783,7 +783,7 @@ void nsSMILAnimationFunction::CheckValueListDependentAttrs(
|
|||
* which depend on other attributes and therefore needs to be updated as
|
||||
* dependent attributes are set.
|
||||
*/
|
||||
void nsSMILAnimationFunction::CheckKeyTimes(uint32_t aNumValues) {
|
||||
void SMILAnimationFunction::CheckKeyTimes(uint32_t aNumValues) {
|
||||
if (!HasAttr(nsGkAtoms::keyTimes)) return;
|
||||
|
||||
nsSMILCalcMode calcMode = GetCalcMode();
|
||||
|
@ -825,7 +825,7 @@ void nsSMILAnimationFunction::CheckKeyTimes(uint32_t aNumValues) {
|
|||
SetKeyTimesErrorFlag(false);
|
||||
}
|
||||
|
||||
void nsSMILAnimationFunction::CheckKeySplines(uint32_t aNumValues) {
|
||||
void SMILAnimationFunction::CheckKeySplines(uint32_t aNumValues) {
|
||||
// attribute is ignored if calc mode is not spline
|
||||
if (GetCalcMode() != CALC_SPLINE) {
|
||||
SetKeySplinesErrorFlag(false);
|
||||
|
@ -861,7 +861,7 @@ void nsSMILAnimationFunction::CheckKeySplines(uint32_t aNumValues) {
|
|||
SetKeySplinesErrorFlag(false);
|
||||
}
|
||||
|
||||
bool nsSMILAnimationFunction::IsValueFixedForSimpleDuration() const {
|
||||
bool SMILAnimationFunction::IsValueFixedForSimpleDuration() const {
|
||||
return mSimpleDuration.IsIndefinite() ||
|
||||
(!mHasChanged && mPrevSampleWasSingleValueAnimation);
|
||||
}
|
||||
|
@ -869,21 +869,21 @@ bool nsSMILAnimationFunction::IsValueFixedForSimpleDuration() const {
|
|||
//----------------------------------------------------------------------
|
||||
// Property getters
|
||||
|
||||
bool nsSMILAnimationFunction::GetAccumulate() const {
|
||||
bool SMILAnimationFunction::GetAccumulate() const {
|
||||
const nsAttrValue* value = GetAttr(nsGkAtoms::accumulate);
|
||||
if (!value) return false;
|
||||
|
||||
return value->GetEnumValue();
|
||||
}
|
||||
|
||||
bool nsSMILAnimationFunction::GetAdditive() const {
|
||||
bool SMILAnimationFunction::GetAdditive() const {
|
||||
const nsAttrValue* value = GetAttr(nsGkAtoms::additive);
|
||||
if (!value) return false;
|
||||
|
||||
return value->GetEnumValue();
|
||||
}
|
||||
|
||||
nsSMILAnimationFunction::nsSMILCalcMode nsSMILAnimationFunction::GetCalcMode()
|
||||
SMILAnimationFunction::nsSMILCalcMode SMILAnimationFunction::GetCalcMode()
|
||||
const {
|
||||
const nsAttrValue* value = GetAttr(nsGkAtoms::calcMode);
|
||||
if (!value) return CALC_LINEAR;
|
||||
|
@ -894,7 +894,7 @@ nsSMILAnimationFunction::nsSMILCalcMode nsSMILAnimationFunction::GetCalcMode()
|
|||
//----------------------------------------------------------------------
|
||||
// Property setters / un-setters:
|
||||
|
||||
nsresult nsSMILAnimationFunction::SetAccumulate(const nsAString& aAccumulate,
|
||||
nsresult SMILAnimationFunction::SetAccumulate(const nsAString& aAccumulate,
|
||||
nsAttrValue& aResult) {
|
||||
mHasChanged = true;
|
||||
bool parseResult =
|
||||
|
@ -903,12 +903,12 @@ nsresult nsSMILAnimationFunction::SetAccumulate(const nsAString& aAccumulate,
|
|||
return parseResult ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
void nsSMILAnimationFunction::UnsetAccumulate() {
|
||||
void SMILAnimationFunction::UnsetAccumulate() {
|
||||
SetAccumulateErrorFlag(false);
|
||||
mHasChanged = true;
|
||||
}
|
||||
|
||||
nsresult nsSMILAnimationFunction::SetAdditive(const nsAString& aAdditive,
|
||||
nsresult SMILAnimationFunction::SetAdditive(const nsAString& aAdditive,
|
||||
nsAttrValue& aResult) {
|
||||
mHasChanged = true;
|
||||
bool parseResult = aResult.ParseEnumValue(aAdditive, sAdditiveTable, true);
|
||||
|
@ -916,12 +916,12 @@ nsresult nsSMILAnimationFunction::SetAdditive(const nsAString& aAdditive,
|
|||
return parseResult ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
void nsSMILAnimationFunction::UnsetAdditive() {
|
||||
void SMILAnimationFunction::UnsetAdditive() {
|
||||
SetAdditiveErrorFlag(false);
|
||||
mHasChanged = true;
|
||||
}
|
||||
|
||||
nsresult nsSMILAnimationFunction::SetCalcMode(const nsAString& aCalcMode,
|
||||
nsresult SMILAnimationFunction::SetCalcMode(const nsAString& aCalcMode,
|
||||
nsAttrValue& aResult) {
|
||||
mHasChanged = true;
|
||||
bool parseResult = aResult.ParseEnumValue(aCalcMode, sCalcModeTable, true);
|
||||
|
@ -929,12 +929,12 @@ nsresult nsSMILAnimationFunction::SetCalcMode(const nsAString& aCalcMode,
|
|||
return parseResult ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
void nsSMILAnimationFunction::UnsetCalcMode() {
|
||||
void SMILAnimationFunction::UnsetCalcMode() {
|
||||
SetCalcModeErrorFlag(false);
|
||||
mHasChanged = true;
|
||||
}
|
||||
|
||||
nsresult nsSMILAnimationFunction::SetKeySplines(const nsAString& aKeySplines,
|
||||
nsresult SMILAnimationFunction::SetKeySplines(const nsAString& aKeySplines,
|
||||
nsAttrValue& aResult) {
|
||||
mKeySplines.Clear();
|
||||
aResult.SetTo(aKeySplines);
|
||||
|
@ -949,13 +949,13 @@ nsresult nsSMILAnimationFunction::SetKeySplines(const nsAString& aKeySplines,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsSMILAnimationFunction::UnsetKeySplines() {
|
||||
void SMILAnimationFunction::UnsetKeySplines() {
|
||||
mKeySplines.Clear();
|
||||
SetKeySplinesErrorFlag(false);
|
||||
mHasChanged = true;
|
||||
}
|
||||
|
||||
nsresult nsSMILAnimationFunction::SetKeyTimes(const nsAString& aKeyTimes,
|
||||
nsresult SMILAnimationFunction::SetKeyTimes(const nsAString& aKeyTimes,
|
||||
nsAttrValue& aResult) {
|
||||
mKeyTimes.Clear();
|
||||
aResult.SetTo(aKeyTimes);
|
||||
|
@ -971,8 +971,10 @@ nsresult nsSMILAnimationFunction::SetKeyTimes(const nsAString& aKeyTimes,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsSMILAnimationFunction::UnsetKeyTimes() {
|
||||
void SMILAnimationFunction::UnsetKeyTimes() {
|
||||
mKeyTimes.Clear();
|
||||
SetKeyTimesErrorFlag(false);
|
||||
mHasChanged = true;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
|
@ -22,10 +22,9 @@ namespace mozilla {
|
|||
namespace dom {
|
||||
class SVGAnimationElement;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSMILAnimationFunction
|
||||
// SMILAnimationFunction
|
||||
//
|
||||
// The animation function calculates animation values. It it is provided with
|
||||
// time parameters (sample time, repeat iteration etc.) and it uses this to
|
||||
|
@ -36,9 +35,9 @@ class SVGAnimationElement;
|
|||
// element (e.g. from, by, to, values, calcMode, additive, accumulate, keyTimes,
|
||||
// keySplines)
|
||||
//
|
||||
class nsSMILAnimationFunction {
|
||||
class SMILAnimationFunction {
|
||||
public:
|
||||
nsSMILAnimationFunction();
|
||||
SMILAnimationFunction();
|
||||
|
||||
/*
|
||||
* Sets the owning animation element which this class uses to query attribute
|
||||
|
@ -138,7 +137,7 @@ class nsSMILAnimationFunction {
|
|||
*
|
||||
* This method should never return any other value, including 0.
|
||||
*/
|
||||
int8_t CompareTo(const nsSMILAnimationFunction* aOther) const;
|
||||
int8_t CompareTo(const SMILAnimationFunction* aOther) const;
|
||||
|
||||
/*
|
||||
* The following methods are provided so that the compositor can optimize its
|
||||
|
@ -244,15 +243,15 @@ class nsSMILAnimationFunction {
|
|||
return mValueNeedsReparsingEverySample;
|
||||
}
|
||||
|
||||
// Comparator utility class, used for sorting nsSMILAnimationFunctions
|
||||
// Comparator utility class, used for sorting SMILAnimationFunctions
|
||||
class Comparator {
|
||||
public:
|
||||
bool Equals(const nsSMILAnimationFunction* aElem1,
|
||||
const nsSMILAnimationFunction* aElem2) const {
|
||||
bool Equals(const SMILAnimationFunction* aElem1,
|
||||
const SMILAnimationFunction* aElem2) const {
|
||||
return (aElem1->CompareTo(aElem2) == 0);
|
||||
}
|
||||
bool LessThan(const nsSMILAnimationFunction* aElem1,
|
||||
const nsSMILAnimationFunction* aElem2) const {
|
||||
bool LessThan(const SMILAnimationFunction* aElem1,
|
||||
const SMILAnimationFunction* aElem2) const {
|
||||
return (aElem1->CompareTo(aElem2) < 0);
|
||||
}
|
||||
};
|
||||
|
@ -269,7 +268,7 @@ class nsSMILAnimationFunction {
|
|||
CALC_SPLINE
|
||||
};
|
||||
|
||||
// Used for sorting nsSMILAnimationFunctions
|
||||
// Used for sorting SMILAnimationFunctions
|
||||
nsSMILTime GetBeginTime() const { return mBeginTime; }
|
||||
|
||||
// Property getters
|
||||
|
@ -417,7 +416,7 @@ class nsSMILAnimationFunction {
|
|||
|
||||
// The owning animation element. This is used for sorting based on document
|
||||
// position and for fetching attribute values stored in the element.
|
||||
// Raw pointer is OK here, because this nsSMILAnimationFunction can't outlive
|
||||
// Raw pointer is OK here, because this SMILAnimationFunction can't outlive
|
||||
// its owning animation element.
|
||||
mozilla::dom::SVGAnimationElement* mAnimationElement;
|
||||
|
||||
|
@ -441,4 +440,6 @@ class nsSMILAnimationFunction {
|
|||
bool mWasSkippedInPrevSample : 1;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // NS_SMILANIMATIONFUNCTION_H_
|
|
@ -4,9 +4,11 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsSMILSetAnimationFunction.h"
|
||||
#include "SMILSetAnimationFunction.h"
|
||||
|
||||
inline bool nsSMILSetAnimationFunction::IsDisallowedAttribute(
|
||||
namespace mozilla {
|
||||
|
||||
inline bool SMILSetAnimationFunction::IsDisallowedAttribute(
|
||||
const nsAtom* aAttribute) const {
|
||||
//
|
||||
// A <set> element is similar to <animate> but lacks:
|
||||
|
@ -25,7 +27,7 @@ inline bool nsSMILSetAnimationFunction::IsDisallowedAttribute(
|
|||
return false;
|
||||
}
|
||||
|
||||
bool nsSMILSetAnimationFunction::SetAttr(nsAtom* aAttribute,
|
||||
bool SMILSetAnimationFunction::SetAttr(nsAtom* aAttribute,
|
||||
const nsAString& aValue,
|
||||
nsAttrValue& aResult,
|
||||
nsresult* aParseResult) {
|
||||
|
@ -45,35 +47,37 @@ bool nsSMILSetAnimationFunction::SetAttr(nsAtom* aAttribute,
|
|||
return true;
|
||||
}
|
||||
|
||||
return nsSMILAnimationFunction::SetAttr(aAttribute, aValue, aResult,
|
||||
return SMILAnimationFunction::SetAttr(aAttribute, aValue, aResult,
|
||||
aParseResult);
|
||||
}
|
||||
|
||||
bool nsSMILSetAnimationFunction::UnsetAttr(nsAtom* aAttribute) {
|
||||
bool SMILSetAnimationFunction::UnsetAttr(nsAtom* aAttribute) {
|
||||
if (IsDisallowedAttribute(aAttribute)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return nsSMILAnimationFunction::UnsetAttr(aAttribute);
|
||||
return SMILAnimationFunction::UnsetAttr(aAttribute);
|
||||
}
|
||||
|
||||
bool nsSMILSetAnimationFunction::HasAttr(nsAtom* aAttName) const {
|
||||
bool SMILSetAnimationFunction::HasAttr(nsAtom* aAttName) const {
|
||||
if (IsDisallowedAttribute(aAttName)) return false;
|
||||
|
||||
return nsSMILAnimationFunction::HasAttr(aAttName);
|
||||
return SMILAnimationFunction::HasAttr(aAttName);
|
||||
}
|
||||
|
||||
const nsAttrValue* nsSMILSetAnimationFunction::GetAttr(nsAtom* aAttName) const {
|
||||
const nsAttrValue* SMILSetAnimationFunction::GetAttr(nsAtom* aAttName) const {
|
||||
if (IsDisallowedAttribute(aAttName)) return nullptr;
|
||||
|
||||
return nsSMILAnimationFunction::GetAttr(aAttName);
|
||||
return SMILAnimationFunction::GetAttr(aAttName);
|
||||
}
|
||||
|
||||
bool nsSMILSetAnimationFunction::GetAttr(nsAtom* aAttName,
|
||||
bool SMILSetAnimationFunction::GetAttr(nsAtom* aAttName,
|
||||
nsAString& aResult) const {
|
||||
if (IsDisallowedAttribute(aAttName)) return false;
|
||||
|
||||
return nsSMILAnimationFunction::GetAttr(aAttName, aResult);
|
||||
return SMILAnimationFunction::GetAttr(aAttName, aResult);
|
||||
}
|
||||
|
||||
bool nsSMILSetAnimationFunction::WillReplace() const { return true; }
|
||||
bool SMILSetAnimationFunction::WillReplace() const { return true; }
|
||||
|
||||
} // namespace mozilla
|
|
@ -8,15 +8,17 @@
|
|||
#define NS_SMILSETANIMATIONFUNCTION_H_
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsSMILAnimationFunction.h"
|
||||
#include "mozilla/SMILAnimationFunction.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSMILSetAnimationFunction
|
||||
// SMILSetAnimationFunction
|
||||
//
|
||||
// Subclass of nsSMILAnimationFunction that limits the behaviour to that offered
|
||||
// Subclass of SMILAnimationFunction that limits the behaviour to that offered
|
||||
// by a <set> element.
|
||||
//
|
||||
class nsSMILSetAnimationFunction : public nsSMILAnimationFunction {
|
||||
class SMILSetAnimationFunction : public SMILAnimationFunction {
|
||||
public:
|
||||
/*
|
||||
* Sets animation-specific attributes (or marks them dirty, in the case
|
||||
|
@ -60,4 +62,6 @@ class nsSMILSetAnimationFunction : public nsSMILAnimationFunction {
|
|||
bool IsDisallowedAttribute(const nsAtom* aAttribute) const;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // NS_SMILSETANIMATIONFUNCTION_H_
|
|
@ -11,7 +11,6 @@ MOCHITEST_MANIFESTS += ['test/mochitest.ini']
|
|||
|
||||
EXPORTS += [
|
||||
'nsISMILAttr.h',
|
||||
'nsSMILAnimationFunction.h',
|
||||
'nsSMILCompositorTable.h',
|
||||
'nsSMILCSSProperty.h',
|
||||
'nsSMILInstanceTime.h',
|
||||
|
@ -19,7 +18,6 @@ EXPORTS += [
|
|||
'nsSMILKeySpline.h',
|
||||
'nsSMILMilestone.h',
|
||||
'nsSMILRepeatCount.h',
|
||||
'nsSMILSetAnimationFunction.h',
|
||||
'nsSMILTargetIdentifier.h',
|
||||
'nsSMILTimeContainer.h',
|
||||
'nsSMILTimedElement.h',
|
||||
|
@ -35,6 +33,8 @@ EXPORTS += [
|
|||
|
||||
EXPORTS.mozilla += [
|
||||
'SMILAnimationController.h',
|
||||
'SMILAnimationFunction.h',
|
||||
'SMILSetAnimationFunction.h',
|
||||
]
|
||||
|
||||
EXPORTS.mozilla.dom += [
|
||||
|
@ -42,7 +42,6 @@ EXPORTS.mozilla.dom += [
|
|||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'nsSMILAnimationFunction.cpp',
|
||||
'nsSMILCompositor.cpp',
|
||||
'nsSMILCSSProperty.cpp',
|
||||
'nsSMILInstanceTime.cpp',
|
||||
|
@ -50,19 +49,20 @@ UNIFIED_SOURCES += [
|
|||
'nsSMILKeySpline.cpp',
|
||||
'nsSMILParserUtils.cpp',
|
||||
'nsSMILRepeatCount.cpp',
|
||||
'nsSMILSetAnimationFunction.cpp',
|
||||
'nsSMILTimeContainer.cpp',
|
||||
'nsSMILTimedElement.cpp',
|
||||
'nsSMILTimeValue.cpp',
|
||||
'nsSMILTimeValueSpec.cpp',
|
||||
'nsSMILValue.cpp',
|
||||
'SMILAnimationController.cpp',
|
||||
'SMILAnimationFunction.cpp',
|
||||
'SMILBoolType.cpp',
|
||||
'SMILCSSValueType.cpp',
|
||||
'SMILEnumType.cpp',
|
||||
'SMILFloatType.cpp',
|
||||
'SMILIntegerType.cpp',
|
||||
'SMILNullType.cpp',
|
||||
'SMILSetAnimationFunction.cpp',
|
||||
'SMILStringType.cpp',
|
||||
'TimeEvent.cpp',
|
||||
]
|
||||
|
|
|
@ -34,7 +34,7 @@ void nsSMILCompositor::Traverse(nsCycleCollectionTraversalCallback* aCallback) {
|
|||
}
|
||||
|
||||
// Other methods
|
||||
void nsSMILCompositor::AddAnimationFunction(nsSMILAnimationFunction* aFunc) {
|
||||
void nsSMILCompositor::AddAnimationFunction(SMILAnimationFunction* aFunc) {
|
||||
if (aFunc) {
|
||||
mAnimationFunctions.AppendElement(aFunc);
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ void nsSMILCompositor::ComposeAttribute(bool& aMightHavePendingStyleUpdates) {
|
|||
}
|
||||
|
||||
// SECOND: Sort the animationFunctions, to prepare for compositing.
|
||||
nsSMILAnimationFunction::Comparator comparator;
|
||||
SMILAnimationFunction::Comparator comparator;
|
||||
mAnimationFunctions.Sort(comparator);
|
||||
|
||||
// THIRD: Step backwards through animation functions to find out
|
||||
|
@ -169,7 +169,7 @@ bool nsSMILCompositor::MightNeedBaseStyle() const {
|
|||
|
||||
// We should return true if at least one animation function might build on
|
||||
// the base value.
|
||||
for (const nsSMILAnimationFunction* func : mAnimationFunctions) {
|
||||
for (const SMILAnimationFunction* func : mAnimationFunctions) {
|
||||
if (!func->WillReplace()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ uint32_t nsSMILCompositor::GetFirstFuncToAffectSandwich() {
|
|||
|
||||
uint32_t i;
|
||||
for (i = mAnimationFunctions.Length(); i > 0; --i) {
|
||||
nsSMILAnimationFunction* curAnimFunc = mAnimationFunctions[i - 1];
|
||||
SMILAnimationFunction* curAnimFunc = mAnimationFunctions[i - 1];
|
||||
// In the following, the lack of short-circuit behavior of |= means that we
|
||||
// will ALWAYS run UpdateCachedTarget (even if mForceCompositing is true)
|
||||
// but only call HasChanged and WasSkippedInPrevSample if necessary. This
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsTHashtable.h"
|
||||
#include "nsString.h"
|
||||
#include "nsSMILAnimationFunction.h"
|
||||
#include "SMILAnimationFunction.h"
|
||||
#include "nsSMILTargetIdentifier.h"
|
||||
#include "nsSMILCompositorTable.h"
|
||||
#include "PLDHashTable.h"
|
||||
|
@ -46,7 +46,7 @@ class nsSMILCompositor : public PLDHashEntryHdr {
|
|||
enum { ALLOW_MEMMOVE = false };
|
||||
|
||||
// Adds the given animation function to this Compositor's list of functions
|
||||
void AddAnimationFunction(nsSMILAnimationFunction* aFunc);
|
||||
void AddAnimationFunction(mozilla::SMILAnimationFunction* aFunc);
|
||||
|
||||
// Composes the attribute's current value with the list of animation
|
||||
// functions, and assigns the resulting value to this compositor's target
|
||||
|
@ -104,7 +104,7 @@ class nsSMILCompositor : public PLDHashEntryHdr {
|
|||
KeyType mKey;
|
||||
|
||||
// Hash Value: List of animation functions that animate the specified attr
|
||||
nsTArray<nsSMILAnimationFunction*> mAnimationFunctions;
|
||||
nsTArray<mozilla::SMILAnimationFunction*> mAnimationFunctions;
|
||||
|
||||
// Member data for detecting when we need to force-recompose
|
||||
// ---------------------------------------------------------
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsSMILParserUtils.h"
|
||||
#include "mozilla/SVGContentUtils.h"
|
||||
#include "mozilla/TextUtils.h"
|
||||
#include "nsSMILKeySpline.h"
|
||||
#include "nsISMILAttr.h"
|
||||
|
@ -15,7 +16,6 @@
|
|||
#include "nsSMILRepeatCount.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCharSeparatedTokenizer.h"
|
||||
#include "SVGContentUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "mozilla/TaskCategory.h"
|
||||
#include "nsSMILTimedElement.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsSMILAnimationFunction.h"
|
||||
#include "SMILAnimationFunction.h"
|
||||
#include "nsSMILTimeValue.h"
|
||||
#include "nsSMILTimeValueSpec.h"
|
||||
#include "nsSMILInstanceTime.h"
|
||||
|
@ -449,7 +449,7 @@ void nsSMILTimedElement::RemoveInstanceTimesForCreator(
|
|||
UpdateCurrentInterval();
|
||||
}
|
||||
|
||||
void nsSMILTimedElement::SetTimeClient(nsSMILAnimationFunction* aClient) {
|
||||
void nsSMILTimedElement::SetTimeClient(SMILAnimationFunction* aClient) {
|
||||
//
|
||||
// No need to check for nullptr. A nullptr parameter simply means to remove
|
||||
// the previous client which we do by setting to nullptr anyway.
|
||||
|
|
|
@ -22,12 +22,12 @@
|
|||
#include "nsAutoPtr.h"
|
||||
#include "nsAttrValue.h"
|
||||
|
||||
class nsSMILAnimationFunction;
|
||||
class nsSMILTimeContainer;
|
||||
class nsSMILTimeValue;
|
||||
class nsAtom;
|
||||
|
||||
namespace mozilla {
|
||||
class SMILAnimationFunction;
|
||||
namespace dom {
|
||||
class SVGAnimationElement;
|
||||
} // namespace dom
|
||||
|
@ -42,6 +42,7 @@ class nsSMILTimedElement {
|
|||
~nsSMILTimedElement();
|
||||
|
||||
typedef mozilla::dom::Element Element;
|
||||
typedef mozilla::SMILAnimationFunction SMILAnimationFunction;
|
||||
|
||||
/*
|
||||
* Sets the owning animation element which this class uses to convert between
|
||||
|
@ -194,7 +195,7 @@ class nsSMILTimedElement {
|
|||
* to nullptr will simply disassociate the previous client,
|
||||
* if any.
|
||||
*/
|
||||
void SetTimeClient(nsSMILAnimationFunction* aClient);
|
||||
void SetTimeClient(SMILAnimationFunction* aClient);
|
||||
|
||||
/**
|
||||
* Samples the object at the given container time. Timing intervals are
|
||||
|
@ -580,7 +581,7 @@ class nsSMILTimedElement {
|
|||
InstanceTimeList mEndInstances;
|
||||
uint32_t mInstanceSerialIndex;
|
||||
|
||||
nsSMILAnimationFunction* mClient;
|
||||
SMILAnimationFunction* mClient;
|
||||
mozilla::UniquePtr<nsSMILInterval> mCurrentInterval;
|
||||
IntervalList mOldIntervals;
|
||||
uint32_t mCurrentRepeatIteration;
|
||||
|
|
|
@ -31,7 +31,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAnimateElement)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsSMILAnimationFunction& SVGAnimateElement::AnimationFunction() {
|
||||
SMILAnimationFunction& SVGAnimateElement::AnimationFunction() {
|
||||
return mAnimationFunction;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/SVGAnimationElement.h"
|
||||
#include "nsSMILAnimationFunction.h"
|
||||
#include "mozilla/SMILAnimationFunction.h"
|
||||
|
||||
nsresult NS_NewSVGAnimateElement(
|
||||
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
||||
|
@ -22,7 +22,7 @@ class SVGAnimateElement final : public SVGAnimationElement {
|
|||
explicit SVGAnimateElement(
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
||||
|
||||
nsSMILAnimationFunction mAnimationFunction;
|
||||
SMILAnimationFunction mAnimationFunction;
|
||||
friend nsresult(::NS_NewSVGAnimateElement(
|
||||
nsIContent** aResult,
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
|
||||
|
@ -35,7 +35,7 @@ class SVGAnimateElement final : public SVGAnimationElement {
|
|||
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
|
||||
// SVGAnimationElement
|
||||
virtual nsSMILAnimationFunction& AnimationFunction() override;
|
||||
virtual SMILAnimationFunction& AnimationFunction() override;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -31,7 +31,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAnimateMotionElement)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsSMILAnimationFunction& SVGAnimateMotionElement::AnimationFunction() {
|
||||
SMILAnimationFunction& SVGAnimateMotionElement::AnimationFunction() {
|
||||
return mAnimationFunction;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class SVGAnimateMotionElement final : public SVGAnimationElement {
|
|||
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
|
||||
// SVGAnimationElement
|
||||
virtual nsSMILAnimationFunction& AnimationFunction() override;
|
||||
virtual SMILAnimationFunction& AnimationFunction() override;
|
||||
virtual bool GetTargetAttributeName(int32_t* aNamespaceID,
|
||||
nsAtom** aLocalName) const override;
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGAnimateTransformElement)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsSMILAnimationFunction& SVGAnimateTransformElement::AnimationFunction() {
|
||||
SMILAnimationFunction& SVGAnimateTransformElement::AnimationFunction() {
|
||||
return mAnimationFunction;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/SVGAnimationElement.h"
|
||||
#include "nsSMILAnimationFunction.h"
|
||||
#include "mozilla/SMILAnimationFunction.h"
|
||||
|
||||
nsresult NS_NewSVGAnimateTransformElement(
|
||||
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
||||
|
@ -22,7 +22,7 @@ class SVGAnimateTransformElement final : public SVGAnimationElement {
|
|||
explicit SVGAnimateTransformElement(
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
||||
|
||||
nsSMILAnimationFunction mAnimationFunction;
|
||||
SMILAnimationFunction mAnimationFunction;
|
||||
friend nsresult(::NS_NewSVGAnimateTransformElement(
|
||||
nsIContent** aResult,
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
|
||||
|
@ -41,7 +41,7 @@ class SVGAnimateTransformElement final : public SVGAnimationElement {
|
|||
nsAttrValue& aResult) override;
|
||||
|
||||
// SVGAnimationElement
|
||||
virtual nsSMILAnimationFunction& AnimationFunction() override;
|
||||
virtual SMILAnimationFunction& AnimationFunction() override;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "mozilla/dom/ElementInlines.h"
|
||||
#include "nsSMILTimeContainer.h"
|
||||
#include "SMILAnimationController.h"
|
||||
#include "nsSMILAnimationFunction.h"
|
||||
#include "SMILAnimationFunction.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIContentInlines.h"
|
||||
#include "nsIURI.h"
|
||||
|
|
|
@ -63,7 +63,7 @@ class SVGAnimationElement : public SVGAnimationElementBase, public SVGTests {
|
|||
nsAtom** aLocalName) const;
|
||||
nsSMILTimedElement& TimedElement();
|
||||
nsSMILTimeContainer* GetTimeContainer();
|
||||
virtual nsSMILAnimationFunction& AnimationFunction() = 0;
|
||||
virtual SMILAnimationFunction& AnimationFunction() = 0;
|
||||
|
||||
virtual bool IsEventAttributeNameInternal(nsAtom* aName) override;
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
*/
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/SVGContentUtils.h"
|
||||
#include "mozilla/dom/DOMRect.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/gfx/MatrixFwd.h"
|
||||
|
@ -23,7 +24,6 @@
|
|||
#include "nsError.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsStyledElement.h"
|
||||
#include "SVGContentUtils.h"
|
||||
#include "nsSVGClass.h"
|
||||
#include "gfxMatrix.h"
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ typedef nsresult (*SVGContentCreatorFunction)(
|
|||
nsIContent** aResult, \
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo, \
|
||||
mozilla::dom::FromParser aFromParser);
|
||||
#include "SVGTagList.h"
|
||||
#include "mozilla/SVGTagList.h"
|
||||
#undef SVG_TAG
|
||||
#undef SVG_FROM_PARSER_TAG
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ bool SVGMotionSMILAnimationFunction::SetAttr(nsAtom* aAttribute,
|
|||
}
|
||||
} else {
|
||||
// Defer to superclass method
|
||||
return nsSMILAnimationFunction::SetAttr(aAttribute, aValue, aResult,
|
||||
return SMILAnimationFunction::SetAttr(aAttribute, aValue, aResult,
|
||||
aParseResult);
|
||||
}
|
||||
|
||||
|
@ -97,13 +97,13 @@ bool SVGMotionSMILAnimationFunction::UnsetAttr(nsAtom* aAttribute) {
|
|||
MarkStaleIfAttributeAffectsPath(aAttribute);
|
||||
} else {
|
||||
// Defer to superclass method
|
||||
return nsSMILAnimationFunction::UnsetAttr(aAttribute);
|
||||
return SMILAnimationFunction::UnsetAttr(aAttribute);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
nsSMILAnimationFunction::nsSMILCalcMode
|
||||
SMILAnimationFunction::nsSMILCalcMode
|
||||
SVGMotionSMILAnimationFunction::GetCalcMode() const {
|
||||
const nsAttrValue* value = GetAttr(nsGkAtoms::calcMode);
|
||||
if (!value) {
|
||||
|
@ -164,7 +164,7 @@ void SVGMotionSMILAnimationFunction::RebuildPathAndVerticesFromBasicAttrs(
|
|||
} else {
|
||||
// Create dummy 'from' value at 0,0, if we're doing by-animation.
|
||||
// (NOTE: We don't add the dummy 0-point to our list for *to-animation*,
|
||||
// because the nsSMILAnimationFunction logic for to-animation doesn't
|
||||
// because the SMILAnimationFunction logic for to-animation doesn't
|
||||
// expect a dummy value. It only expects one value: the final 'to' value.)
|
||||
pathGenerator.MoveToOrigin();
|
||||
if (!HasAttr(nsGkAtoms::to)) {
|
||||
|
@ -320,7 +320,7 @@ nsresult SVGMotionSMILAnimationFunction::GetValues(const nsISMILAttr& aSMILAttr,
|
|||
void SVGMotionSMILAnimationFunction::CheckValueListDependentAttrs(
|
||||
uint32_t aNumValues) {
|
||||
// Call superclass method.
|
||||
nsSMILAnimationFunction::CheckValueListDependentAttrs(aNumValues);
|
||||
SMILAnimationFunction::CheckValueListDependentAttrs(aNumValues);
|
||||
|
||||
// Added behavior: Do checks specific to keyPoints.
|
||||
CheckKeyPoints();
|
||||
|
@ -332,7 +332,7 @@ bool SVGMotionSMILAnimationFunction::IsToAnimation() const {
|
|||
// NOTE: We can't rely on mPathSourceType, because it might not have been
|
||||
// set to a useful value yet (or it might be stale).
|
||||
return !GetFirstMPathChild(mAnimationElement) && !HasAttr(nsGkAtoms::path) &&
|
||||
nsSMILAnimationFunction::IsToAnimation();
|
||||
SMILAnimationFunction::IsToAnimation();
|
||||
}
|
||||
|
||||
void SVGMotionSMILAnimationFunction::CheckKeyPoints() {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "nsSMILAnimationFunction.h"
|
||||
#include "mozilla/SMILAnimationFunction.h"
|
||||
#include "nsTArray.h"
|
||||
#include "SVGMotionSMILType.h" // for RotateType
|
||||
|
||||
|
@ -28,10 +28,10 @@ class SVGMPathElement;
|
|||
//----------------------------------------------------------------------
|
||||
// SVGMotionSMILAnimationFunction
|
||||
//
|
||||
// Subclass of nsSMILAnimationFunction to support a few extra features offered
|
||||
// Subclass of SMILAnimationFunction to support a few extra features offered
|
||||
// by the <animateMotion> element.
|
||||
//
|
||||
class SVGMotionSMILAnimationFunction final : public nsSMILAnimationFunction {
|
||||
class SVGMotionSMILAnimationFunction final : public SMILAnimationFunction {
|
||||
typedef mozilla::gfx::Path Path;
|
||||
|
||||
public:
|
||||
|
|
|
@ -31,7 +31,7 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGSetElement)
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsSMILAnimationFunction& SVGSetElement::AnimationFunction() {
|
||||
SMILAnimationFunction& SVGSetElement::AnimationFunction() {
|
||||
return mAnimationFunction;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/SVGAnimationElement.h"
|
||||
#include "nsSMILSetAnimationFunction.h"
|
||||
#include "mozilla/SMILSetAnimationFunction.h"
|
||||
|
||||
nsresult NS_NewSVGSetElement(
|
||||
nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
||||
|
@ -21,7 +21,7 @@ class SVGSetElement final : public SVGAnimationElement {
|
|||
protected:
|
||||
explicit SVGSetElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
|
||||
|
||||
nsSMILSetAnimationFunction mAnimationFunction;
|
||||
SMILSetAnimationFunction mAnimationFunction;
|
||||
|
||||
friend nsresult(::NS_NewSVGSetElement(
|
||||
nsIContent** aResult,
|
||||
|
@ -35,7 +35,7 @@ class SVGSetElement final : public SVGAnimationElement {
|
|||
virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
|
||||
|
||||
// SVGAnimationElement
|
||||
virtual nsSMILAnimationFunction& AnimationFunction() override;
|
||||
virtual SMILAnimationFunction& AnimationFunction() override;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
#ifndef mozilla_dom_SVGTests_h
|
||||
#define mozilla_dom_SVGTests_h
|
||||
|
||||
#include "nsStringFwd.h"
|
||||
#include "SVGStringList.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsStringFwd.h"
|
||||
#include "mozilla/SVGStringList.h"
|
||||
|
||||
class nsAttrValue;
|
||||
class nsAtom;
|
||||
|
|
|
@ -12,6 +12,9 @@ MOCHITEST_MANIFESTS += ['test/mochitest.ini']
|
|||
EXPORTS += [
|
||||
'nsSVGClass.h',
|
||||
'nsSVGFeatures.h',
|
||||
]
|
||||
|
||||
EXPORTS.mozilla += [
|
||||
'SVGAttrValueWrapper.h',
|
||||
'SVGContentUtils.h',
|
||||
'SVGPreserveAspectRatio.h',
|
||||
|
|
|
@ -351,13 +351,9 @@ bool TenuredCell::isInsideZone(JS::Zone* zone) const {
|
|||
MOZ_ASSERT(!CurrentThreadIsIonCompiling());
|
||||
MOZ_ASSERT(thing);
|
||||
MOZ_ASSERT(CurrentThreadCanAccessZone(thing->zoneFromAnyThread()));
|
||||
|
||||
// It would be good if barriers were never triggered during collection, but
|
||||
// at the moment this can happen e.g. when rekeying tables containing
|
||||
// read-barriered GC things after a moving GC.
|
||||
//
|
||||
// TODO: Fix this and assert we're not collecting if we're on the active
|
||||
// thread.
|
||||
// Barriers should not be triggered on main thread while collecting.
|
||||
MOZ_ASSERT_IF(CurrentThreadCanAccessRuntime(thing->runtimeFromAnyThread()),
|
||||
!JS::RuntimeHeapIsCollecting());
|
||||
|
||||
JS::shadow::Zone* shadowZone = thing->shadowZoneFromAnyThread();
|
||||
if (shadowZone->needsIncrementalBarrier()) {
|
||||
|
|
|
@ -336,6 +336,9 @@ bool Zone::canCollect() {
|
|||
}
|
||||
|
||||
void Zone::notifyObservingDebuggers() {
|
||||
MOZ_ASSERT(JS::RuntimeHeapIsCollecting(),
|
||||
"This method should be called during GC.");
|
||||
|
||||
JSRuntime* rt = runtimeFromMainThread();
|
||||
JSContext* cx = rt->mainContextFromOwnThread();
|
||||
|
||||
|
@ -352,7 +355,7 @@ void Zone::notifyObservingDebuggers() {
|
|||
|
||||
for (GlobalObject::DebuggerVector::Range r = dbgs->all(); !r.empty();
|
||||
r.popFront()) {
|
||||
if (!r.front()->debuggeeIsBeingCollected(rt->gc.majorGCCount())) {
|
||||
if (!r.front().unbarrieredGet()->debuggeeIsBeingCollected(rt->gc.majorGCCount())) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,
|
||||
"OOM while notifying observing Debuggers of a GC: The "
|
||||
|
|
|
@ -3038,7 +3038,10 @@ void Debugger::updateObservesAsmJSOnDebuggees(IsObserving observing) {
|
|||
const GlobalObject& debuggee) {
|
||||
if (auto* v = debuggee.getDebuggers()) {
|
||||
for (auto p = v->begin(); p != v->end(); p++) {
|
||||
if ((*p)->trackingAllocationSites && (*p)->enabled) {
|
||||
// Use unbarrieredGet() to prevent triggering read barrier while
|
||||
// collecting, this is safe as long as dbg does not escape.
|
||||
Debugger* dbg = p->unbarrieredGet();
|
||||
if (dbg->trackingAllocationSites && dbg->enabled) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -3176,6 +3179,8 @@ void Debugger::traceCrossCompartmentEdges(JSTracer* trc) {
|
|||
* returns false.
|
||||
*/
|
||||
/* static */ bool Debugger::markIteratively(GCMarker* marker) {
|
||||
MOZ_ASSERT(JS::RuntimeHeapIsCollecting(),
|
||||
"This method should be called during GC.");
|
||||
bool markedAny = false;
|
||||
|
||||
// Find all Debugger objects in danger of GC. This code is a little
|
||||
|
@ -3193,7 +3198,7 @@ void Debugger::traceCrossCompartmentEdges(JSTracer* trc) {
|
|||
const GlobalObject::DebuggerVector* debuggers = global->getDebuggers();
|
||||
MOZ_ASSERT(debuggers);
|
||||
for (auto p = debuggers->begin(); p != debuggers->end(); p++) {
|
||||
Debugger* dbg = *p;
|
||||
Debugger* dbg = p->unbarrieredGet();
|
||||
|
||||
// dbg is a Debugger with at least one debuggee. Check three things:
|
||||
// - dbg is actually in a compartment that is being marked
|
||||
|
@ -4204,6 +4209,21 @@ static T* findDebuggerInVector(Debugger* dbg,
|
|||
return p;
|
||||
}
|
||||
|
||||
// a ReadBarriered version for findDebuggerInVector
|
||||
// TODO: Bug 1515934 - findDebuggerInVector<T> triggers read barriers.
|
||||
static ReadBarriered<Debugger*>*
|
||||
findDebuggerInVector(Debugger* dbg,
|
||||
Vector<ReadBarriered<Debugger*>, 0, js::SystemAllocPolicy>* vec) {
|
||||
ReadBarriered<Debugger*>* p;
|
||||
for (p = vec->begin(); p != vec->end(); p++) {
|
||||
if (p->unbarrieredGet() == dbg) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
MOZ_ASSERT(p != vec->end());
|
||||
return p;
|
||||
}
|
||||
|
||||
void Debugger::removeDebuggeeGlobal(FreeOp* fop, GlobalObject* global,
|
||||
WeakGlobalObjectSet::Enum* debugEnum) {
|
||||
// The caller might have found global by enumerating this->debuggees; if
|
||||
|
|
|
@ -2578,7 +2578,8 @@ void DebugEnvironments::checkHashTablesAfterMovingGC() {
|
|||
for (MissingEnvironmentMap::Range r = missingEnvs.all(); !r.empty();
|
||||
r.popFront()) {
|
||||
CheckGCThingAfterMovingGC(r.front().key().scope());
|
||||
CheckGCThingAfterMovingGC(r.front().value().get());
|
||||
// Use unbarrieredGet() to prevent triggering read barrier while collecting.
|
||||
CheckGCThingAfterMovingGC(r.front().value().unbarrieredGet());
|
||||
}
|
||||
for (LiveEnvironmentMap::Range r = liveEnvs.all(); !r.empty(); r.popFront()) {
|
||||
CheckGCThingAfterMovingGC(r.front().key());
|
||||
|
|
|
@ -796,7 +796,9 @@ void Realm::updateDebuggerObservesFlag(unsigned flag) {
|
|||
: maybeGlobal();
|
||||
const GlobalObject::DebuggerVector* v = global->getDebuggers();
|
||||
for (auto p = v->begin(); p != v->end(); p++) {
|
||||
Debugger* dbg = *p;
|
||||
// Use unbarrieredGet() to prevent triggering read barrier while collecting,
|
||||
// this is safe as long as dbg does not escape.
|
||||
Debugger* dbg = p->unbarrieredGet();
|
||||
if (flag == DebuggerObservesAllExecution
|
||||
? dbg->observesAllExecution()
|
||||
: flag == DebuggerObservesCoverage
|
||||
|
|
|
@ -1676,7 +1676,9 @@ bool SavedStacks::getLocation(JSContext* cx, const FrameIter& iter,
|
|||
}
|
||||
|
||||
void SavedStacks::chooseSamplingProbability(Realm* realm) {
|
||||
GlobalObject* global = realm->maybeGlobal();
|
||||
// Use unbarriered version to prevent triggering read barrier while collecting,
|
||||
// this is safe as long as global does not escape.
|
||||
GlobalObject* global = realm->unsafeUnbarrieredMaybeGlobal();
|
||||
if (!global) {
|
||||
return;
|
||||
}
|
||||
|
@ -1690,15 +1692,18 @@ void SavedStacks::chooseSamplingProbability(Realm* realm) {
|
|||
mozilla::DebugOnly<bool> foundAnyDebuggers = false;
|
||||
|
||||
double probability = 0;
|
||||
for (auto dbgp = dbgs->begin(); dbgp < dbgs->end(); dbgp++) {
|
||||
for (auto p = dbgs->begin(); p < dbgs->end(); p++) {
|
||||
// The set of debuggers had better not change while we're iterating,
|
||||
// such that the vector gets reallocated.
|
||||
MOZ_ASSERT(dbgs->begin() == begin);
|
||||
// Use unbarrieredGet() to prevent triggering read barrier while collecting,
|
||||
// this is safe as long as dbgp does not escape.
|
||||
Debugger* dbgp = p->unbarrieredGet();
|
||||
|
||||
if ((*dbgp)->trackingAllocationSites && (*dbgp)->enabled) {
|
||||
if (dbgp->trackingAllocationSites && dbgp->enabled) {
|
||||
foundAnyDebuggers = true;
|
||||
probability =
|
||||
std::max((*dbgp)->allocationSamplingProbability, probability);
|
||||
std::max(dbgp->allocationSamplingProbability, probability);
|
||||
}
|
||||
}
|
||||
MOZ_ASSERT(foundAnyDebuggers);
|
||||
|
|
|
@ -2291,12 +2291,12 @@ void Zone::fixupInitialShapeTable() {
|
|||
|
||||
// If the prototype has moved we have to rekey the entry.
|
||||
InitialShapeEntry entry = e.front();
|
||||
if (entry.proto.proto().isObject() &&
|
||||
IsForwarded(entry.proto.proto().toObject())) {
|
||||
entry.proto.setProto(
|
||||
TaggedProto(Forwarded(entry.proto.proto().toObject())));
|
||||
// Use unbarrieredGet() to prevent triggering read barrier while collecting.
|
||||
const TaggedProto& proto = entry.proto.proto().unbarrieredGet();
|
||||
if (proto.isObject() && IsForwarded(proto.toObject())) {
|
||||
entry.proto.setProto(TaggedProto(Forwarded(proto.toObject())));
|
||||
using Lookup = InitialShapeEntry::Lookup;
|
||||
Lookup relookup(shape->getObjectClass(), Lookup::ShapeProto(entry.proto),
|
||||
Lookup relookup(shape->getObjectClass(), Lookup::ShapeProto(proto),
|
||||
shape->numFixedSlots(), shape->getObjectFlags());
|
||||
e.rekeyFront(relookup, entry);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/SVGContextPaint.h"
|
||||
#include "SVGPreserveAspectRatio.h"
|
||||
#include "mozilla/SVGPreserveAspectRatio.h"
|
||||
#include "Units.h"
|
||||
|
||||
class nsIFrame;
|
||||
|
|
|
@ -1189,6 +1189,9 @@ function UpdatePatch(patch) {
|
|||
for (var i = 0; i < patch.attributes.length; ++i) {
|
||||
var attr = patch.attributes.item(i);
|
||||
switch (attr.name) {
|
||||
case "xmlns":
|
||||
// Don't save the XML namespace.
|
||||
break;
|
||||
case "selected":
|
||||
this.selected = attr.value == "true";
|
||||
break;
|
||||
|
@ -1198,8 +1201,19 @@ function UpdatePatch(patch) {
|
|||
throw Cr.NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
// fall through
|
||||
case "type":
|
||||
case "URL":
|
||||
case "finalURL":
|
||||
case "state":
|
||||
case "errorCode":
|
||||
this[attr.name] = attr.value;
|
||||
break;
|
||||
default:
|
||||
this[attr.name] = attr.value;
|
||||
// Save custom attributes when serializing to the local xml file but
|
||||
// don't use this method for the expected attributes which are already
|
||||
// handled in serialize.
|
||||
this.setProperty(attr.name, attr.value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1260,16 +1274,22 @@ UpdatePatch.prototype = {
|
|||
|
||||
/**
|
||||
* See nsIPropertyBag.idl
|
||||
*
|
||||
* Note: this only contains the nsIPropertyBag name / value pairs and not the
|
||||
* nsIUpdatePatch name / value pairs.
|
||||
*/
|
||||
get enumerator() {
|
||||
return this.enumerate();
|
||||
},
|
||||
|
||||
* enumerate() {
|
||||
for (var p in this._properties) {
|
||||
let prop = this.properties[p].data;
|
||||
if (prop) {
|
||||
yield prop;
|
||||
for (let propName in this._properties) {
|
||||
if (this._properties[propName].present) {
|
||||
// The nsIPropertyBag enumerator returns a nsISimpleEnumerator whose
|
||||
// elements are nsIProperty objects.
|
||||
yield { name: propName,
|
||||
value: this._properties[propName].data,
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIProperty])};
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -1361,7 +1381,8 @@ function Update(update) {
|
|||
|
||||
for (let i = 0; i < update.attributes.length; ++i) {
|
||||
var attr = update.attributes.item(i);
|
||||
if (attr.value == "undefined") {
|
||||
if (attr.name == "xmlns" || attr.value == "undefined") {
|
||||
// Don't save the XML namespace or undefined values.
|
||||
continue;
|
||||
} else if (attr.name == "detailsURL") {
|
||||
this._detailsURL = attr.value;
|
||||
|
@ -1577,16 +1598,22 @@ Update.prototype = {
|
|||
|
||||
/**
|
||||
* See nsIPropertyBag.idl
|
||||
*
|
||||
* Note: this only contains the nsIPropertyBag name value / pairs and not the
|
||||
* nsIUpdate name / value pairs.
|
||||
*/
|
||||
get enumerator() {
|
||||
return this.enumerate();
|
||||
},
|
||||
|
||||
* enumerate() {
|
||||
for (var p in this._properties) {
|
||||
let prop = this.properties[p].data;
|
||||
if (prop) {
|
||||
yield prop;
|
||||
for (let propName in this._properties) {
|
||||
if (this._properties[propName].present) {
|
||||
// The nsIPropertyBag enumerator returns a nsISimpleEnumerator whose
|
||||
// elements are nsIProperty objects.
|
||||
yield { name: propName,
|
||||
value: this._properties[propName].data,
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIProperty])};
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -11,7 +11,6 @@ skip-if = os != 'win'
|
|||
reason = Tests that update config is properly written to file, which is a Windows-only feature
|
||||
[browser_updatesBackgroundWindow.js]
|
||||
[browser_updatesBackgroundWindowFailures.js]
|
||||
skip-if = verify
|
||||
[browser_updatesBasicPrompt.js]
|
||||
skip-if = asan
|
||||
reason = Bug 1168003
|
||||
|
|
|
@ -29,7 +29,7 @@ add_task(async function testUpdatePingReady() {
|
|||
notificationId: "update-available",
|
||||
button: "button",
|
||||
beforeClick() {
|
||||
checkWhatsNewLink("update-available-whats-new");
|
||||
checkWhatsNewLink(window, "update-available-whats-new");
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -21,7 +21,7 @@ add_task(async function testUpdatesBackgroundWindow() {
|
|||
await SimpleTest.promiseFocus(window);
|
||||
await popupShownPromise;
|
||||
|
||||
checkWhatsNewLink("update-available-whats-new");
|
||||
checkWhatsNewLink(window, "update-available-whats-new");
|
||||
let buttonEl = getNotificationButton(window, "update-available", "button");
|
||||
buttonEl.click();
|
||||
},
|
||||
|
|
|
@ -2,7 +2,7 @@ add_task(async function testBackgroundWindowFailures() {
|
|||
const maxBackgroundErrors = 5;
|
||||
SpecialPowers.pushPrefEnv({set: [
|
||||
[PREF_APP_UPDATE_BACKGROUNDMAXERRORS, maxBackgroundErrors],
|
||||
[PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS, 2],
|
||||
[PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS, 2],
|
||||
]});
|
||||
|
||||
let updateParams = "badURL=1";
|
||||
|
@ -19,7 +19,7 @@ add_task(async function testBackgroundWindowFailures() {
|
|||
is(PanelUI.menuButton.getAttribute("badge-status"), "update-available",
|
||||
"The badge is showing for the background window");
|
||||
|
||||
checkWhatsNewLink("update-available-whats-new");
|
||||
checkWhatsNewLink(extraWindow, "update-available-whats-new");
|
||||
let buttonEl = getNotificationButton(extraWindow, "update-available", "button");
|
||||
buttonEl.click();
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ add_task(async function testBasicPrompt() {
|
|||
notificationId: "update-available",
|
||||
button: "button",
|
||||
beforeClick() {
|
||||
checkWhatsNewLink("update-available-whats-new");
|
||||
checkWhatsNewLink(window, "update-available-whats-new");
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@ add_task(async function testBasicPromptNoStaging() {
|
|||
notificationId: "update-available",
|
||||
button: "button",
|
||||
beforeClick() {
|
||||
checkWhatsNewLink("update-available-whats-new");
|
||||
checkWhatsNewLink(window, "update-available-whats-new");
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
add_task(async function testCompleteAndPartialPatchesWithBadSizes() {
|
||||
SpecialPowers.pushPrefEnv({set: [[PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS, 2]]});
|
||||
SpecialPowers.pushPrefEnv({set: [
|
||||
[PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS, 2],
|
||||
]});
|
||||
let updateParams = "invalidPartialSize=1&invalidCompleteSize=1";
|
||||
|
||||
await runUpdateTest(updateParams, 1, [
|
||||
|
@ -20,7 +22,7 @@ add_task(async function testCompleteAndPartialPatchesWithBadSizes() {
|
|||
notificationId: "update-manual",
|
||||
button: "button",
|
||||
beforeClick() {
|
||||
checkWhatsNewLink("update-manual-whats-new");
|
||||
checkWhatsNewLink(window, "update-manual-whats-new");
|
||||
},
|
||||
async cleanup() {
|
||||
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
|
|
|
@ -11,7 +11,7 @@ add_task(async function testCompletePatchApplyFailure() {
|
|||
notificationId: "update-manual",
|
||||
button: "button",
|
||||
beforeClick() {
|
||||
checkWhatsNewLink("update-manual-whats-new");
|
||||
checkWhatsNewLink(window, "update-manual-whats-new");
|
||||
},
|
||||
async cleanup() {
|
||||
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
add_task(async function testCompletePatchWithBadCompleteSize() {
|
||||
SpecialPowers.pushPrefEnv({set: [[PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS, 2]]});
|
||||
SpecialPowers.pushPrefEnv({set: [
|
||||
[PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS, 2],
|
||||
]});
|
||||
|
||||
let updateParams = "completePatchOnly=1&invalidCompleteSize=1";
|
||||
|
||||
|
@ -21,7 +23,7 @@ add_task(async function testCompletePatchWithBadCompleteSize() {
|
|||
notificationId: "update-manual",
|
||||
button: "button",
|
||||
beforeClick() {
|
||||
checkWhatsNewLink("update-manual-whats-new");
|
||||
checkWhatsNewLink(window, "update-manual-whats-new");
|
||||
},
|
||||
async cleanup() {
|
||||
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
|
|
|
@ -2,7 +2,7 @@ add_task(async function testDownloadFailures() {
|
|||
const maxBackgroundErrors = 5;
|
||||
SpecialPowers.pushPrefEnv({set: [
|
||||
[PREF_APP_UPDATE_BACKGROUNDMAXERRORS, maxBackgroundErrors],
|
||||
[PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS, 2],
|
||||
[PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS, 2],
|
||||
]});
|
||||
let updateParams = "badURL=1";
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ add_task(async function testMalformedXml() {
|
|||
notificationId: "update-manual",
|
||||
button: "button",
|
||||
beforeClick() {
|
||||
checkWhatsNewLink("update-manual-whats-new", updateDetailsUrl);
|
||||
checkWhatsNewLink(window, "update-manual-whats-new", updateDetailsUrl);
|
||||
},
|
||||
async cleanup() {
|
||||
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
|
|
|
@ -13,7 +13,7 @@ add_task(async function testPartialPatchApplyFailure() {
|
|||
notificationId: "update-manual",
|
||||
button: "button",
|
||||
beforeClick() {
|
||||
checkWhatsNewLink("update-manual-whats-new");
|
||||
checkWhatsNewLink(window, "update-manual-whats-new");
|
||||
},
|
||||
async cleanup() {
|
||||
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
add_task(async function testPartialPatchApplyFailureWithCompleteValidationFailure() {
|
||||
// because of the way we're simulating failure, we have to just pretend we've already
|
||||
// retried.
|
||||
SpecialPowers.pushPrefEnv({set: [[PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS, 0]]});
|
||||
SpecialPowers.pushPrefEnv({set: [
|
||||
[PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS, 0],
|
||||
]});
|
||||
|
||||
let patchProps = {type: "partial",
|
||||
state: STATE_PENDING};
|
||||
|
@ -20,7 +22,7 @@ add_task(async function testPartialPatchApplyFailureWithCompleteValidationFailur
|
|||
notificationId: "update-manual",
|
||||
button: "button",
|
||||
beforeClick() {
|
||||
checkWhatsNewLink("update-manual-whats-new");
|
||||
checkWhatsNewLink(window, "update-manual-whats-new");
|
||||
},
|
||||
async cleanup() {
|
||||
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
add_task(async function testPartialPatchWithBadPartialSize() {
|
||||
SpecialPowers.pushPrefEnv({set: [[PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS, 2]]});
|
||||
SpecialPowers.pushPrefEnv({set: [
|
||||
[PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS, 2],
|
||||
]});
|
||||
let updateParams = "partialPatchOnly=1&invalidPartialSize=1";
|
||||
|
||||
await runUpdateTest(updateParams, 1, [
|
||||
|
@ -20,7 +22,7 @@ add_task(async function testPartialPatchWithBadPartialSize() {
|
|||
notificationId: "update-manual",
|
||||
button: "button",
|
||||
beforeClick() {
|
||||
checkWhatsNewLink("update-manual-whats-new");
|
||||
checkWhatsNewLink(window, "update-manual-whats-new");
|
||||
},
|
||||
async cleanup() {
|
||||
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
|
|
|
@ -283,12 +283,13 @@ function waitForEvent(topic, status = null) {
|
|||
/**
|
||||
* Gets the specified button for the notification.
|
||||
*
|
||||
* @param window
|
||||
* @param win
|
||||
* The window to get the notification button for.
|
||||
* @param notificationId
|
||||
* The ID of the notification to get the button for.
|
||||
* @param button
|
||||
* The anonid of the button to get.
|
||||
* @return The button element.
|
||||
*/
|
||||
function getNotificationButton(win, notificationId, button) {
|
||||
let notification = win.document.getElementById(`appMenu-${notificationId}-notification`);
|
||||
|
@ -301,13 +302,15 @@ function getNotificationButton(win, notificationId, button) {
|
|||
* matches the url parameter provided. If no URL is provided, it will instead
|
||||
* ensure that the link matches the default link URL.
|
||||
*
|
||||
* @param win
|
||||
* The window to get the "What's new" link for.
|
||||
* @param id
|
||||
* The ID of the "What's new" link element.
|
||||
* @param url (optional)
|
||||
* The URL to check against. If none is provided, a default will be used.
|
||||
*/
|
||||
function checkWhatsNewLink(id, url) {
|
||||
let whatsNewLink = document.getElementById(id);
|
||||
function checkWhatsNewLink(win, id, url) {
|
||||
let whatsNewLink = win.document.getElementById(id);
|
||||
is(whatsNewLink.href,
|
||||
url || URL_HTTP_UPDATE_SJS + "?uiURL=DETAILS",
|
||||
"What's new link points to the test_details URL");
|
||||
|
|
|
@ -17,7 +17,7 @@ const PREF_APP_UPDATE_CANCELATIONS = "app.update.cancelations";
|
|||
const PREF_APP_UPDATE_CHANNEL = "app.update.channel";
|
||||
const PREF_APP_UPDATE_DOORHANGER = "app.update.doorhanger";
|
||||
const PREF_APP_UPDATE_DOWNLOADPROMPTATTEMPTS = "app.update.download.attempts";
|
||||
const PREF_APP_UPDATE_DOWNLOADPROMPTMAXATTEMPTS = "app.update.download.maxAttempts";
|
||||
const PREF_APP_UPDATE_DOWNLOADPROMPT_MAXATTEMPTS = "app.update.download.maxAttempts";
|
||||
const PREF_APP_UPDATE_DISABLEDFORTESTING = "app.update.disabledForTesting";
|
||||
const PREF_APP_UPDATE_IDLETIME = "app.update.idletime";
|
||||
const PREF_APP_UPDATE_LOG = "app.update.log";
|
||||
|
|
|
@ -162,6 +162,8 @@ function getRemotePatchString(aPatchProps) {
|
|||
set url(val) {
|
||||
this._url = val;
|
||||
},
|
||||
custom1: null,
|
||||
custom2: null,
|
||||
size: SIZE_SIMPLE_MAR,
|
||||
};
|
||||
|
||||
|
@ -274,6 +276,8 @@ function getLocalPatchString(aPatchProps) {
|
|||
type: "complete",
|
||||
url: gURLData + FILE_SIMPLE_MAR,
|
||||
size: SIZE_SIMPLE_MAR,
|
||||
custom1: null,
|
||||
custom2: null,
|
||||
selected: "true",
|
||||
state: STATE_SUCCEEDED,
|
||||
};
|
||||
|
@ -335,8 +339,12 @@ function getPatchString(aPatchProps) {
|
|||
let type = "type=\"" + aPatchProps.type + "\" ";
|
||||
let url = "URL=\"" + aPatchProps.url + "\" ";
|
||||
let size = "size=\"" + aPatchProps.size + "\"";
|
||||
let custom1 = aPatchProps.custom1 ? aPatchProps.custom1 + " " : "";
|
||||
let custom2 = aPatchProps.custom2 ? aPatchProps.custom2 + " " : "";
|
||||
return "<patch " +
|
||||
type +
|
||||
url +
|
||||
custom1 +
|
||||
custom2 +
|
||||
size;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,9 @@ function run_test() {
|
|||
url: "http://partial/",
|
||||
size: "86",
|
||||
selected: "true",
|
||||
state: STATE_PENDING};
|
||||
state: STATE_PENDING,
|
||||
custom1: "custom1_attr=\"custom1 patch value\"",
|
||||
custom2: "custom2_attr=\"custom2 patch value\""};
|
||||
let patches = getLocalPatchString(patchProps);
|
||||
let updateProps = {type: "major",
|
||||
name: "New",
|
||||
|
@ -42,7 +44,9 @@ function run_test() {
|
|||
url: "http://complete/",
|
||||
size: "75",
|
||||
selected: "true",
|
||||
state: STATE_FAILED};
|
||||
state: STATE_FAILED,
|
||||
custom1: "custom3_attr=\"custom3 patch value\"",
|
||||
custom2: "custom4_attr=\"custom4 patch value\""};
|
||||
patches = getLocalPatchString(patchProps);
|
||||
updateProps = {type: "minor",
|
||||
name: "Existing",
|
||||
|
@ -66,7 +70,7 @@ function run_test() {
|
|||
Assert.equal(gUpdateManager.updateCount, 2,
|
||||
"the update manager updateCount attribute" + MSG_SHOULD_EQUAL);
|
||||
|
||||
debugDump("checking the activeUpdate properties");
|
||||
debugDump("checking the first update properties");
|
||||
let update = gUpdateManager.getUpdateAt(0).QueryInterface(Ci.nsIWritablePropertyBag);
|
||||
Assert.equal(update.state, STATE_SUCCEEDED,
|
||||
"the update state attribute" + MSG_SHOULD_EQUAL);
|
||||
|
@ -102,9 +106,35 @@ function run_test() {
|
|||
"the update custom1_attr property" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(update.getProperty("custom2_attr"), "custom2 value",
|
||||
"the update custom2_attr property" + MSG_SHOULD_EQUAL);
|
||||
// nsIPropertyBag enumerator
|
||||
debugDump("checking the first update enumerator");
|
||||
let e = update.enumerator;
|
||||
Assert.ok(e.hasMoreElements(),
|
||||
"the enumerator.hasMoreElements()" + MSG_SHOULD_EQUAL);
|
||||
let prop = e.getNext().QueryInterface(Ci.nsIProperty);
|
||||
Assert.ok(!!prop,
|
||||
"the enumerator.getNext()" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(prop.name, "custom1_attr",
|
||||
"the first property name" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(prop.value, "custom1 value",
|
||||
"the first property value" + MSG_SHOULD_EQUAL);
|
||||
prop = e.getNext().QueryInterface(Ci.nsIProperty);
|
||||
Assert.ok(!!prop,
|
||||
"the enumerator.getNext()" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(prop.name, "custom2_attr",
|
||||
"the second property name" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(prop.value, "custom2 value",
|
||||
"the second property value" + MSG_SHOULD_EQUAL);
|
||||
prop = e.getNext().QueryInterface(Ci.nsIProperty);
|
||||
Assert.equal(prop.name, "foregroundDownload",
|
||||
"the third property name" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(prop.value, "true",
|
||||
"the third property value" + MSG_SHOULD_EQUAL);
|
||||
Assert.ok(!e.hasMoreElements(),
|
||||
"the enumerator.hasMoreElements()" + MSG_SHOULD_EQUAL);
|
||||
|
||||
debugDump("checking the activeUpdate patch properties");
|
||||
let patch = update.selectedPatch;
|
||||
debugDump("checking the first update patch properties");
|
||||
let patch = update.selectedPatch.QueryInterface(Ci.nsIWritablePropertyBag);
|
||||
Assert.equal(patch.type, "partial",
|
||||
"the update patch type attribute" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(patch.URL, "http://partial/",
|
||||
|
@ -115,8 +145,33 @@ function run_test() {
|
|||
"the update patch selected attribute" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(patch.state, STATE_SUCCEEDED,
|
||||
"the update patch state attribute" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(patch.getProperty("custom1_attr"), "custom1 patch value",
|
||||
"the update patch custom1_attr property" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(patch.getProperty("custom2_attr"), "custom2 patch value",
|
||||
"the update patch custom2_attr property" + MSG_SHOULD_EQUAL);
|
||||
// nsIPropertyBag enumerator
|
||||
debugDump("checking the first update patch enumerator");
|
||||
e = patch.enumerator;
|
||||
Assert.ok(e.hasMoreElements(),
|
||||
"the enumerator.hasMoreElements()" + MSG_SHOULD_EQUAL);
|
||||
prop = e.getNext().QueryInterface(Ci.nsIProperty);
|
||||
Assert.ok(!!prop,
|
||||
"the enumerator.getNext()" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(prop.name, "custom1_attr",
|
||||
"the first property name" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(prop.value, "custom1 patch value",
|
||||
"the first property value" + MSG_SHOULD_EQUAL);
|
||||
prop = e.getNext().QueryInterface(Ci.nsIProperty);
|
||||
Assert.ok(!!prop,
|
||||
"the enumerator.getNext()" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(prop.name, "custom2_attr",
|
||||
"the second property name" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(prop.value, "custom2 patch value",
|
||||
"the second property value" + MSG_SHOULD_EQUAL);
|
||||
Assert.ok(!e.hasMoreElements(),
|
||||
"the enumerator.hasMoreElements()" + MSG_SHOULD_EQUAL);
|
||||
|
||||
debugDump("checking the first update properties");
|
||||
debugDump("checking the second update properties");
|
||||
update = gUpdateManager.getUpdateAt(1).QueryInterface(Ci.nsIWritablePropertyBag);
|
||||
Assert.equal(update.state, STATE_FAILED,
|
||||
"the update state attribute" + MSG_SHOULD_EQUAL);
|
||||
|
@ -151,9 +206,35 @@ function run_test() {
|
|||
"the update custom3_attr property" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(update.getProperty("custom4_attr"), "custom4 value",
|
||||
"the update custom4_attr property" + MSG_SHOULD_EQUAL);
|
||||
// nsIPropertyBag enumerator
|
||||
debugDump("checking the second update enumerator");
|
||||
e = update.enumerator;
|
||||
Assert.ok(e.hasMoreElements(),
|
||||
"the enumerator.hasMoreElements()" + MSG_SHOULD_EQUAL);
|
||||
prop = e.getNext().QueryInterface(Ci.nsIProperty);
|
||||
Assert.ok(!!prop,
|
||||
"the enumerator.getNext()" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(prop.name, "custom3_attr",
|
||||
"the first property name" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(prop.value, "custom3 value",
|
||||
"the first property value" + MSG_SHOULD_EQUAL);
|
||||
prop = e.getNext().QueryInterface(Ci.nsIProperty);
|
||||
Assert.ok(!!prop,
|
||||
"the enumerator.getNext()" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(prop.name, "custom4_attr",
|
||||
"the second property name" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(prop.value, "custom4 value",
|
||||
"the second property value" + MSG_SHOULD_EQUAL);
|
||||
prop = e.getNext().QueryInterface(Ci.nsIProperty);
|
||||
Assert.equal(prop.name, "foregroundDownload",
|
||||
"the third property name" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(prop.value, "false",
|
||||
"the third property value" + MSG_SHOULD_EQUAL);
|
||||
Assert.ok(!e.hasMoreElements(),
|
||||
"the enumerator.hasMoreElements()" + MSG_SHOULD_EQUAL);
|
||||
|
||||
debugDump("checking the first update patch properties");
|
||||
patch = update.selectedPatch;
|
||||
debugDump("checking the second update patch properties");
|
||||
patch = update.selectedPatch.QueryInterface(Ci.nsIWritablePropertyBag);
|
||||
Assert.equal(patch.type, "complete",
|
||||
"the update patch type attribute" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(patch.URL, "http://complete/",
|
||||
|
@ -164,6 +245,31 @@ function run_test() {
|
|||
"the update patch selected attribute" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(patch.state, STATE_FAILED,
|
||||
"the update patch state attribute" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(patch.getProperty("custom3_attr"), "custom3 patch value",
|
||||
"the update patch custom3_attr property" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(patch.getProperty("custom4_attr"), "custom4 patch value",
|
||||
"the update patch custom4_attr property" + MSG_SHOULD_EQUAL);
|
||||
// nsIPropertyBag enumerator
|
||||
debugDump("checking the second update patch enumerator");
|
||||
e = patch.enumerator;
|
||||
Assert.ok(e.hasMoreElements(),
|
||||
"the enumerator.hasMoreElements()" + MSG_SHOULD_EQUAL);
|
||||
prop = e.getNext().QueryInterface(Ci.nsIProperty);
|
||||
Assert.ok(!!prop,
|
||||
"the enumerator.getNext()" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(prop.name, "custom3_attr",
|
||||
"the first property name" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(prop.value, "custom3 patch value",
|
||||
"the first property value" + MSG_SHOULD_EQUAL);
|
||||
prop = e.getNext().QueryInterface(Ci.nsIProperty);
|
||||
Assert.ok(!!prop,
|
||||
"the enumerator.getNext()" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(prop.name, "custom4_attr",
|
||||
"the second property name" + MSG_SHOULD_EQUAL);
|
||||
Assert.equal(prop.value, "custom4 patch value",
|
||||
"the second property value" + MSG_SHOULD_EQUAL);
|
||||
Assert.ok(!e.hasMoreElements(),
|
||||
"the enumerator.hasMoreElements()" + MSG_SHOULD_EQUAL);
|
||||
|
||||
// Cleaning up the active update along with reloading the update manager
|
||||
// in doTestFinish will prevent writing the update xml files during
|
||||
|
|
Загрузка…
Ссылка в новой задаче