Merge mozilla-central to autoland

--HG--
rename : browser/base/content/gcli_sec_bad.svg => devtools/client/themes/images/gcli_sec_bad.svg
rename : browser/base/content/gcli_sec_good.svg => devtools/client/themes/images/gcli_sec_good.svg
rename : browser/base/content/gcli_sec_moderate.svg => devtools/client/themes/images/gcli_sec_moderate.svg
This commit is contained in:
Carsten "Tomcat" Book 2017-05-05 15:27:55 +02:00
Родитель 28439aac69 fdc689ba16
Коммит 6ae9b7bb71
330 изменённых файлов: 25198 добавлений и 22962 удалений

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

@ -795,10 +795,6 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime)
// modification are done.
mDocument->ProcessInvalidationList();
// We cannot rely on DOM tree to keep aria-owns relations updated. Make
// a validation to remove dead links.
mDocument->ValidateARIAOwned();
// Process relocation list.
for (uint32_t idx = 0; idx < mRelocations.Length(); idx++) {
if (mRelocations[idx]->IsInDocument()) {

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

@ -1972,19 +1972,30 @@ DocAccessible::FireEventsOnInsertion(Accessible* aContainer)
}
void
DocAccessible::ContentRemoved(Accessible* aContent)
DocAccessible::ContentRemoved(Accessible* aChild)
{
MOZ_DIAGNOSTIC_ASSERT(aContent->Parent(), "Unattached accessible from tree");
Accessible* parent = aChild->Parent();
MOZ_DIAGNOSTIC_ASSERT(parent, "Unattached accessible from tree");
#ifdef A11Y_LOG
logging::TreeInfo("process content removal", 0,
"container", aContent->Parent(), "child", aContent, nullptr);
"container", parent, "child", aChild, nullptr);
#endif
TreeMutation mt(aContent->Parent());
mt.BeforeRemoval(aContent);
aContent->Parent()->RemoveChild(aContent);
UncacheChildrenInSubtree(aContent);
TreeMutation mt(parent);
mt.BeforeRemoval(aChild);
if (aChild->IsRelocated()) {
nsTArray<RefPtr<Accessible> >* owned = mARIAOwnsHash.Get(parent);
MOZ_ASSERT(owned, "IsRelocated flag is out of sync with mARIAOwnsHash");
owned->RemoveElement(aChild);
if (owned->Length() == 0) {
mARIAOwnsHash.Remove(parent);
}
}
parent->RemoveChild(aChild);
UncacheChildrenInSubtree(aChild);
mt.Done();
}
@ -1996,11 +2007,11 @@ DocAccessible::ContentRemoved(nsIContent* aContentNode)
if (acc) {
ContentRemoved(acc);
}
else {
TreeWalker walker(this, aContentNode);
while (Accessible* acc = walker.Next()) {
ContentRemoved(acc);
}
dom::AllChildrenIterator iter =
dom::AllChildrenIterator(aContentNode, nsIContent::eAllChildren, true);
while (nsIContent* childNode = iter.GetNextChild()) {
ContentRemoved(childNode);
}
}
@ -2027,50 +2038,6 @@ DocAccessible::RelocateARIAOwnedIfNeeded(nsIContent* aElement)
return false;
}
void
DocAccessible::ValidateARIAOwned()
{
for (auto it = mARIAOwnsHash.Iter(); !it.Done(); it.Next()) {
Accessible* owner = it.Key();
nsTArray<RefPtr<Accessible> >* children = it.UserData();
// Owner is about to die, put children back if applicable.
if (owner != this &&
(!mAccessibleCache.GetWeak(reinterpret_cast<void*>(owner)) ||
!owner->IsInDocument())) {
PutChildrenBack(children, 0);
it.Remove();
continue;
}
for (uint32_t idx = 0; idx < children->Length(); idx++) {
Accessible* child = children->ElementAt(idx);
if (!child->IsInDocument()) {
children->RemoveElementAt(idx);
idx--;
continue;
}
NS_ASSERTION(child->Parent(), "No parent for ARIA owned?");
// If DOM node doesn't have a frame anymore then shutdown its accessible.
if (child->Parent() && !child->GetFrame()) {
ContentRemoved(child);
children->RemoveElementAt(idx);
idx--;
continue;
}
NS_ASSERTION(child->Parent() == owner,
"Illigally stolen ARIA owned child!");
}
if (children->Length() == 0) {
it.Remove();
}
}
}
void
DocAccessible::DoARIAOwnsRelocation(Accessible* aOwner)
{
@ -2194,7 +2161,7 @@ DocAccessible::PutChildrenBack(nsTArray<RefPtr<Accessible> >* aChildren,
Accessible* prevChild = walker.Prev();
if (prevChild) {
idxInParent = prevChild->IndexInParent() + 1;
MOZ_ASSERT(origContainer == prevChild->Parent(), "Broken tree");
MOZ_DIAGNOSTIC_ASSERT(origContainer == prevChild->Parent(), "Broken tree");
origContainer = prevChild->Parent();
}
else {
@ -2225,8 +2192,12 @@ DocAccessible::MoveChild(Accessible* aChild, Accessible* aNewParent,
// If the child was taken from from an ARIA owns element.
if (aChild->IsRelocated()) {
nsTArray<RefPtr<Accessible> >* children = mARIAOwnsHash.Get(curParent);
children->RemoveElement(aChild);
nsTArray<RefPtr<Accessible> >* owned = mARIAOwnsHash.Get(curParent);
MOZ_ASSERT(owned, "IsRelocated flag is out of sync with mARIAOwnsHash");
owned->RemoveElement(aChild);
if (owned->Length() == 0) {
mARIAOwnsHash.Remove(curParent);
}
}
NotificationController::MoveGuard mguard(mNotificationController);
@ -2327,10 +2298,19 @@ DocAccessible::UncacheChildrenInSubtree(Accessible* aRoot)
aRoot->mStateFlags |= eIsNotInDocument;
RemoveDependentIDsFor(aRoot);
nsTArray<RefPtr<Accessible> >* owned = mARIAOwnsHash.Get(aRoot);
uint32_t count = aRoot->ContentChildCount();
for (uint32_t idx = 0; idx < count; idx++) {
Accessible* child = aRoot->ContentChildAt(idx);
if (child->IsRelocated()) {
MOZ_ASSERT(owned, "IsRelocated flag is out of sync with mARIAOwnsHash");
owned->RemoveElement(child);
if (owned->Length() == 0) {
mARIAOwnsHash.Remove(aRoot);
}
}
// Removing this accessible from the document doesn't mean anything about
// accessibles for subdocuments, so skip removing those from the tree.
if (!child->IsDoc()) {

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

@ -344,7 +344,7 @@ public:
/**
* Update the tree on content removal.
*/
void ContentRemoved(Accessible* aContent);
void ContentRemoved(Accessible* aAccessible);
void ContentRemoved(nsIContent* aContentNode);
/**
@ -504,11 +504,6 @@ protected:
*/
void ProcessInvalidationList();
/**
* Validates all aria-owns connections and updates the tree accordingly.
*/
void ValidateARIAOwned();
/**
* Steals or puts back accessible subtrees.
*/

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

@ -47,7 +47,7 @@ function Buffer(subject, encoding /*, bufferLength */) {
let buffer = new Uint8Array(subject > 0 ? Math.floor(subject) : 0);
return buffer;
} catch (e) {
if (/size and count too large/.test(e.message) ||
if (/invalid array length/.test(e.message) ||
/invalid arguments/.test(e.message))
throw new RangeError('Could not instantiate buffer: size of buffer may be too large');
else

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

@ -216,8 +216,6 @@ DEFAULT_TEST_PREFS = {
'layout.css.report_errors': True,
'layout.css.grid.enabled': True,
'layout.spammy_warnings.enabled': False,
# Make sure the disk cache doesn't get auto disabled
'network.http.bypass-cachelock-threshold': 200000,
# Always use network provider for geolocation tests
# so we bypass the OSX dialog raised by the corelocation provider
'geo.provider.testing': True,

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

@ -31,7 +31,6 @@
"layout.css.report_errors": true,
"layout.css.grid.enabled": true,
"layout.spammy_warnings.enabled": false,
"network.http.bypass-cachelock-threshold": 200000,
"geo.provider.testing": true,
"browser.pagethumbnails.capturing_disabled": true,
"browser.download.panel.shown": true,

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

@ -145,6 +145,7 @@ function testRegister(assert, text) {
var channel = ios.newChannelFromURIWithLoadInfo(uri, aLoadInfo);
channel.originalURI = aURI;
aLoadInfo.resultPrincipalURI = aURI;
return channel;
},
getURIFlags: function(aURI) {

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

@ -17,6 +17,16 @@ add_task(function* test_toolbar_element_restyles_on_activation() {
let win2 = yield BrowserTestUtils.openNewBrowserWindow();
yield new Promise(resolve => waitForFocus(resolve, win2));
// Flush any pending styles before we take a measurement.
win1.getComputedStyle(win1.document.firstElementChild);
win2.getComputedStyle(win2.document.firstElementChild);
// Clear the focused element from each window so that when
// we raise them, the focus of the element doesn't cause an
// unrelated style flush.
Services.focus.clearFocus(win1);
Services.focus.clearFocus(win2);
let utils1 = SpecialPowers.getDOMWindowUtils(win1);
restyles.win1.initial = utils1.elementsRestyled;

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

@ -172,27 +172,23 @@ AboutRedirector::NewChannel(nsIURI* aURI,
rv = NS_NewURI(getter_AddRefs(tempURI), url);
NS_ENSURE_SUCCESS(rv, rv);
// If tempURI links to an external URI (i.e. something other than
// chrome:// or resource://) then set the LOAD_REPLACE flag on the
// channel which forces the channel owner to reflect the displayed
// URL rather then being the systemPrincipal.
// If tempURI links to an internal URI (chrome://, resource://)
// then set the result principal URL on the channel's load info.
// Otherwise, we leave it null which forces the channel principal
// to reflect the displayed URL rather than being the systemPrincipal.
bool isUIResource = false;
rv = NS_URIChainHasFlags(tempURI, nsIProtocolHandler::URI_IS_UI_RESOURCE,
&isUIResource);
NS_ENSURE_SUCCESS(rv, rv);
nsLoadFlags loadFlags = isUIResource
? static_cast<nsLoadFlags>(nsIChannel::LOAD_NORMAL)
: static_cast<nsLoadFlags>(nsIChannel::LOAD_REPLACE);
rv = NS_NewChannelInternal(getter_AddRefs(tempChannel),
tempURI,
aLoadInfo,
nullptr, // aLoadGroup
nullptr, // aCallbacks
loadFlags);
aLoadInfo);
NS_ENSURE_SUCCESS(rv, rv);
if (isUIResource) {
aLoadInfo->SetResultPrincipalURI(aURI);
}
tempChannel->SetOriginalURI(aURI);
NS_ADDREF(*result = tempChannel);

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

@ -253,6 +253,7 @@ FeedConverter.prototype = {
let aboutFeedsURI = ios.newURI("about:feeds");
chromeChannel = ios.newChannelFromURIWithLoadInfo(aboutFeedsURI, loadInfo);
chromeChannel.originalURI = result.uri;
loadInfo.resultPrincipalURI = result.uri;
// carry the origin attributes from the channel that loaded the feed.
chromeChannel.owner =
@ -560,10 +561,12 @@ GenericProtocolHandler.prototype = {
const schemeId = this._getTelemetrySchemeId();
Services.telemetry.getHistogramById("FEED_PROTOCOL_USAGE").add(schemeId);
if (channel instanceof Components.interfaces.nsIHttpChannel)
if (channel instanceof Components.interfaces.nsIHttpChannel) {
// Set this so we know this is supposed to be a feed
channel.setRequestHeader("X-Moz-Is-Feed", "1", false);
}
channel.originalURI = aUri;
aLoadInfo.resultPrincipalURI = aUri;
return channel;
},

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

@ -26,6 +26,7 @@ let TestAboutPage = {
let channel = Services.io.newChannelFromURIWithLoadInfo(newURI,
aLoadInfo);
channel.originalURI = aURI;
aLoadInfo.resultPrincipalURI = aURI;
return channel;
},

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

@ -1,5 +1,5 @@
This is the PDF.js project output, https://github.com/mozilla/pdf.js
Current extension version is: 1.8.290
Current extension version is: 1.8.314
Taken from upstream commit: 60c232bc
Taken from upstream commit: 3adda80f

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

@ -1003,6 +1003,7 @@ PdfStreamConverter.prototype = {
// Keep the URL the same so the browser sees it as the same.
channel.originalURI = aRequest.URI;
channel.loadInfo.resultPrincipalURI = aRequest.loadInfo.resultPrincipalURI;
channel.loadGroup = aRequest.loadGroup;
channel.loadInfo.originAttributes = aRequest.loadInfo.originAttributes;

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

@ -992,7 +992,7 @@ function MessageHandler(sourceName, targetName, comObj) {
this.postMessageTransfers = true;
var callbacksCapabilities = this.callbacksCapabilities = Object.create(null);
var ah = this.actionHandler = Object.create(null);
this._onComObjOnMessage = function messageHandlerComObjOnMessage(event) {
this._onComObjOnMessage = event => {
var data = event.data;
if (data.targetName !== this.sourceName) {
return;
@ -1043,7 +1043,7 @@ function MessageHandler(sourceName, targetName, comObj) {
} else {
error('Unknown action from worker: ' + data.action);
}
}.bind(this);
};
comObj.addEventListener('message', this._onComObjOnMessage);
}
MessageHandler.prototype = {
@ -1225,14 +1225,14 @@ var DOMCMapReaderFactory = function DOMCMapReaderFactoryClosure() {
if (!name) {
return Promise.reject(new Error('CMap name must be specified.'));
}
return new Promise(function (resolve, reject) {
return new Promise((resolve, reject) => {
var url = this.baseUrl + name + (this.isCompressed ? '.bcmap' : '');
var request = new XMLHttpRequest();
request.open('GET', url, true);
if (this.isCompressed) {
request.responseType = 'arraybuffer';
}
request.onreadystatechange = function () {
request.onreadystatechange = () => {
if (request.readyState !== XMLHttpRequest.DONE) {
return;
}
@ -1252,9 +1252,9 @@ var DOMCMapReaderFactory = function DOMCMapReaderFactoryClosure() {
}
}
reject(new Error('Unable to load ' + (this.isCompressed ? 'binary ' : '') + 'CMap at: ' + url));
}.bind(this);
};
request.send(null);
}.bind(this));
});
}
};
return DOMCMapReaderFactory;
@ -1598,12 +1598,11 @@ var LinkAnnotationElement = function LinkAnnotationElementClosure() {
this.container.appendChild(link);
return this.container;
},
_bindLink: function LinkAnnotationElement_bindLink(link, destination) {
var self = this;
_bindLink(link, destination) {
link.href = this.linkService.getDestinationHash(destination);
link.onclick = function () {
link.onclick = () => {
if (destination) {
self.linkService.navigateTo(destination);
this.linkService.navigateTo(destination);
}
return false;
};
@ -1611,11 +1610,10 @@ var LinkAnnotationElement = function LinkAnnotationElementClosure() {
link.className = 'internalLink';
}
},
_bindNamedAction: function LinkAnnotationElement_bindNamedAction(link, action) {
var self = this;
_bindNamedAction(link, action) {
link.href = this.linkService.getAnchorUrl('');
link.onclick = function () {
self.linkService.executeNamedAction(action);
link.onclick = () => {
this.linkService.executeNamedAction(action);
return false;
};
link.className = 'internalLink';
@ -2082,7 +2080,7 @@ exports.AnnotationLayer = AnnotationLayer;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.build = exports.version = exports._UnsupportedManager = exports.PDFPageProxy = exports.PDFDocumentProxy = exports.PDFWorker = exports.PDFDataRangeTransport = exports.getDocument = undefined;
exports.build = exports.version = exports._UnsupportedManager = exports.PDFPageProxy = exports.PDFDocumentProxy = exports.PDFWorker = exports.PDFDataRangeTransport = exports.LoopbackPort = exports.getDocument = undefined;
var _util = __w_pdfjs_require__(0);
@ -2239,13 +2237,13 @@ var PDFDocumentLoadingTask = function PDFDocumentLoadingTaskClosure() {
destroy() {
this.destroyed = true;
var transportDestroyed = !this._transport ? Promise.resolve() : this._transport.destroy();
return transportDestroyed.then(function () {
return transportDestroyed.then(() => {
this._transport = null;
if (this._worker) {
this._worker.destroy();
this._worker = null;
}
}.bind(this));
});
},
then: function PDFDocumentLoadingTask_then(onFulfilled, onRejected) {
return this.promise.then.apply(this.promise, arguments);
@ -2279,20 +2277,20 @@ var PDFDataRangeTransport = function pdfDataRangeTransportClosure() {
}
},
onDataProgress: function PDFDataRangeTransport_onDataProgress(loaded) {
this._readyCapability.promise.then(function () {
this._readyCapability.promise.then(() => {
var listeners = this._progressListeners;
for (var i = 0, n = listeners.length; i < n; ++i) {
listeners[i](loaded);
}
}.bind(this));
});
},
onDataProgressiveRead: function PDFDataRangeTransport_onDataProgress(chunk) {
this._readyCapability.promise.then(function () {
this._readyCapability.promise.then(() => {
var listeners = this._progressiveReadListeners;
for (var i = 0, n = listeners.length; i < n; ++i) {
listeners[i](chunk);
}
}.bind(this));
});
},
transportReady: function PDFDataRangeTransport_transportReady() {
this._readyCapability.resolve();
@ -2431,6 +2429,23 @@ var PDFPageProxy = function PDFPageProxyClosure() {
renderInteractiveForms: params.renderInteractiveForms === true
});
}
var complete = error => {
var i = intentState.renderTasks.indexOf(internalRenderTask);
if (i >= 0) {
intentState.renderTasks.splice(i, 1);
}
if (this.cleanupAfterRender) {
this.pendingCleanup = true;
}
this._tryCleanup();
if (error) {
internalRenderTask.capability.reject(error);
} else {
internalRenderTask.capability.resolve();
}
stats.timeEnd('Rendering');
stats.timeEnd('Overall');
};
var internalRenderTask = new InternalRenderTask(complete, params, this.objs, this.commonObjs, intentState.operatorList, this.pageNumber, canvasFactory);
internalRenderTask.useRequestAnimationFrame = renderingIntent !== 'print';
if (!intentState.renderTasks) {
@ -2442,35 +2457,15 @@ var PDFPageProxy = function PDFPageProxyClosure() {
(0, _util.deprecated)('render is used with continueCallback parameter');
renderTask.onContinue = params.continueCallback;
}
var self = this;
intentState.displayReadyCapability.promise.then(function pageDisplayReadyPromise(transparency) {
if (self.pendingCleanup) {
intentState.displayReadyCapability.promise.then(transparency => {
if (this.pendingCleanup) {
complete();
return;
}
stats.time('Rendering');
internalRenderTask.initializeGraphics(transparency);
internalRenderTask.operatorListChanged();
}, function pageDisplayReadPromiseError(reason) {
complete(reason);
});
function complete(error) {
var i = intentState.renderTasks.indexOf(internalRenderTask);
if (i >= 0) {
intentState.renderTasks.splice(i, 1);
}
if (self.cleanupAfterRender) {
self.pendingCleanup = true;
}
self._tryCleanup();
if (error) {
internalRenderTask.capability.reject(error);
} else {
internalRenderTask.capability.resolve();
}
stats.timeEnd('Rendering');
stats.timeEnd('Overall');
}
}, complete);
return renderTask;
},
getOperatorList: function PDFPageProxy_getOperatorList() {
@ -2583,6 +2578,74 @@ var PDFPageProxy = function PDFPageProxyClosure() {
};
return PDFPageProxy;
}();
class LoopbackPort {
constructor(defer) {
this._listeners = [];
this._defer = defer;
this._deferred = Promise.resolve(undefined);
}
postMessage(obj, transfers) {
function cloneValue(value) {
if (typeof value !== 'object' || value === null) {
return value;
}
if (cloned.has(value)) {
return cloned.get(value);
}
var result;
var buffer;
if ((buffer = value.buffer) && (0, _util.isArrayBuffer)(buffer)) {
var transferable = transfers && transfers.indexOf(buffer) >= 0;
if (value === buffer) {
result = value;
} else if (transferable) {
result = new value.constructor(buffer, value.byteOffset, value.byteLength);
} else {
result = new value.constructor(value);
}
cloned.set(value, result);
return result;
}
result = (0, _util.isArray)(value) ? [] : {};
cloned.set(value, result);
for (var i in value) {
var desc,
p = value;
while (!(desc = Object.getOwnPropertyDescriptor(p, i))) {
p = Object.getPrototypeOf(p);
}
if (typeof desc.value === 'undefined' || typeof desc.value === 'function') {
continue;
}
result[i] = cloneValue(desc.value);
}
return result;
}
if (!this._defer) {
this._listeners.forEach(function (listener) {
listener.call(this, { data: obj });
}, this);
return;
}
var cloned = new WeakMap();
var e = { data: cloneValue(obj) };
this._deferred.then(() => {
this._listeners.forEach(function (listener) {
listener.call(this, e);
}, this);
});
}
addEventListener(name, listener) {
this._listeners.push(listener);
}
removeEventListener(name, listener) {
var i = this._listeners.indexOf(listener);
this._listeners.splice(i, 1);
}
terminate() {
this._listeners = [];
}
}
var PDFWorker = function PDFWorkerClosure() {
var nextFakeWorkerId = 0;
function getWorkerSrc() {
@ -2609,74 +2672,6 @@ var PDFWorker = function PDFWorkerClosure() {
loader(fakeWorkerFilesLoadedCapability.resolve);
return fakeWorkerFilesLoadedCapability.promise;
}
function FakeWorkerPort(defer) {
this._listeners = [];
this._defer = defer;
this._deferred = Promise.resolve(undefined);
}
FakeWorkerPort.prototype = {
postMessage(obj, transfers) {
function cloneValue(value) {
if (typeof value !== 'object' || value === null) {
return value;
}
if (cloned.has(value)) {
return cloned.get(value);
}
var result;
var buffer;
if ((buffer = value.buffer) && (0, _util.isArrayBuffer)(buffer)) {
var transferable = transfers && transfers.indexOf(buffer) >= 0;
if (value === buffer) {
result = value;
} else if (transferable) {
result = new value.constructor(buffer, value.byteOffset, value.byteLength);
} else {
result = new value.constructor(value);
}
cloned.set(value, result);
return result;
}
result = (0, _util.isArray)(value) ? [] : {};
cloned.set(value, result);
for (var i in value) {
var desc,
p = value;
while (!(desc = Object.getOwnPropertyDescriptor(p, i))) {
p = Object.getPrototypeOf(p);
}
if (typeof desc.value === 'undefined' || typeof desc.value === 'function') {
continue;
}
result[i] = cloneValue(desc.value);
}
return result;
}
if (!this._defer) {
this._listeners.forEach(function (listener) {
listener.call(this, { data: obj });
}, this);
return;
}
var cloned = new WeakMap();
var e = { data: cloneValue(obj) };
this._deferred.then(function () {
this._listeners.forEach(function (listener) {
listener.call(this, e);
}, this);
}.bind(this));
},
addEventListener(name, listener) {
this._listeners.push(listener);
},
removeEventListener(name, listener) {
var i = this._listeners.indexOf(listener);
this._listeners.splice(i, 1);
},
terminate() {
this._listeners = [];
}
};
function createCDNWrapper(url) {
var wrapper = 'importScripts(\'' + url + '\');';
return URL.createObjectURL(new Blob([wrapper]));
@ -2716,7 +2711,7 @@ var PDFWorker = function PDFWorkerClosure() {
try {
var worker = new Worker(workerSrc);
var messageHandler = new _util.MessageHandler('main', 'worker', worker);
var terminateEarly = function () {
var terminateEarly = () => {
worker.removeEventListener('error', onWorkerError);
messageHandler.destroy();
worker.terminate();
@ -2725,14 +2720,14 @@ var PDFWorker = function PDFWorkerClosure() {
} else {
this._setupFakeWorker();
}
}.bind(this);
var onWorkerError = function (event) {
};
var onWorkerError = () => {
if (!this._webWorker) {
terminateEarly();
}
}.bind(this);
};
worker.addEventListener('error', onWorkerError);
messageHandler.on('test', function PDFWorker_test(data) {
messageHandler.on('test', data => {
worker.removeEventListener('error', onWorkerError);
if (this.destroyed) {
terminateEarly();
@ -2753,14 +2748,14 @@ var PDFWorker = function PDFWorkerClosure() {
messageHandler.destroy();
worker.terminate();
}
}.bind(this));
});
messageHandler.on('console_log', function (data) {
console.log.apply(console, data);
});
messageHandler.on('console_error', function (data) {
console.error.apply(console, data);
});
messageHandler.on('ready', function (data) {
messageHandler.on('ready', data => {
worker.removeEventListener('error', onWorkerError);
if (this.destroyed) {
terminateEarly();
@ -2771,7 +2766,7 @@ var PDFWorker = function PDFWorkerClosure() {
} catch (e) {
this._setupFakeWorker();
}
}.bind(this));
});
var sendTest = function () {
var postMessageTransfers = (0, _dom_utils.getDefaultSetting)('postMessageTransfers') && !isPostMessageTransfersDisabled;
var testObj = new Uint8Array([postMessageTransfers ? 255 : 0]);
@ -2796,13 +2791,13 @@ var PDFWorker = function PDFWorkerClosure() {
(0, _util.warn)('Setting up fake worker.');
isWorkerDisabled = true;
}
setupFakeWorkerGlobal().then(function (WorkerMessageHandler) {
setupFakeWorkerGlobal().then(WorkerMessageHandler => {
if (this.destroyed) {
this._readyCapability.reject(new Error('Worker was destroyed'));
return;
}
var isTypedArraysPresent = Uint8Array !== Float32Array;
var port = new FakeWorkerPort(isTypedArraysPresent);
var port = new LoopbackPort(isTypedArraysPresent);
this._port = port;
var id = 'fake' + nextFakeWorkerId++;
var workerHandler = new _util.MessageHandler(id + '_worker', id, port);
@ -2810,7 +2805,7 @@ var PDFWorker = function PDFWorkerClosure() {
var messageHandler = new _util.MessageHandler(id, id + '_worker', port);
this._messageHandler = messageHandler;
this._readyCapability.resolve();
}.bind(this));
});
},
destroy: function PDFWorker_destroy() {
this.destroyed = true;
@ -2864,20 +2859,19 @@ var WorkerTransport = function WorkerTransportClosure() {
});
this.pageCache = [];
this.pagePromises = [];
var self = this;
var terminated = this.messageHandler.sendWithPromise('Terminate', null);
waitOn.push(terminated);
Promise.all(waitOn).then(function () {
self.fontLoader.clear();
if (self.pdfDataRangeTransport) {
self.pdfDataRangeTransport.abort();
self.pdfDataRangeTransport = null;
Promise.all(waitOn).then(() => {
this.fontLoader.clear();
if (this.pdfDataRangeTransport) {
this.pdfDataRangeTransport.abort();
this.pdfDataRangeTransport = null;
}
if (self.messageHandler) {
self.messageHandler.destroy();
self.messageHandler = null;
if (this.messageHandler) {
this.messageHandler.destroy();
this.messageHandler = null;
}
self.destroyCapability.resolve();
this.destroyCapability.resolve();
}, this.destroyCapability.reject);
return this.destroyCapability.promise;
},
@ -2991,9 +2985,10 @@ var WorkerTransport = function WorkerTransportClosure() {
disableFontFace: (0, _dom_utils.getDefaultSetting)('disableFontFace'),
fontRegistry
});
this.fontLoader.bind([font], function fontReady(fontObjs) {
var fontReady = fontObjs => {
this.commonObjs.resolve(id, font);
}.bind(this));
};
this.fontLoader.bind([font], fontReady);
break;
case 'FontPath':
this.commonObjs.resolve(id, data[2]);
@ -3140,14 +3135,14 @@ var WorkerTransport = function WorkerTransportClosure() {
if (pageIndex in this.pagePromises) {
return this.pagePromises[pageIndex];
}
var promise = this.messageHandler.sendWithPromise('GetPage', { pageIndex }).then(function (pageInfo) {
var promise = this.messageHandler.sendWithPromise('GetPage', { pageIndex }).then(pageInfo => {
if (this.destroyed) {
throw new Error('Transport destroyed');
}
var page = new PDFPageProxy(pageIndex, pageInfo, this);
this.pageCache[pageIndex] = page;
return page;
}.bind(this));
});
this.pagePromises[pageIndex] = promise;
return promise;
},
@ -3192,7 +3187,7 @@ var WorkerTransport = function WorkerTransportClosure() {
return this.messageHandler.sendWithPromise('GetStats', null);
},
startCleanup: function WorkerTransport_startCleanup() {
this.messageHandler.sendWithPromise('Cleanup', null).then(function endCleanup() {
this.messageHandler.sendWithPromise('Cleanup', null).then(() => {
for (var i = 0, ii = this.pageCache.length; i < ii; i++) {
var page = this.pageCache[i];
if (page) {
@ -3201,7 +3196,7 @@ var WorkerTransport = function WorkerTransportClosure() {
}
this.commonObjs.clear();
this.fontLoader.clear();
}.bind(this));
});
}
};
return WorkerTransport;
@ -3391,10 +3386,11 @@ var _UnsupportedManager = function UnsupportedManagerClosure() {
}();
var version, build;
{
exports.version = version = '1.8.290';
exports.build = build = '60c232bc';
exports.version = version = '1.8.314';
exports.build = build = '3adda80f';
}
exports.getDocument = getDocument;
exports.LoopbackPort = LoopbackPort;
exports.PDFDataRangeTransport = PDFDataRangeTransport;
exports.PDFWorker = PDFWorker;
exports.PDFDocumentProxy = PDFDocumentProxy;
@ -3845,10 +3841,9 @@ var renderTextLayer = function renderTextLayerClosure() {
if (!timeout) {
render(this);
} else {
var self = this;
this._renderTimer = setTimeout(function () {
render(self);
self._renderTimer = null;
this._renderTimer = setTimeout(() => {
render(this);
this._renderTimer = null;
}, timeout);
}
},
@ -4394,8 +4389,8 @@ if (!_util.globalScope.PDFJS) {
}
var PDFJS = _util.globalScope.PDFJS;
{
PDFJS.version = '1.8.290';
PDFJS.build = '60c232bc';
PDFJS.version = '1.8.314';
PDFJS.build = '3adda80f';
}
PDFJS.pdfBug = false;
if (PDFJS.verbosity !== undefined) {
@ -4458,6 +4453,7 @@ PDFJS.isEvalSupported = PDFJS.isEvalSupported === undefined ? true : PDFJS.isEva
PDFJS.pdfjsNext = PDFJS.pdfjsNext === undefined ? false : PDFJS.pdfjsNext;
;
PDFJS.getDocument = _api.getDocument;
PDFJS.LoopbackPort = _api.LoopbackPort;
PDFJS.PDFDataRangeTransport = _api.PDFDataRangeTransport;
PDFJS.PDFWorker = _api.PDFWorker;
PDFJS.hasCanvasTypedArrays = true;
@ -5733,7 +5729,7 @@ var CanvasGraphics = function CanvasGraphicsClosure() {
var spacing = (glyph.isSpace ? wordSpacing : 0) + charSpacing;
var operatorList = font.charProcOperatorList[glyph.operatorListId];
if (!operatorList) {
(0, _util.warn)('Type3 character \"' + glyph.operatorListId + '\" is not available');
(0, _util.warn)(`Type3 character "${glyph.operatorListId}" is not available.`);
continue;
}
this.processingType3 = glyph;
@ -6708,8 +6704,8 @@ exports.TilingPattern = TilingPattern;
"use strict";
var pdfjsVersion = '1.8.290';
var pdfjsBuild = '60c232bc';
var pdfjsVersion = '1.8.314';
var pdfjsBuild = '3adda80f';
var pdfjsSharedUtil = __w_pdfjs_require__(0);
var pdfjsDisplayGlobal = __w_pdfjs_require__(8);
var pdfjsDisplayAPI = __w_pdfjs_require__(3);
@ -6721,6 +6717,7 @@ exports.PDFJS = pdfjsDisplayGlobal.PDFJS;
exports.build = pdfjsDisplayAPI.build;
exports.version = pdfjsDisplayAPI.version;
exports.getDocument = pdfjsDisplayAPI.getDocument;
exports.LoobpackPort = pdfjsDisplayAPI.LoopbackPort;
exports.PDFDataRangeTransport = pdfjsDisplayAPI.PDFDataRangeTransport;
exports.PDFWorker = pdfjsDisplayAPI.PDFWorker;
exports.renderTextLayer = pdfjsDisplayTextLayer.renderTextLayer;

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

@ -992,7 +992,7 @@ function MessageHandler(sourceName, targetName, comObj) {
this.postMessageTransfers = true;
var callbacksCapabilities = this.callbacksCapabilities = Object.create(null);
var ah = this.actionHandler = Object.create(null);
this._onComObjOnMessage = function messageHandlerComObjOnMessage(event) {
this._onComObjOnMessage = event => {
var data = event.data;
if (data.targetName !== this.sourceName) {
return;
@ -1043,7 +1043,7 @@ function MessageHandler(sourceName, targetName, comObj) {
} else {
error('Unknown action from worker: ' + data.action);
}
}.bind(this);
};
comObj.addEventListener('message', this._onComObjOnMessage);
}
MessageHandler.prototype = {
@ -4669,9 +4669,13 @@ var Lexer = function LexerClosure() {
divideBy = 10;
ch = this.nextChar();
}
if (ch === 0x0A || ch === 0x0D) {
do {
ch = this.nextChar();
} while (ch === 0x0A || ch === 0x0D);
}
if (ch < 0x30 || ch > 0x39) {
error('Invalid number: ' + String.fromCharCode(ch));
return 0;
error(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`);
}
var baseValue = ch - 0x30;
var powerValue = 0;
@ -14556,7 +14560,7 @@ var ChunkedStreamManager = function ChunkedStreamManagerClosure() {
};
rangeReader.read().then(readChunk, reject);
});
promise.then(function (data) {
promise.then(data => {
if (this.aborted) {
return;
}
@ -14564,7 +14568,7 @@ var ChunkedStreamManager = function ChunkedStreamManagerClosure() {
chunk: data,
begin
});
}.bind(this));
});
},
requestAllChunks: function ChunkedStreamManager_requestAllChunks() {
var missingChunks = this.stream.getMissingChunks();
@ -16436,7 +16440,7 @@ var reverseIfRtl = coreUnicode.reverseIfRtl;
var getUnicodeForGlyph = coreUnicode.getUnicodeForGlyph;
var getGlyphsUnicode = coreGlyphList.getGlyphsUnicode;
var PartialEvaluator = function PartialEvaluatorClosure() {
var DefaultPartialEvaluatorOptions = {
const DefaultPartialEvaluatorOptions = {
forceDataSchema: false,
maxImageSize: -1,
disableFontFace: false,
@ -16481,7 +16485,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
var cs = ColorSpace.parse(dict.get('ColorSpace', 'CS'), xref, res);
return (cs.numComps === 1 || cs.numComps === 3) && cs.isDefaultDecode(dict.getArray('Decode', 'D'));
};
function PartialEvaluator(pdfManager, xref, handler, pageIndex, idFactory, fontCache, builtInCMapCache, options) {
function PartialEvaluator({ pdfManager, xref, handler, pageIndex, idFactory, fontCache, builtInCMapCache, options = null }) {
this.pdfManager = pdfManager;
this.xref = xref;
this.handler = handler;
@ -16495,7 +16499,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
if (cachedCMap) {
return Promise.resolve(cachedCMap);
}
return handler.sendWithPromise('FetchBuiltInCMap', { name }).then(data => {
return this.handler.sendWithPromise('FetchBuiltInCMap', { name }).then(data => {
if (data.compressionType !== CMapCompressionType.NONE) {
this.builtInCMapCache[name] = data;
}
@ -16658,7 +16662,13 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
operatorList.addOp(OPS.beginGroup, [groupOptions]);
}
operatorList.addOp(OPS.paintFormXObjectBegin, [matrix, bbox]);
return this.getOperatorList(xobj, task, dict.get('Resources') || resources, operatorList, initialState).then(function () {
return this.getOperatorList({
stream: xobj,
task,
resources: dict.get('Resources') || resources,
operatorList,
initialState
}).then(function () {
operatorList.addOp(OPS.paintFormXObjectEnd, []);
if (group) {
operatorList.addOp(OPS.endGroup, [groupOptions]);
@ -16666,7 +16676,6 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
});
},
buildPaintImageXObject: function PartialEvaluator_buildPaintImageXObject(resources, image, inline, operatorList, cacheKey, imageCache) {
var self = this;
var dict = image.dict;
var w = dict.get('Width', 'W');
var h = dict.get('Height', 'H');
@ -16720,14 +16729,14 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}
var nativeImageDecoder = null;
if (useNativeImageDecoder && (image instanceof JpegStream || mask instanceof JpegStream || softMask instanceof JpegStream)) {
nativeImageDecoder = new NativeImageDecoder(self.xref, resources, self.handler, self.options.forceDataSchema);
nativeImageDecoder = new NativeImageDecoder(this.xref, resources, this.handler, this.options.forceDataSchema);
}
PDFImage.buildImage(self.handler, self.xref, resources, image, inline, nativeImageDecoder).then(function (imageObj) {
PDFImage.buildImage(this.handler, this.xref, resources, image, inline, nativeImageDecoder).then(imageObj => {
var imgData = imageObj.createImageData(false);
self.handler.send('obj', [objId, self.pageIndex, 'Image', imgData], [imgData.data.buffer]);
}).then(undefined, function (reason) {
this.handler.send('obj', [objId, this.pageIndex, 'Image', imgData], [imgData.data.buffer]);
}).catch(reason => {
warn('Unable to decode image: ' + reason);
self.handler.send('obj', [objId, self.pageIndex, 'Image', null]);
this.handler.send('obj', [objId, this.pageIndex, 'Image', null]);
});
operatorList.addOp(OPS.paintImageXObject, args);
if (cacheKey) {
@ -16761,7 +16770,12 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
var tilingOpList = new OperatorList();
var resourcesArray = [patternDict.get('Resources'), resources];
var patternResources = Dict.merge(this.xref, resourcesArray);
return this.getOperatorList(pattern, task, patternResources, tilingOpList).then(function () {
return this.getOperatorList({
stream: pattern,
task,
resources: patternResources,
operatorList: tilingOpList
}).then(function () {
operatorList.addDependencies(tilingOpList.dependencies);
operatorList.addOp(fn, getTilingPatternIR({
fnArray: tilingOpList.fnArray,
@ -16775,20 +16789,19 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
fontArgs = fontArgs.slice();
fontName = fontArgs[0].name;
}
var self = this;
return this.loadFont(fontName, fontRef, resources).then(function (translated) {
return this.loadFont(fontName, fontRef, resources).then(translated => {
if (!translated.font.isType3Font) {
return translated;
}
return translated.loadType3Data(self, resources, operatorList, task).then(function () {
return translated.loadType3Data(this, resources, operatorList, task).then(function () {
return translated;
}, function (reason) {
self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
}).catch(reason => {
this.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
return new TranslatedFont('g_font_error', new ErrorFont('Type3 font load error: ' + reason), translated.font);
});
}).then(function (translated) {
}).then(translated => {
state.font = translated.font;
translated.send(self.handler);
translated.send(this.handler);
return translated.loadedName;
});
},
@ -16797,12 +16810,12 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
var glyphs = font.charsToGlyphs(chars);
var isAddToPathSet = !!(state.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
if (font.data && (isAddToPathSet || this.options.disableFontFace)) {
var buildPath = function (fontChar) {
var buildPath = fontChar => {
if (!font.renderer.hasBuiltPath(fontChar)) {
var path = font.renderer.getPathJs(fontChar);
this.handler.send('commonobj', [font.loadedName + '_path_' + fontChar, 'FontPath', path]);
}
}.bind(this);
};
for (var i = 0, ii = glyphs.length; i < ii; i++) {
var glyph = glyphs[i];
buildPath(glyph.fontChar);
@ -16817,11 +16830,10 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
setGState: function PartialEvaluator_setGState(resources, gState, operatorList, task, stateManager) {
var gStateObj = [];
var gStateKeys = gState.getKeys();
var self = this;
var promise = Promise.resolve();
for (var i = 0, ii = gStateKeys.length; i < ii; i++) {
var key = gStateKeys[i];
var value = gState.get(key);
let key = gStateKeys[i];
let value = gState.get(key);
switch (key) {
case 'Type':
break;
@ -16837,8 +16849,8 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
gStateObj.push([key, value]);
break;
case 'Font':
promise = promise.then(function () {
return self.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
promise = promise.then(() => {
return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
operatorList.addDependency(loadedName);
gStateObj.push([key, [loadedName, value[1]]]);
});
@ -16853,9 +16865,9 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
break;
}
if (isDict(value)) {
promise = promise.then(function (dict) {
return self.handleSMask(dict, resources, operatorList, task, stateManager);
}.bind(this, value));
promise = promise.then(() => {
return this.handleSMask(value, resources, operatorList, task, stateManager);
});
gStateObj.push([key, true]);
} else {
warn('Unsupported SMask type');
@ -16965,15 +16977,14 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
} catch (e) {
translatedPromise = Promise.reject(e);
}
var self = this;
translatedPromise.then(function (translatedFont) {
if (translatedFont.fontType !== undefined) {
var xrefFontStats = xref.stats.fontTypes;
xrefFontStats[translatedFont.fontType] = true;
}
fontCapability.resolve(new TranslatedFont(font.loadedName, translatedFont, font));
}, function (reason) {
self.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
}).catch(reason => {
this.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.font });
try {
var descriptor = preEvaluatedFont.descriptor;
var fontFile3 = descriptor && descriptor.get('FontFile3');
@ -17020,15 +17031,16 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
operatorList.addOp(fn, args);
return Promise.resolve();
},
getOperatorList: function PartialEvaluator_getOperatorList(stream, task, resources, operatorList, initialState) {
getOperatorList({ stream, task, resources, operatorList, initialState = null }) {
resources = resources || Dict.empty;
initialState = initialState || new EvalState();
assert(operatorList, 'getOperatorList: missing "operatorList" parameter');
var self = this;
var xref = this.xref;
var imageCache = Object.create(null);
assert(operatorList);
resources = resources || Dict.empty;
var xobjs = resources.get('XObject') || Dict.empty;
var patterns = resources.get('Pattern') || Dict.empty;
var stateManager = new StateManager(initialState || new EvalState());
var stateManager = new StateManager(initialState);
var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
var timeSlotManager = new TimeSlotManager();
function closePendingRestoreOPS(argument) {
@ -17273,7 +17285,7 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}
closePendingRestoreOPS();
resolve();
}).catch(function (reason) {
}).catch(reason => {
if (this.options.ignoreErrors) {
this.handler.send('UnsupportedFeature', { featureId: UNSUPPORTED_FEATURES.unknown });
warn('getOperatorList - ignoring errors during task: ' + task.name);
@ -17281,9 +17293,10 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
return;
}
throw reason;
}.bind(this));
});
},
getTextContent: function PartialEvaluator_getTextContent(stream, task, resources, stateManager, normalizeWhitespace, combineTextItems) {
getTextContent({ stream, task, resources, stateManager = null, normalizeWhitespace = false, combineTextItems = false }) {
resources = resources || Dict.empty;
stateManager = stateManager || new StateManager(new TextState());
var WhitespaceRegexp = /\s/g;
var textContent = {
@ -17312,7 +17325,6 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
var MULTI_SPACE_FACTOR_MAX = 4;
var self = this;
var xref = this.xref;
resources = xref.fetchIfRef(resources) || Dict.empty;
var xobjs = null;
var xobjsCache = Object.create(null);
var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
@ -17660,7 +17672,14 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
if (isArray(matrix) && matrix.length === 6) {
xObjStateManager.transform(matrix);
}
next(self.getTextContent(xobj, task, xobj.dict.get('Resources') || resources, xObjStateManager, normalizeWhitespace, combineTextItems).then(function (formTextContent) {
next(self.getTextContent({
stream: xobj,
task,
resources: xobj.dict.get('Resources') || resources,
stateManager: xObjStateManager,
normalizeWhitespace,
combineTextItems
}).then(function (formTextContent) {
Util.appendToArray(textContent.items, formTextContent.items);
Util.extendObj(textContent.styles, formTextContent.styles);
xobjsCache.key = name;
@ -17694,14 +17713,14 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
}
flushTextContentItem();
resolve(textContent);
}).catch(function (reason) {
}).catch(reason => {
if (this.options.ignoreErrors) {
warn('getTextContent - ignoring errors during task: ' + task.name);
flushTextContentItem();
return textContent;
}
throw reason;
}.bind(this));
});
},
extractDataStructures: function PartialEvaluator_extractDataStructures(dict, baseDict, properties) {
var xref = this.xref;
@ -17777,10 +17796,10 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
properties.baseEncodingName = baseEncodingName;
properties.hasEncoding = !!baseEncodingName || differences.length > 0;
properties.dict = dict;
return toUnicodePromise.then(function (toUnicode) {
return toUnicodePromise.then(toUnicode => {
properties.toUnicode = toUnicode;
return this.buildToUnicode(properties);
}.bind(this)).then(function (toUnicode) {
}).then(function (toUnicode) {
properties.toUnicode = toUnicode;
return properties;
});
@ -18160,10 +18179,10 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
firstChar: 0,
lastChar: maxCharIndex
};
return this.extractDataStructures(dict, dict, properties).then(function (properties) {
return this.extractDataStructures(dict, dict, properties).then(properties => {
properties.widths = this.buildCharCodeToWidth(metrics.widths, properties);
return new Font(baseFontName, null, properties);
}.bind(this));
});
}
}
var firstChar = dict.get('FirstChar') || 0;
@ -18241,15 +18260,15 @@ var PartialEvaluator = function PartialEvaluatorClosure() {
} else {
cMapPromise = Promise.resolve(undefined);
}
return cMapPromise.then(function () {
return cMapPromise.then(() => {
return this.extractDataStructures(dict, baseDict, properties);
}.bind(this)).then(function (properties) {
}).then(properties => {
this.extractWidths(dict, descriptor, properties);
if (type === 'Type3') {
properties.isType3Font = true;
}
return new Font(fontName.name, fontFile, properties);
}.bind(this));
});
}
};
return PartialEvaluator;
@ -18286,18 +18305,24 @@ var TranslatedFont = function TranslatedFontClosure() {
var charProcKeys = charProcs.getKeys();
var charProcOperatorList = Object.create(null);
for (var i = 0, n = charProcKeys.length; i < n; ++i) {
loadCharProcsPromise = loadCharProcsPromise.then(function (key) {
let key = charProcKeys[i];
loadCharProcsPromise = loadCharProcsPromise.then(function () {
var glyphStream = charProcs.get(key);
var operatorList = new OperatorList();
return type3Evaluator.getOperatorList(glyphStream, task, fontResources, operatorList).then(function () {
return type3Evaluator.getOperatorList({
stream: glyphStream,
task,
resources: fontResources,
operatorList
}).then(function () {
charProcOperatorList[key] = operatorList.getIR();
parentOperatorList.addDependencies(operatorList.dependencies);
}, function (reason) {
warn('Type3 font resource \"' + key + '\" is not available');
}).catch(function (reason) {
warn(`Type3 font resource "${key}" is not available.`);
var operatorList = new OperatorList();
charProcOperatorList[key] = operatorList.getIR();
});
}.bind(this, charProcKeys[i]));
});
}
this.type3Loaded = loadCharProcsPromise.then(function () {
translatedFont.charProcOperatorList = charProcOperatorList;
@ -21604,22 +21629,20 @@ var Catalog = function CatalogClosure() {
this.fontCache.forEach(function (promise) {
promises.push(promise);
});
return Promise.all(promises).then(function (translatedFonts) {
return Promise.all(promises).then(translatedFonts => {
for (var i = 0, ii = translatedFonts.length; i < ii; i++) {
var font = translatedFonts[i].dict;
delete font.translated;
}
this.fontCache.clear();
this.builtInCMapCache = Object.create(null);
}.bind(this));
});
},
getPage: function Catalog_getPage(pageIndex) {
if (!(pageIndex in this.pagePromises)) {
this.pagePromises[pageIndex] = this.getPageDict(pageIndex).then(function (a) {
var dict = a[0];
var ref = a[1];
this.pagePromises[pageIndex] = this.getPageDict(pageIndex).then(([dict, ref]) => {
return this.pageFactory.createPage(pageIndex, dict, ref, this.fontCache, this.builtInCMapCache);
}.bind(this));
});
}
return this.pagePromises[pageIndex];
},
@ -22664,7 +22687,7 @@ var ObjectLoader = function () {
addChildren(currentNode, nodesToVisit);
}
if (pendingRequests.length) {
this.xref.stream.manager.requestRanges(pendingRequests).then(function pendingRequestCallback() {
this.xref.stream.manager.requestRanges(pendingRequests).then(() => {
nodesToVisit = nodesToRevisit;
for (var i = 0; i < nodesToRevisit.length; i++) {
var node = nodesToRevisit[i];
@ -22673,7 +22696,7 @@ var ObjectLoader = function () {
}
}
this._walk(nodesToVisit);
}.bind(this), this.capability.reject);
}, this.capability.reject);
return;
}
this.refSet = null;
@ -23596,7 +23619,7 @@ function setPDFNetworkStreamClass(cls) {
PDFNetworkStream = cls;
}
var WorkerMessageHandler = {
setup: function wphSetup(handler, port) {
setup(handler, port) {
var testMessageProcessed = false;
handler.on('test', function wphSetupTest(data) {
if (testMessageProcessed) {
@ -23632,7 +23655,7 @@ var WorkerMessageHandler = {
return WorkerMessageHandler.createDocumentHandler(data, port);
});
},
createDocumentHandler: function wphCreateDocumentHandler(docParams, port) {
createDocumentHandler(docParams, port) {
var pdfManager;
var terminated = false;
var cancelXHRs = null;
@ -23913,7 +23936,12 @@ var WorkerMessageHandler = {
startWorkerTask(task);
var pageNum = pageIndex + 1;
var start = Date.now();
page.getOperatorList(handler, task, data.intent, data.renderInteractiveForms).then(function (operatorList) {
page.getOperatorList({
handler,
task,
intent: data.intent,
renderInteractiveForms: data.renderInteractiveForms
}).then(function (operatorList) {
finishWorkerTask(task);
info('page=' + pageNum + ' - getOperatorList: time=' + (Date.now() - start) + 'ms, len=' + operatorList.totalLength);
}, function (e) {
@ -23955,7 +23983,12 @@ var WorkerMessageHandler = {
startWorkerTask(task);
var pageNum = pageIndex + 1;
var start = Date.now();
return page.extractTextContent(handler, task, data.normalizeWhitespace, data.combineTextItems).then(function (textContent) {
return page.extractTextContent({
handler,
task,
normalizeWhitespace: data.normalizeWhitespace,
combineTextItems: data.combineTextItems
}).then(function (textContent) {
finishWorkerTask(task);
info('text indexing: page=' + pageNum + ' - time=' + (Date.now() - start) + 'ms');
return textContent;
@ -23995,15 +24028,18 @@ var WorkerMessageHandler = {
docParams = null;
});
return workerHandlerName;
},
initializeFromPort(port) {
var handler = new MessageHandler('worker', 'main', port);
WorkerMessageHandler.setup(handler, port);
handler.send('ready', null);
}
};
function initializeWorker() {
var handler = new MessageHandler('worker', 'main', self);
WorkerMessageHandler.setup(handler, self);
handler.send('ready', null);
function isMessagePort(maybePort) {
return typeof maybePort.postMessage === 'function' && 'onmessage' in maybePort;
}
if (typeof window === 'undefined' && !isNodeJS()) {
initializeWorker();
if (typeof window === 'undefined' && !isNodeJS() && typeof self !== 'undefined' && isMessagePort(self)) {
WorkerMessageHandler.initializeFromPort(self);
}
exports.setPDFNetworkStreamClass = setPDFNetworkStreamClass;
exports.WorkerTask = WorkerTask;
@ -24270,18 +24306,15 @@ var Annotation = function AnnotationClosure() {
this.data.contents = stringToPDFString(dict.get('Contents') || '');
},
loadResources: function Annotation_loadResources(keys) {
return new Promise(function (resolve, reject) {
this.appearance.dict.getAsync('Resources').then(function (resources) {
if (!resources) {
resolve();
return;
}
var objectLoader = new ObjectLoader(resources.map, keys, resources.xref);
objectLoader.load().then(function () {
resolve(resources);
}, reject);
}, reject);
}.bind(this));
return this.appearance.dict.getAsync('Resources').then(resources => {
if (!resources) {
return;
}
var objectLoader = new ObjectLoader(resources.map, keys, resources.xref);
return objectLoader.load().then(function () {
return resources;
});
});
},
getOperatorList: function Annotation_getOperatorList(evaluator, task, renderForms) {
if (!this.appearance) {
@ -24293,13 +24326,17 @@ var Annotation = function AnnotationClosure() {
var bbox = appearanceDict.getArray('BBox') || [0, 0, 1, 1];
var matrix = appearanceDict.getArray('Matrix') || [1, 0, 0, 1, 0, 0];
var transform = getTransformMatrix(data.rect, bbox, matrix);
var self = this;
return resourcesPromise.then(function (resources) {
return resourcesPromise.then(resources => {
var opList = new OperatorList();
opList.addOp(OPS.beginAnnotation, [data.rect, transform, matrix]);
return evaluator.getOperatorList(self.appearance, task, resources, opList).then(function () {
return evaluator.getOperatorList({
stream: this.appearance,
task,
resources,
operatorList: opList
}).then(() => {
opList.addOp(OPS.endAnnotation, []);
self.appearance.reset();
this.appearance.reset();
return opList;
});
});
@ -24464,7 +24501,12 @@ var TextWidgetAnnotation = function TextWidgetAnnotationClosure() {
return Promise.resolve(operatorList);
}
var stream = new Stream(stringToBytes(this.data.defaultAppearance));
return evaluator.getOperatorList(stream, task, this.fieldResources, operatorList).then(function () {
return evaluator.getOperatorList({
stream,
task,
resources: this.fieldResources,
operatorList
}).then(function () {
return operatorList;
});
}
@ -25810,34 +25852,43 @@ var Page = function PageClosure() {
if (!this.resourcesPromise) {
this.resourcesPromise = this.pdfManager.ensure(this, 'resources');
}
return this.resourcesPromise.then(function resourceSuccess() {
return this.resourcesPromise.then(() => {
var objectLoader = new ObjectLoader(this.resources.map, keys, this.xref);
return objectLoader.load();
}.bind(this));
});
},
getOperatorList: function Page_getOperatorList(handler, task, intent, renderInteractiveForms) {
var self = this;
var pdfManager = this.pdfManager;
var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
getOperatorList({ handler, task, intent, renderInteractiveForms }) {
var contentStreamPromise = this.pdfManager.ensure(this, 'getContentStream');
var resourcesPromise = this.loadResources(['ExtGState', 'ColorSpace', 'Pattern', 'Shading', 'XObject', 'Font']);
var partialEvaluator = new PartialEvaluator(pdfManager, this.xref, handler, this.pageIndex, this.idFactory, this.fontCache, this.builtInCMapCache, this.evaluatorOptions);
var partialEvaluator = new PartialEvaluator({
pdfManager: this.pdfManager,
xref: this.xref,
handler,
pageIndex: this.pageIndex,
idFactory: this.idFactory,
fontCache: this.fontCache,
builtInCMapCache: this.builtInCMapCache,
options: this.evaluatorOptions
});
var dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
var pageListPromise = dataPromises.then(function (data) {
var contentStream = data[0];
var opList = new OperatorList(intent, handler, self.pageIndex);
var pageListPromise = dataPromises.then(([contentStream]) => {
var opList = new OperatorList(intent, handler, this.pageIndex);
handler.send('StartRenderPage', {
transparency: partialEvaluator.hasBlendModes(self.resources),
pageIndex: self.pageIndex,
transparency: partialEvaluator.hasBlendModes(this.resources),
pageIndex: this.pageIndex,
intent
});
return partialEvaluator.getOperatorList(contentStream, task, self.resources, opList).then(function () {
return partialEvaluator.getOperatorList({
stream: contentStream,
task,
resources: this.resources,
operatorList: opList
}).then(function () {
return opList;
});
});
var annotationsPromise = pdfManager.ensure(this, 'annotations');
return Promise.all([pageListPromise, annotationsPromise]).then(function (datas) {
var pageOpList = datas[0];
var annotations = datas[1];
var annotationsPromise = this.pdfManager.ensure(this, 'annotations');
return Promise.all([pageListPromise, annotationsPromise]).then(function ([pageOpList, annotations]) {
if (annotations.length === 0) {
pageOpList.flush(true);
return pageOpList;
@ -25861,16 +25912,28 @@ var Page = function PageClosure() {
});
});
},
extractTextContent: function Page_extractTextContent(handler, task, normalizeWhitespace, combineTextItems) {
var self = this;
var pdfManager = this.pdfManager;
var contentStreamPromise = pdfManager.ensure(this, 'getContentStream', []);
extractTextContent({ handler, task, normalizeWhitespace, combineTextItems }) {
var contentStreamPromise = this.pdfManager.ensure(this, 'getContentStream');
var resourcesPromise = this.loadResources(['ExtGState', 'XObject', 'Font']);
var dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
return dataPromises.then(function (data) {
var contentStream = data[0];
var partialEvaluator = new PartialEvaluator(pdfManager, self.xref, handler, self.pageIndex, self.idFactory, self.fontCache, self.builtInCMapCache, self.evaluatorOptions);
return partialEvaluator.getTextContent(contentStream, task, self.resources, null, normalizeWhitespace, combineTextItems);
return dataPromises.then(([contentStream]) => {
var partialEvaluator = new PartialEvaluator({
pdfManager: this.pdfManager,
xref: this.xref,
handler,
pageIndex: this.pageIndex,
idFactory: this.idFactory,
fontCache: this.fontCache,
builtInCMapCache: this.builtInCMapCache,
options: this.evaluatorOptions
});
return partialEvaluator.getTextContent({
stream: contentStream,
task,
resources: this.resources,
normalizeWhitespace,
combineTextItems
});
});
},
getAnnotationsData: function Page_getAnnotationsData(intent) {
@ -27293,7 +27356,7 @@ var Font = function FontClosure() {
this.toFontChar = buildToFontChar(properties.defaultEncoding, getGlyphsUnicode(), properties.differences);
} else {
glyphsUnicodeMap = getGlyphsUnicode();
this.toUnicode.forEach(function (charCode, unicodeCharCode) {
this.toUnicode.forEach((charCode, unicodeCharCode) => {
if (!this.composite) {
glyphName = properties.differences[charCode] || properties.defaultEncoding[charCode];
unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
@ -27302,7 +27365,7 @@ var Font = function FontClosure() {
}
}
this.toFontChar[charCode] = unicodeCharCode;
}.bind(this));
});
}
this.loadedName = fontName.split('-')[0];
this.loading = false;
@ -36563,8 +36626,8 @@ exports.Type1Parser = Type1Parser;
"use strict";
var pdfjsVersion = '1.8.290';
var pdfjsBuild = '60c232bc';
var pdfjsVersion = '1.8.314';
var pdfjsBuild = '3adda80f';
var pdfjsCoreWorker = __w_pdfjs_require__(17);
;
exports.WorkerMessageHandler = pdfjsCoreWorker.WorkerMessageHandler;

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

@ -40,6 +40,7 @@ AboutPage.prototype = {
let channel = Services.io.newChannelFromURIWithLoadInfo(newURI,
aLoadInfo);
channel.originalURI = aURI;
aLoadInfo.resultPrincipalURI = aURI;
if (this.uriFlags & Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT) {
let principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(aURI);

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

@ -14,7 +14,12 @@ js_option('--with-android-toolchain', nargs=1,
js_option('--with-android-gnu-compiler-version', nargs=1,
help='GNU compiler version to use')
min_android_version = dependable(lambda: '9')
@depends(target)
def min_android_version(target):
if target.cpu in ['aarch64', 'x86_64', 'mips64']:
# 64-bit support was added in API 21.
return '21'
return '9'
js_option('--with-android-version',
nargs=1,
@ -52,6 +57,47 @@ def ndk(value, build_project):
set_config('ANDROID_NDK', ndk)
add_old_configure_assignment('android_ndk', ndk)
@depends(ndk)
@checking('for android ndk version')
@imports(_from='__builtin__', _import='open')
def ndk_version(ndk):
if not ndk:
# Building 'js/src' for non-Android.
return
with open(os.path.join(ndk, 'source.properties'), 'r') as f:
for line in f:
if not line.startswith('Pkg.Revision'):
continue
(_, version) = line.split('=')
if version:
return version.strip()
die('Unexpected Pkg.Revision line in source.properties')
die('Cannot determine NDK version from source.properties')
@depends(ndk_version)
def ndk_major_version(ndk_version):
if not ndk_version:
# Building 'js/src' for non-Android.
return
(major, minor, revision) = ndk_version.split('.')
if major:
return major
die('Unexpected NDK version string: ' + ndk_version)
set_config('ANDROID_NDK_MAJOR_VERSION', ndk_major_version);
@depends(ndk_version)
def ndk_minor_version(ndk_version):
if not ndk_version:
# Building 'js/src' for non-Android.
return
(major, minor, revision) = ndk_version.split('.')
if minor:
return minor
die('Unexpected NDK version string: ' + ndk_version)
set_config('ANDROID_NDK_MINOR_VERSION', ndk_minor_version);
@depends(target, android_version, ndk)
@checking('for android platform directory')
@imports(_from='os.path', _import='isdir')

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

@ -168,12 +168,11 @@ nsChromeProtocolHandler::NewChannel2(nsIURI* aURI,
// Make sure that the channel remembers where it was
// originally loaded from.
nsLoadFlags loadFlags = 0;
result->GetLoadFlags(&loadFlags);
result->SetLoadFlags(loadFlags & ~nsIChannel::LOAD_REPLACE);
rv = result->SetOriginalURI(aURI);
if (NS_FAILED(rv)) return rv;
aLoadInfo->SetResultPrincipalURI(aURI);
// Get a system principal for content files and set the owner
// property of the result
nsCOMPtr<nsIURL> url = do_QueryInterface(aURI);

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

@ -26,6 +26,10 @@ AboutURL.prototype = {
newChannel: function (aURI, aLoadInfo) {
let chan = Services.io.newChannelFromURIWithLoadInfo(this.uri, aLoadInfo);
chan.owner = Services.scriptSecurityManager.getSystemPrincipal();
// Must set the result principal URI _after_ we've created the channel
// since the chrome protocol would overwrite it with a chrome:// URL.
aLoadInfo.resultPrincipalURI = aURI;
return chan;
},

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

@ -96,6 +96,10 @@ Converter.prototype = {
this.charset =
request.QueryInterface(Ci.nsIChannel).contentCharset || "UTF-8";
// Let "save as" save the original JSON, not the viewer
request.QueryInterface(Ci.nsIWritablePropertyBag);
request.setProperty("contentType", "application/json");
this.channel = request;
this.channel.contentType = "text/html";
this.channel.contentCharset = "UTF-8";

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

@ -17,7 +17,7 @@ const RequestListColumnCause = createClass({
propTypes: {
item: PropTypes.object.isRequired,
onCauseBadgeClick: PropTypes.func.isRequired,
onCauseBadgeMouseDown: PropTypes.func.isRequired,
},
shouldComponentUpdate(nextProps) {
@ -27,7 +27,7 @@ const RequestListColumnCause = createClass({
render() {
let {
item: { cause },
onCauseBadgeClick,
onCauseBadgeMouseDown,
} = this.props;
let causeType = "unknown";
@ -43,7 +43,7 @@ const RequestListColumnCause = createClass({
div({ className: "requests-list-column requests-list-cause", title: causeType },
causeHasStack && div({
className: "requests-list-cause-stack",
onClick: onCauseBadgeClick,
onMouseDown: onCauseBadgeMouseDown,
}, "JS"),
causeType
)

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

@ -26,7 +26,7 @@ const RequestListColumnDomain = createClass({
propTypes: {
item: PropTypes.object.isRequired,
onSecurityIconClick: PropTypes.func.isRequired,
onSecurityIconMouseDown: PropTypes.func.isRequired,
},
shouldComponentUpdate(nextProps) {
@ -34,7 +34,7 @@ const RequestListColumnDomain = createClass({
},
render() {
let { item, onSecurityIconClick } = this.props;
let { item, onSecurityIconMouseDown } = this.props;
let { remoteAddress, remotePort, securityState,
urlDetails: { host, isLocal } } = item;
let iconClassList = ["requests-security-state-icon"];
@ -54,7 +54,7 @@ const RequestListColumnDomain = createClass({
div({ className: "requests-list-column requests-list-domain", title },
div({
className: iconClassList.join(" "),
onMouseDown: onSecurityIconClick,
onMouseDown: onSecurityIconMouseDown,
title: iconTitle,
}),
host,

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

@ -23,6 +23,7 @@ const RequestListColumnFile = createClass({
propTypes: {
item: PropTypes.object.isRequired,
onThumbnailMouseDown: PropTypes.func.isRequired,
},
shouldComponentUpdate(nextProps) {
@ -30,7 +31,10 @@ const RequestListColumnFile = createClass({
},
render() {
let { responseContentDataUri, urlDetails } = this.props.item;
let {
item: { responseContentDataUri, urlDetails },
onThumbnailMouseDown
} = this.props;
return (
div({
@ -40,6 +44,7 @@ const RequestListColumnFile = createClass({
img({
className: "requests-list-icon",
src: responseContentDataUri,
onMouseDown: onThumbnailMouseDown,
}),
urlDetails.baseNameWithQuery
)

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

@ -40,10 +40,11 @@ const RequestListContent = createClass({
displayedRequests: PropTypes.object.isRequired,
firstRequestStartedMillis: PropTypes.number.isRequired,
fromCache: PropTypes.bool,
onCauseBadgeClick: PropTypes.func.isRequired,
onCauseBadgeMouseDown: PropTypes.func.isRequired,
onItemMouseDown: PropTypes.func.isRequired,
onSecurityIconClick: PropTypes.func.isRequired,
onSecurityIconMouseDown: PropTypes.func.isRequired,
onSelectDelta: PropTypes.func.isRequired,
onThumbnailMouseDown: PropTypes.func.isRequired,
scale: PropTypes.number,
selectedRequestId: PropTypes.string,
},
@ -224,9 +225,10 @@ const RequestListContent = createClass({
columns,
displayedRequests,
firstRequestStartedMillis,
onCauseBadgeClick,
onCauseBadgeMouseDown,
onItemMouseDown,
onSecurityIconClick,
onSecurityIconMouseDown,
onThumbnailMouseDown,
selectedRequestId,
} = this.props;
@ -250,8 +252,9 @@ const RequestListContent = createClass({
onContextMenu: this.onContextMenu,
onFocusedNodeChange: this.onFocusedNodeChange,
onMouseDown: () => onItemMouseDown(item.id),
onCauseBadgeClick: () => onCauseBadgeClick(item.cause),
onSecurityIconClick: () => onSecurityIconClick(item.securityState),
onCauseBadgeMouseDown: () => onCauseBadgeMouseDown(item.cause),
onSecurityIconMouseDown: () => onSecurityIconMouseDown(item.securityState),
onThumbnailMouseDown: () => onThumbnailMouseDown(),
}))
)
)
@ -273,7 +276,7 @@ module.exports = connect(
/**
* A handler that opens the stack trace tab when a stack trace is available
*/
onCauseBadgeClick: (cause) => {
onCauseBadgeMouseDown: (cause) => {
if (cause.stacktrace && cause.stacktrace.length > 0) {
dispatch(Actions.selectDetailsPanelTab("stack-trace"));
}
@ -283,11 +286,18 @@ module.exports = connect(
* A handler that opens the security tab in the details view if secure or
* broken security indicator is clicked.
*/
onSecurityIconClick: (securityState) => {
onSecurityIconMouseDown: (securityState) => {
if (securityState && securityState !== "insecure") {
dispatch(Actions.selectDetailsPanelTab("security"));
}
},
onSelectDelta: (delta) => dispatch(Actions.selectDelta(delta)),
/**
* A handler that opens the response tab in the details view if
* the thumbnail is clicked.
*/
onThumbnailMouseDown: () => {
dispatch(Actions.selectDetailsPanelTab("response"));
},
}),
)(RequestListContent);

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

@ -76,11 +76,12 @@ const RequestListItem = createClass({
isSelected: PropTypes.bool.isRequired,
firstRequestStartedMillis: PropTypes.number.isRequired,
fromCache: PropTypes.bool,
onCauseBadgeClick: PropTypes.func.isRequired,
onCauseBadgeMouseDown: PropTypes.func.isRequired,
onContextMenu: PropTypes.func.isRequired,
onFocusedNodeChange: PropTypes.func,
onMouseDown: PropTypes.func.isRequired,
onSecurityIconClick: PropTypes.func.isRequired,
onSecurityIconMouseDown: PropTypes.func.isRequired,
onThumbnailMouseDown: PropTypes.func.isRequired,
waterfallWidth: PropTypes.number,
},
@ -115,8 +116,9 @@ const RequestListItem = createClass({
fromCache,
onContextMenu,
onMouseDown,
onCauseBadgeClick,
onSecurityIconClick,
onCauseBadgeMouseDown,
onSecurityIconMouseDown,
onThumbnailMouseDown,
} = this.props;
let classList = ["request-list-item", index % 2 ? "odd" : "even"];
@ -134,12 +136,13 @@ const RequestListItem = createClass({
},
columns.get("status") && RequestListColumnStatus({ item }),
columns.get("method") && RequestListColumnMethod({ item }),
columns.get("file") && RequestListColumnFile({ item }),
columns.get("file") && RequestListColumnFile({ item, onThumbnailMouseDown }),
columns.get("protocol") && RequestListColumnProtocol({ item }),
columns.get("scheme") && RequestListColumnScheme({ item }),
columns.get("domain") && RequestListColumnDomain({ item, onSecurityIconClick }),
columns.get("domain") && RequestListColumnDomain({ item,
onSecurityIconMouseDown }),
columns.get("remoteip") && RequestListColumnRemoteIP({ item }),
columns.get("cause") && RequestListColumnCause({ item, onCauseBadgeClick }),
columns.get("cause") && RequestListColumnCause({ item, onCauseBadgeMouseDown }),
columns.get("type") && RequestListColumnType({ item }),
columns.get("cookies") && RequestListColumnCookies({ item }),
columns.get("setCookies") && RequestListColumnSetCookies({ item }),

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

@ -7,6 +7,10 @@
* Basic tests for exporting Network panel content into HAR format.
*/
add_task(function* () {
// Disable tcp fast open, because it is setting a response header indicator
// (bug 1352274). TCP Fast Open is not present on all platforms therefore the
// number of response headers will vary depending on the platform.
Services.prefs.setBoolPref("network.tcp.tcp_fastopen_enable", false);
let { tab, monitor } = yield initNetMonitor(SIMPLE_URL);
info("Starting test... ");

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

@ -157,6 +157,7 @@ skip-if = true # Bug 1258809
[browser_net_status-codes.js]
[browser_net_streaming-response.js]
[browser_net_throttle.js]
[browser_net_thumbnail-click.js]
[browser_net_timeline_ticks.js]
skip-if = true # TODO: fix the test
[browser_net_timing-division.js]

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

@ -8,6 +8,11 @@
*/
function test() {
// Disable tcp fast open, because it is setting a response header indicator
// (bug 1352274). TCP Fast Open is not present on all platforms therefore the
// number of response headers will vary depending on the platform.
Services.prefs.setBoolPref("network.tcp.tcp_fastopen_enable", false);
let { L10N } = require("devtools/client/netmonitor/src/utils/l10n");
initNetMonitor(SIMPLE_SJS).then(({ tab, monitor }) => {

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

@ -0,0 +1,40 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Test that clicking on the file thumbnail opens the response details tab.
*/
add_task(function* () {
let { tab, monitor } = yield initNetMonitor(CONTENT_TYPE_WITHOUT_CACHE_URL);
let { document } = monitor.panelWin;
yield performRequestsAndWait();
let wait = waitForDOM(document, "#response-panel");
let request = document.querySelectorAll(".request-list-item")[5];
let icon = request.querySelector(".requests-list-icon");
info("Clicking thumbnail of the sixth request.");
EventUtils.synthesizeMouseAtCenter(icon, {}, monitor.panelWin);
yield wait;
ok(document.querySelector("#response-tab[aria-selected=true]"),
"Response tab is selected.");
ok(document.querySelector(".response-image-box"),
"Response image preview is shown.");
yield teardown(monitor);
function* performRequestsAndWait() {
let onAllEvents = waitForNetworkEvents(monitor, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS);
yield ContentTask.spawn(tab.linkedBrowser, {}, function* () {
content.wrappedJSObject.performRequests();
});
yield onAllEvents;
}
});

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

@ -174,10 +174,10 @@ nsAboutRedirector::NewChannel(nsIURI* aURI,
rv = NS_NewURI(getter_AddRefs(tempURI), kRedirMap[i].url);
NS_ENSURE_SUCCESS(rv, rv);
// If tempURI links to an external URI (i.e. something other than
// chrome:// or resource://) then set the LOAD_REPLACE flag on the
// channel which forces the channel owner to reflect the displayed
// URL rather then being the systemPrincipal.
// If tempURI links to an internal URI (chrome://, resource://, about:)
// then set the result principal URL on the channel's load info.
// Otherwise, we leave it null which forces the channel principal
// to reflect the displayed URL rather than being the systemPrincipal.
bool isUIResource = false;
rv = NS_URIChainHasFlags(tempURI, nsIProtocolHandler::URI_IS_UI_RESOURCE,
&isUIResource);
@ -185,18 +185,14 @@ nsAboutRedirector::NewChannel(nsIURI* aURI,
bool isAboutBlank = NS_IsAboutBlank(tempURI);
nsLoadFlags loadFlags = isUIResource || isAboutBlank
? static_cast<nsLoadFlags>(nsIChannel::LOAD_NORMAL)
: static_cast<nsLoadFlags>(nsIChannel::LOAD_REPLACE);
rv = NS_NewChannelInternal(getter_AddRefs(tempChannel),
tempURI,
aLoadInfo,
nullptr, // aLoadGroup
nullptr, // aCallbacks
loadFlags);
aLoadInfo);
NS_ENSURE_SUCCESS(rv, rv);
if (isUIResource || isAboutBlank) {
aLoadInfo->SetResultPrincipalURI(aURI);
}
tempChannel->SetOriginalURI(aURI);
tempChannel.forget(aResult);

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

@ -11173,6 +11173,12 @@ nsDocShell::DoURILoad(nsIURI* aURI,
if (aOriginalURI) {
channel->SetOriginalURI(aOriginalURI);
// The LOAD_REPLACE flag and its handling here will be removed as part
// of bug 1319110. For now preserve its restoration here to not break
// any code expecting it being set specially on redirected channels.
// If the flag has originally been set to change result of
// NS_GetFinalChannelURI it won't have any effect and also won't cause
// any harm.
if (aLoadReplace) {
uint32_t loadFlags;
channel->GetLoadFlags(&loadFlags);

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

@ -106,18 +106,17 @@ PostMessageEvent::Run()
// now. Long-term, we want HTML5 to address this so that we can
// be compliant while being safer.
if (!targetPrin->Equals(mProvidedPrincipal)) {
MOZ_DIAGNOSTIC_ASSERT(ChromeUtils::IsOriginAttributesEqualIgnoringFPD(mProvidedPrincipal->OriginAttributesRef(),
targetPrin->OriginAttributesRef()),
"Unexpected postMessage call to a window with mismatched "
"origin attributes");
nsAutoString providedOrigin, targetOrigin;
nsresult rv = nsContentUtils::GetUTFOrigin(targetPrin, targetOrigin);
NS_ENSURE_SUCCESS(rv, rv);
rv = nsContentUtils::GetUTFOrigin(mProvidedPrincipal, providedOrigin);
NS_ENSURE_SUCCESS(rv, rv);
MOZ_DIAGNOSTIC_ASSERT(providedOrigin != targetOrigin ||
(mProvidedPrincipal->OriginAttributesRef() ==
targetPrin->OriginAttributesRef()),
"Unexpected postMessage call to a window with mismatched "
"origin attributes");
const char16_t* params[] = { providedOrigin.get(), targetOrigin.get() };
nsContentUtils::ReportToConsole(nsIScriptError::errorFlag,

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

@ -221,7 +221,7 @@ TabGroup::FindItemWithName(const nsAString& aName,
}
nsTArray<nsPIDOMWindowOuter*>
TabGroup::GetTopLevelWindows()
TabGroup::GetTopLevelWindows() const
{
MOZ_ASSERT(NS_IsMainThread());
nsTArray<nsPIDOMWindowOuter*> array;
@ -263,5 +263,17 @@ TabGroup::AbstractMainThreadForImpl(TaskCategory aCategory)
return SchedulerGroup::AbstractMainThreadForImpl(aCategory);
}
bool
TabGroup::IsBackground() const
{
MOZ_RELEASE_ASSERT(NS_IsMainThread());
for (nsPIDOMWindowOuter* outerWindow : GetTopLevelWindows()) {
if (!outerWindow->IsBackground()) {
return false;
}
}
return true;
}
} // namespace dom
} // namespace mozilla

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

@ -114,13 +114,17 @@ public:
nsIDocShellTreeItem* aOriginalRequestor,
nsIDocShellTreeItem** aFoundItem);
nsTArray<nsPIDOMWindowOuter*> GetTopLevelWindows();
nsTArray<nsPIDOMWindowOuter*> GetTopLevelWindows() const;
const nsTArray<nsPIDOMWindowOuter*>& GetWindows() { return mWindows; }
// This method is always safe to call off the main thread. The nsIEventTarget
// can always be used off the main thread.
nsIEventTarget* EventTargetFor(TaskCategory aCategory) const override;
// Returns true if all of the TabGroup's top-level windows are in
// the background.
bool IsBackground() const override;
private:
virtual AbstractThread*
AbstractMainThreadForImpl(TaskCategory aCategory) override;

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

@ -4251,6 +4251,19 @@ nsDOMWindowUtils::RemoveManuallyManagedState(nsIDOMElement* aElement,
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::GetStorageUsage(nsIDOMStorage* aStorage, int64_t* aRetval)
{
RefPtr<Storage> storage = static_cast<Storage*>(aStorage);
if (!storage) {
return NS_ERROR_UNEXPECTED;
}
*aRetval = storage->GetOriginQuotaUsage();
return NS_OK;
}
NS_INTERFACE_MAP_BEGIN(nsTranslationNodeList)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY(nsITranslationNodeList)

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

@ -663,6 +663,7 @@ GK_ATOM(noembed, "noembed")
GK_ATOM(noframes, "noframes")
GK_ATOM(nohref, "nohref")
GK_ATOM(noisolation, "noisolation")
GK_ATOM(nomodule, "nomodule")
GK_ATOM(nonce, "nonce")
GK_ATOM(none, "none")
GK_ATOM(noresize, "noresize")

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

@ -1602,7 +1602,7 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
nsCOMPtr<nsIContent> scriptContent = do_QueryInterface(aElement);
// Step 12. Check that the script is not an eventhandler
// Step 13. Check that the script is not an eventhandler
if (IsScriptEventHandler(scriptContent)) {
return false;
}
@ -1636,7 +1636,18 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
}
}
// Step 14. in the HTML5 spec
// "In modern user agents that support module scripts, the script element with
// the nomodule attribute will be ignored".
// "The nomodule attribute must not be specified on module scripts (and will
// be ignored if it is)."
if (ModuleScriptsEnabled() &&
scriptKind == nsScriptKind::Classic &&
scriptContent->IsHTMLElement() &&
scriptContent->HasAttr(kNameSpaceID_None, nsGkAtoms::nomodule)) {
return false;
}
// Step 15. and later in the HTML5 spec
nsresult rv = NS_OK;
RefPtr<nsScriptLoadRequest> request;
if (aElement->GetScriptExternal()) {

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

@ -4266,17 +4266,18 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcess
{
mFontgrp->UpdateUserFonts(); // ensure user font generation is current
// adjust flags for current direction run
uint32_t flags = mTextRunFlags;
gfx::ShapedTextFlags flags = mTextRunFlags;
if (aDirection == NSBIDI_RTL) {
flags |= gfxTextRunFactory::TEXT_IS_RTL;
flags |= gfx::ShapedTextFlags::TEXT_IS_RTL;
} else {
flags &= ~gfxTextRunFactory::TEXT_IS_RTL;
flags &= ~gfx::ShapedTextFlags::TEXT_IS_RTL;
}
mTextRun = mFontgrp->MakeTextRun(aText,
aLength,
mDrawTarget,
mAppUnitsPerDevPixel,
flags,
nsTextFrameUtils::Flags(),
mMissingFonts);
}
@ -4489,7 +4490,7 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcess
gfxRect mBoundingBox;
// flags to use when creating textrun, based on CSS style
uint32_t mTextRunFlags;
gfx::ShapedTextFlags mTextRunFlags;
// true iff the bounding box should be measured
bool mDoMeasureBoundingBox;
@ -4577,11 +4578,12 @@ CanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
// If we don't have a style context, we can't set up vertical-text flags
// (for now, at least; perhaps we need new Canvas API to control this).
processor.mTextRunFlags = canvasStyle ?
nsLayoutUtils::GetTextRunFlagsForStyle(canvasStyle,
canvasStyle->StyleFont(),
canvasStyle->StyleText(),
0) : 0;
processor.mTextRunFlags = canvasStyle
? nsLayoutUtils::GetTextRunFlagsForStyle(canvasStyle,
canvasStyle->StyleFont(),
canvasStyle->StyleText(),
0)
: gfx::ShapedTextFlags();
GetAppUnitsValues(&processor.mAppUnitsPerDevPixel, nullptr);
processor.mPt = gfxPoint(aX, aY);
@ -4675,11 +4677,11 @@ CanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
// We can't query the textRun directly, as it may not have been created yet;
// so instead we check the flags that will be used to initialize it.
uint16_t runOrientation =
(processor.mTextRunFlags & gfxTextRunFactory::TEXT_ORIENT_MASK);
if (runOrientation != gfxTextRunFactory::TEXT_ORIENT_HORIZONTAL) {
if (runOrientation == gfxTextRunFactory::TEXT_ORIENT_VERTICAL_MIXED ||
runOrientation == gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT) {
gfx::ShapedTextFlags runOrientation =
(processor.mTextRunFlags & gfx::ShapedTextFlags::TEXT_ORIENT_MASK);
if (runOrientation != gfx::ShapedTextFlags::TEXT_ORIENT_HORIZONTAL) {
if (runOrientation == gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_MIXED ||
runOrientation == gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_UPRIGHT) {
// Adjust to account for mTextRun being shaped using center baseline
// rather than alphabetic.
baselineAnchor -= (fontMetrics.emAscent - fontMetrics.emDescent) * .5f;

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

@ -4970,7 +4970,6 @@ skip-if = (os == 'android' || os == 'linux')
[generated/test_2_conformance2__rendering__instanced-arrays.html]
skip-if = (os == 'android' || os == 'linux')
[generated/test_2_conformance2__rendering__instanced-rendering-bug.html]
fail-if = (os == 'mac') || (os == 'win')
skip-if = (os == 'android' || os == 'linux')
[generated/test_2_conformance2__rendering__out-of-bounds-index-buffers-after-copying.html]
skip-if = (os == 'android' || os == 'linux')

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

@ -213,8 +213,6 @@ fail-if = (os == 'mac') || (os == 'win')
fail-if = (os == 'mac') || (os == 'win')
[generated/test_2_conformance2__rendering__fs-color-type-mismatch-color-buffer-type.html]
fail-if = (os == 'mac') || (os == 'win')
[generated/test_2_conformance2__rendering__instanced-rendering-bug.html]
fail-if = (os == 'mac') || (os == 'win')
[generated/test_2_conformance2__textures__misc__copy-texture-image.html]
fail-if = (os == 'mac') || (os == 'win')
[generated/test_2_conformance2__textures__misc__integer-cubemap-specification-order-bug.html]

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

@ -280,6 +280,8 @@ FileReader::DoReadData(uint64_t aCount)
{
MOZ_ASSERT(mAsyncStream);
uint32_t bytesRead = 0;
if (mDataFormat == FILE_AS_BINARY) {
//Continuously update our binary string as data comes in
uint32_t oldLen = mResult.Length();
@ -301,14 +303,13 @@ FileReader::DoReadData(uint64_t aCount)
NS_ENSURE_SUCCESS(rv, rv);
}
uint32_t bytesRead = 0;
rv = mBufferedStream->ReadSegments(ReadFuncBinaryString, buf + oldLen,
aCount, &bytesRead);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
MOZ_ASSERT(bytesRead == aCount, "failed to read data");
mResult.Truncate(oldLen + bytesRead);
}
else {
CheckedInt<uint64_t> size = mDataLen;
@ -322,22 +323,16 @@ FileReader::DoReadData(uint64_t aCount)
return NS_ERROR_OUT_OF_MEMORY;
}
if (mDataFormat != FILE_AS_ARRAYBUFFER) {
mFileData = (char *) realloc(mFileData, mDataLen + aCount);
NS_ENSURE_TRUE(mFileData, NS_ERROR_OUT_OF_MEMORY);
}
uint32_t bytesRead = 0;
MOZ_DIAGNOSTIC_ASSERT(mFileData);
MOZ_RELEASE_ASSERT((mDataLen + aCount) <= mTotal);
nsresult rv = mAsyncStream->Read(mFileData + mDataLen, aCount, &bytesRead);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
MOZ_ASSERT(bytesRead == aCount, "failed to read data");
}
mDataLen += aCount;
mDataLen += bytesRead;
return NS_OK;
}
@ -416,8 +411,15 @@ FileReader::ReadFileContent(Blob& aBlob,
return;
}
if (mDataFormat == FILE_AS_ARRAYBUFFER) {
mFileData = js_pod_malloc<char>(mTotal);
// Binary Format doesn't need a post-processing of the data. Everything is
// written directly into mResult.
if (mDataFormat != FILE_AS_BINARY) {
if (mDataFormat == FILE_AS_ARRAYBUFFER) {
mFileData = js_pod_malloc<char>(mTotal);
} else {
mFileData = (char *) malloc(mTotal);
}
if (!mFileData) {
NS_WARNING("Preallocation failed for ReadFileData");
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);

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

@ -167,6 +167,7 @@ IPCBlobInputStreamChild::StreamNeeded(IPCBlobInputStream* aStream,
mozilla::ipc::IPCResult
IPCBlobInputStreamChild::RecvStreamReady(const OptionalIPCStream& aStream)
{
MutexAutoLock lock(mMutex);
MOZ_ASSERT(!mPendingOperations.IsEmpty());
nsCOMPtr<nsIInputStream> stream = DeserializeIPCStream(aStream);

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

@ -171,3 +171,36 @@ add_task(function* test_CtoPtoC_bc_small() {
yield BrowserTestUtils.removeTab(tab1);
yield BrowserTestUtils.removeTab(tab2);
});
// Multipart Blob childA-parent-childB.
add_task(function* test_CtoPtoC_multipart() {
let tab1 = yield BrowserTestUtils.openNewForegroundTab(gBrowser, BASE_URI);
let browser1 = gBrowser.getBrowserForTab(tab1);
let blob = yield ContentTask.spawn(browser1, null, function() {
return new Blob(["!"]);
});
ok(blob, "CtoPtoC-,ultipart: We have a blob!");
is(blob.size, "!".length, "CtoPtoC-multipart: The size matches");
let newBlob = new Blob(["world", blob]);
let tab2 = yield BrowserTestUtils.openNewForegroundTab(gBrowser, BASE_URI);
let browser2 = gBrowser.getBrowserForTab(tab2);
let status = yield ContentTask.spawn(browser2, newBlob, function(blob) {
return new Promise(resolve => {
let fr = new content.FileReader();
fr.readAsText(new Blob(["hello ", blob]));
fr.onloadend = function() {
resolve(fr.result == "hello world!");
}
});
});
ok(status, "CtoPtoC-multipart: Data match!");
yield BrowserTestUtils.removeTab(tab1);
yield BrowserTestUtils.removeTab(tab2);
});

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

@ -864,6 +864,8 @@ nsHostObjectProtocolHandler::NewChannel2(nsIURI* uri,
}
channel->SetOriginalURI(uri);
aLoadInfo->SetResultPrincipalURI(uri);
channel->SetContentType(NS_ConvertUTF16toUTF8(contentType));
channel->SetContentLength(size);

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

@ -220,6 +220,18 @@ HTMLScriptElement::SetAsync(bool aValue, ErrorResult& rv)
SetHTMLBoolAttr(nsGkAtoms::async, aValue, rv);
}
bool
HTMLScriptElement::NoModule()
{
return GetBoolAttr(nsGkAtoms::nomodule);
}
void
HTMLScriptElement::SetNoModule(bool aValue, ErrorResult& aRv)
{
SetHTMLBoolAttr(nsGkAtoms::nomodule, aValue, aRv);
}
nsresult
HTMLScriptElement::AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
const nsAttrValue* aValue, bool aNotify)

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

@ -90,6 +90,8 @@ public:
}
bool Async();
void SetAsync(bool aValue, ErrorResult& rv);
bool NoModule();
void SetNoModule(bool aValue, ErrorResult& rv);
protected:
virtual ~HTMLScriptElement();

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

@ -2412,6 +2412,7 @@ nsHTMLDocument::CreateAndAddWyciwygChannel(void)
channel->SetLoadFlags(loadFlags);
channel->SetOriginalURI(wcwgURI);
loadInfo->SetResultPrincipalURI(wcwgURI);
rv = loadGroup->AddRequest(mWyciwygChannel, nullptr);
NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to add request to load group.");

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

@ -0,0 +1,42 @@
<html>
<body>
<script>
// Helper methods.
function ok(a, msg) {
parent.postMessage({ check: !!a, msg }, "*")
}
function is(a, b, msg) {
ok(a === b, msg);
}
function finish() {
parent.postMessage({ done: true }, "*");
}
</script>
<script id="a" nomodule>42</script>
<script id="b">42</script>
<script>
// Let's test the behavior of nomodule attribute and noModule getter/setter.
var a = document.getElementById("a");
is(a.noModule, true, "HTMLScriptElement with nomodule attribute has noModule set to true");
a.removeAttribute("nomodule");
is(a.noModule, false, "HTMLScriptElement without nomodule attribute has noModule set to false");
a.noModule = true;
ok(a.hasAttribute('nomodule'), "HTMLScriptElement.noModule = true add the nomodule attribute");
var b = document.getElementById("b");
is(b.noModule, false, "HTMLScriptElement without nomodule attribute has noModule set to false");
b.noModule = true;
ok(b.hasAttribute('nomodule'), "HTMLScriptElement.noModule = true add the nomodule attribute");
</script>
<script>var foo = 42;</script>
<script nomodule>foo = 43;</script>
<script>
is(foo, 42, "nomodule HTMLScriptElements should not be executed in modern browsers");
finish();
</script>
</body>
</html>

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

@ -0,0 +1,32 @@
<html>
<body>
<script>
// Helper methods.
function ok(a, msg) {
parent.postMessage({ check: !!a, msg }, "*")
}
function is(a, b, msg) {
ok(a === b, msg);
}
function finish() {
parent.postMessage({ done: true }, "*");
}
</script>
<script id="a" nomodule>42</script>
<script>
// Let's test the behavior of nomodule attribute and noModule getter/setter.
var a = document.getElementById("a");
ok(!("noModule" in a), "When modules are disabled HTMLScriptElement.noModule is not defined");
</script>
<script>var foo = 42;</script>
<script nomodule>foo = 43;</script>
<script>
is(foo, 43, "nomodule attribute is ignored when modules are disabled");
finish();
</script>
</body>
</html>

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

@ -608,3 +608,7 @@ skip-if = os == "android" # up/down arrow keys not supported on android
[test_bug1310865.html]
[test_bug1315146.html]
[test_fakepath.html]
[test_script_module.html]
support-files =
file_script_module.html
file_script_nomodule.html

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

@ -0,0 +1,56 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for HTMLScriptElement with nomodule attribute</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<script>
onmessage = (e) => {
if ("done" in e.data) {
next();
} else if ("check" in e.data) {
ok(e.data.check, e.data.msg);
} else {
ok(false, "Unknown message");
}
}
var tests = [
function() {
SpecialPowers.pushPrefEnv({"set":[["dom.moduleScripts.enabled", true]]})
.then(() => {
var ifr = document.createElement('iframe');
ifr.src = "file_script_module.html";
document.body.appendChild(ifr);
});
},
function() {
SpecialPowers.pushPrefEnv({"set":[["dom.moduleScripts.enabled", false]]})
.then(() => {
var ifr = document.createElement('iframe');
ifr.src = "file_script_nomodule.html";
document.body.appendChild(ifr);
});
},
];
SimpleTest.waitForExplicitFinish();
next();
function next() {
if (!tests.length) {
SimpleTest.finish();
return;
}
var test = tests.shift();
test();
}
</script>
</body>
</html>

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

@ -9,139 +9,40 @@
"Constructing interface Float32Array with no arguments should throw.": true,
"Constructing interface Float64Array with no arguments should throw.": true,
"Constructing interface ArrayBuffer with no arguments should throw.": true,
"The argument NaN (0) should be interpreted as 0 for interface Int8Array.": true,
"The argument Infinity (1) should be interpreted as 0 for interface Int8Array.": true,
"The argument -Infinity (2) should be interpreted as 0 for interface Int8Array.": true,
"The argument -0.4 (5) should be interpreted as 0 for interface Int8Array.": true,
"The argument -0.9 (6) should be interpreted as 0 for interface Int8Array.": true,
"The argument 1.1 (7) should be interpreted as 1 for interface Int8Array.": true,
"The argument 2.9 (8) should be interpreted as 2 for interface Int8Array.": true,
"The argument -4043309056 (10) should be interpreted as 251658240 for interface Int8Array.": true,
"The argument \"1\" (11) should be interpreted as 1 for interface Int8Array.": true,
"The argument \"1e2\" (12) should be interpreted as 100 for interface Int8Array.": true,
"The argument undefined (13) should be interpreted as 0 for interface Int8Array.": true,
"The argument null (14) should be interpreted as 0 for interface Int8Array.": true,
"The argument false (15) should be interpreted as 0 for interface Int8Array.": true,
"The argument true (16) should be interpreted as 1 for interface Int8Array.": true,
"The argument object \"[object Object]\" (18) should be interpreted as 0 for interface Int8Array.": true,
"The argument NaN (0) should be interpreted as 0 for interface Uint8Array.": true,
"The argument Infinity (1) should be interpreted as 0 for interface Uint8Array.": true,
"The argument -Infinity (2) should be interpreted as 0 for interface Uint8Array.": true,
"The argument -0.4 (5) should be interpreted as 0 for interface Uint8Array.": true,
"The argument -0.9 (6) should be interpreted as 0 for interface Uint8Array.": true,
"The argument 1.1 (7) should be interpreted as 1 for interface Uint8Array.": true,
"The argument 2.9 (8) should be interpreted as 2 for interface Uint8Array.": true,
"The argument -4043309056 (10) should be interpreted as 251658240 for interface Uint8Array.": true,
"The argument \"1\" (11) should be interpreted as 1 for interface Uint8Array.": true,
"The argument \"1e2\" (12) should be interpreted as 100 for interface Uint8Array.": true,
"The argument undefined (13) should be interpreted as 0 for interface Uint8Array.": true,
"The argument null (14) should be interpreted as 0 for interface Uint8Array.": true,
"The argument false (15) should be interpreted as 0 for interface Uint8Array.": true,
"The argument true (16) should be interpreted as 1 for interface Uint8Array.": true,
"The argument object \"[object Object]\" (18) should be interpreted as 0 for interface Uint8Array.": true,
"The argument NaN (0) should be interpreted as 0 for interface Uint8ClampedArray.": true,
"The argument Infinity (1) should be interpreted as 0 for interface Uint8ClampedArray.": true,
"The argument -Infinity (2) should be interpreted as 0 for interface Uint8ClampedArray.": true,
"The argument -0.4 (5) should be interpreted as 0 for interface Uint8ClampedArray.": true,
"The argument -0.9 (6) should be interpreted as 0 for interface Uint8ClampedArray.": true,
"The argument 1.1 (7) should be interpreted as 1 for interface Uint8ClampedArray.": true,
"The argument 2.9 (8) should be interpreted as 2 for interface Uint8ClampedArray.": true,
"The argument -4043309056 (10) should be interpreted as 251658240 for interface Uint8ClampedArray.": true,
"The argument \"1\" (11) should be interpreted as 1 for interface Uint8ClampedArray.": true,
"The argument \"1e2\" (12) should be interpreted as 100 for interface Uint8ClampedArray.": true,
"The argument undefined (13) should be interpreted as 0 for interface Uint8ClampedArray.": true,
"The argument null (14) should be interpreted as 0 for interface Uint8ClampedArray.": true,
"The argument false (15) should be interpreted as 0 for interface Uint8ClampedArray.": true,
"The argument true (16) should be interpreted as 1 for interface Uint8ClampedArray.": true,
"The argument object \"[object Object]\" (18) should be interpreted as 0 for interface Uint8ClampedArray.": true,
"The argument NaN (0) should be interpreted as 0 for interface Int16Array.": true,
"The argument Infinity (1) should be interpreted as 0 for interface Int16Array.": true,
"The argument -Infinity (2) should be interpreted as 0 for interface Int16Array.": true,
"The argument -0.4 (5) should be interpreted as 0 for interface Int16Array.": true,
"The argument -0.9 (6) should be interpreted as 0 for interface Int16Array.": true,
"The argument 1.1 (7) should be interpreted as 1 for interface Int16Array.": true,
"The argument 2.9 (8) should be interpreted as 2 for interface Int16Array.": true,
"The argument -4043309056 (10) should be interpreted as 251658240 for interface Int16Array.": true,
"The argument \"1\" (11) should be interpreted as 1 for interface Int16Array.": true,
"The argument \"1e2\" (12) should be interpreted as 100 for interface Int16Array.": true,
"The argument undefined (13) should be interpreted as 0 for interface Int16Array.": true,
"The argument null (14) should be interpreted as 0 for interface Int16Array.": true,
"The argument false (15) should be interpreted as 0 for interface Int16Array.": true,
"The argument true (16) should be interpreted as 1 for interface Int16Array.": true,
"The argument object \"[object Object]\" (18) should be interpreted as 0 for interface Int16Array.": true,
"The argument NaN (0) should be interpreted as 0 for interface Uint16Array.": true,
"The argument Infinity (1) should be interpreted as 0 for interface Uint16Array.": true,
"The argument -Infinity (2) should be interpreted as 0 for interface Uint16Array.": true,
"The argument -0.4 (5) should be interpreted as 0 for interface Uint16Array.": true,
"The argument -0.9 (6) should be interpreted as 0 for interface Uint16Array.": true,
"The argument 1.1 (7) should be interpreted as 1 for interface Uint16Array.": true,
"The argument 2.9 (8) should be interpreted as 2 for interface Uint16Array.": true,
"The argument -4043309056 (10) should be interpreted as 251658240 for interface Uint16Array.": true,
"The argument \"1\" (11) should be interpreted as 1 for interface Uint16Array.": true,
"The argument \"1e2\" (12) should be interpreted as 100 for interface Uint16Array.": true,
"The argument undefined (13) should be interpreted as 0 for interface Uint16Array.": true,
"The argument null (14) should be interpreted as 0 for interface Uint16Array.": true,
"The argument false (15) should be interpreted as 0 for interface Uint16Array.": true,
"The argument true (16) should be interpreted as 1 for interface Uint16Array.": true,
"The argument object \"[object Object]\" (18) should be interpreted as 0 for interface Uint16Array.": true,
"The argument NaN (0) should be interpreted as 0 for interface Int32Array.": true,
"The argument Infinity (1) should be interpreted as 0 for interface Int32Array.": true,
"The argument -Infinity (2) should be interpreted as 0 for interface Int32Array.": true,
"The argument -0.4 (5) should be interpreted as 0 for interface Int32Array.": true,
"The argument -0.9 (6) should be interpreted as 0 for interface Int32Array.": true,
"The argument 1.1 (7) should be interpreted as 1 for interface Int32Array.": true,
"The argument 2.9 (8) should be interpreted as 2 for interface Int32Array.": true,
"The argument -4043309056 (10) should be interpreted as 251658240 for interface Int32Array.": true,
"The argument \"1\" (11) should be interpreted as 1 for interface Int32Array.": true,
"The argument \"1e2\" (12) should be interpreted as 100 for interface Int32Array.": true,
"The argument undefined (13) should be interpreted as 0 for interface Int32Array.": true,
"The argument null (14) should be interpreted as 0 for interface Int32Array.": true,
"The argument false (15) should be interpreted as 0 for interface Int32Array.": true,
"The argument true (16) should be interpreted as 1 for interface Int32Array.": true,
"The argument object \"[object Object]\" (18) should be interpreted as 0 for interface Int32Array.": true,
"The argument NaN (0) should be interpreted as 0 for interface Uint32Array.": true,
"The argument Infinity (1) should be interpreted as 0 for interface Uint32Array.": true,
"The argument -Infinity (2) should be interpreted as 0 for interface Uint32Array.": true,
"The argument -0.4 (5) should be interpreted as 0 for interface Uint32Array.": true,
"The argument -0.9 (6) should be interpreted as 0 for interface Uint32Array.": true,
"The argument 1.1 (7) should be interpreted as 1 for interface Uint32Array.": true,
"The argument 2.9 (8) should be interpreted as 2 for interface Uint32Array.": true,
"The argument -4043309056 (10) should be interpreted as 251658240 for interface Uint32Array.": true,
"The argument \"1\" (11) should be interpreted as 1 for interface Uint32Array.": true,
"The argument \"1e2\" (12) should be interpreted as 100 for interface Uint32Array.": true,
"The argument undefined (13) should be interpreted as 0 for interface Uint32Array.": true,
"The argument null (14) should be interpreted as 0 for interface Uint32Array.": true,
"The argument false (15) should be interpreted as 0 for interface Uint32Array.": true,
"The argument true (16) should be interpreted as 1 for interface Uint32Array.": true,
"The argument object \"[object Object]\" (18) should be interpreted as 0 for interface Uint32Array.": true,
"The argument NaN (0) should be interpreted as 0 for interface Float32Array.": true,
"The argument Infinity (1) should be interpreted as 0 for interface Float32Array.": true,
"The argument -Infinity (2) should be interpreted as 0 for interface Float32Array.": true,
"The argument -0.4 (5) should be interpreted as 0 for interface Float32Array.": true,
"The argument -0.9 (6) should be interpreted as 0 for interface Float32Array.": true,
"The argument 1.1 (7) should be interpreted as 1 for interface Float32Array.": true,
"The argument 2.9 (8) should be interpreted as 2 for interface Float32Array.": true,
"The argument -4043309056 (10) should be interpreted as 251658240 for interface Float32Array.": true,
"The argument \"1\" (11) should be interpreted as 1 for interface Float32Array.": true,
"The argument \"1e2\" (12) should be interpreted as 100 for interface Float32Array.": true,
"The argument undefined (13) should be interpreted as 0 for interface Float32Array.": true,
"The argument null (14) should be interpreted as 0 for interface Float32Array.": true,
"The argument false (15) should be interpreted as 0 for interface Float32Array.": true,
"The argument true (16) should be interpreted as 1 for interface Float32Array.": true,
"The argument object \"[object Object]\" (18) should be interpreted as 0 for interface Float32Array.": true,
"The argument NaN (0) should be interpreted as 0 for interface Float64Array.": true,
"The argument Infinity (1) should be interpreted as 0 for interface Float64Array.": true,
"The argument -Infinity (2) should be interpreted as 0 for interface Float64Array.": true,
"The argument -0.4 (5) should be interpreted as 0 for interface Float64Array.": true,
"The argument -0.9 (6) should be interpreted as 0 for interface Float64Array.": true,
"The argument 1.1 (7) should be interpreted as 1 for interface Float64Array.": true,
"The argument 2.9 (8) should be interpreted as 2 for interface Float64Array.": true,
"The argument -4043309056 (10) should be interpreted as 251658240 for interface Float64Array.": true,
"The argument \"1\" (11) should be interpreted as 1 for interface Float64Array.": true,
"The argument \"1e2\" (12) should be interpreted as 100 for interface Float64Array.": true,
"The argument undefined (13) should be interpreted as 0 for interface Float64Array.": true,
"The argument null (14) should be interpreted as 0 for interface Float64Array.": true,
"The argument false (15) should be interpreted as 0 for interface Float64Array.": true,
"The argument true (16) should be interpreted as 1 for interface Float64Array.": true,
"The argument object \"[object Object]\" (18) should be interpreted as 0 for interface Float64Array.": true
}

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

@ -48,6 +48,7 @@ interface nsITranslationNodeList;
interface nsIJSRAIIHelper;
interface nsIContentPermissionRequest;
interface nsIObserver;
interface nsIDOMStorage;
[scriptable, uuid(c471d440-004b-4c50-a6f2-747db5f443b6)]
interface nsIDOMWindowUtils : nsISupports {
@ -2006,6 +2007,14 @@ interface nsIDOMWindowUtils : nsISupports {
void removeManuallyManagedState(in nsIDOMElement element,
in AString state);
/**
* Returns usage data for a given storage object.
*
* @param aStorage
* The storage object to get usage data for.
*/
int64_t getStorageUsage(in nsIDOMStorage aStorage);
// These consts are only for testing purposes.
const long DEFAULT_MOUSE_POINTER_ID = 0;
const long DEFAULT_PEN_POINTER_ID = 1;

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

@ -2570,20 +2570,13 @@ ContentChild::DeallocPOfflineCacheUpdateChild(POfflineCacheUpdateChild* actor)
mozilla::ipc::IPCResult
ContentChild::RecvStartProfiler(const ProfilerInitParams& params)
{
nsTArray<const char*> featureArray;
for (size_t i = 0; i < params.features().Length(); ++i) {
featureArray.AppendElement(params.features()[i].get());
nsTArray<const char*> filterArray;
for (size_t i = 0; i < params.filters().Length(); ++i) {
filterArray.AppendElement(params.filters()[i].get());
}
nsTArray<const char*> threadNameFilterArray;
for (size_t i = 0; i < params.threadFilters().Length(); ++i) {
threadNameFilterArray.AppendElement(params.threadFilters()[i].get());
}
profiler_start(params.entries(), params.interval(),
featureArray.Elements(), featureArray.Length(),
threadNameFilterArray.Elements(),
threadNameFilterArray.Length());
profiler_start(params.entries(), params.interval(), params.features(),
filterArray.Elements(), filterArray.Length());
return IPC_OK();
}

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

@ -734,7 +734,9 @@ parent:
async PHeapSnapshotTempFileHelper();
async PNecko();
// Giving high priority to prevent other messages sending before this one.
// See bug 1360549 for details.
prio(high) async PNecko();
async PPrinting();

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

@ -1725,10 +1725,18 @@ NPObjWrapper_Resolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<jsid>
static void
NPObjWrapper_Finalize(js::FreeOp *fop, JSObject *obj)
{
JS::AutoAssertGCCallback inCallback;
NPObject *npobj = (NPObject *)::JS_GetPrivate(obj);
if (npobj) {
if (sNPObjWrappers) {
sNPObjWrappers->Remove(npobj);
// If the sNPObjWrappers map contains an entry that refers to this
// wrapper, remove it.
auto entry =
static_cast<NPObjWrapperHashEntry*>(sNPObjWrappers->Search(npobj));
if (entry && entry->mJSObj == obj) {
sNPObjWrappers->Remove(npobj);
}
}
}
@ -1907,13 +1915,23 @@ nsNPObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, NPObject *npobj)
}
if (entry->mJSObj) {
// Found a live NPObject wrapper. It may not be in the same compartment
// as cx, so we need to wrap it before returning it.
JS::Rooted<JSObject*> obj(cx, entry->mJSObj);
if (!JS_WrapObject(cx, &obj)) {
return nullptr;
// Found a NPObject wrapper. First check it is still alive.
JSObject* obj = entry->mJSObj;
if (js::gc::EdgeNeedsSweepUnbarriered(&obj)) {
// The object is dead (finalization will happen at a later time). By the
// time we leave this function, this entry will either be updated with a
// new wrapper or removed if that fails. Clear it anyway to make sure
// nothing touches the dead object.
entry->mJSObj = nullptr;
} else {
// It may not be in the same compartment as cx, so we need to wrap it
// before returning it.
JS::Rooted<JSObject*> obj(cx, entry->mJSObj);
if (!JS_WrapObject(cx, &obj)) {
return nullptr;
}
return obj;
}
return obj;
}
entry->mNPObj = npobj;

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

@ -2659,19 +2659,13 @@ PluginModuleChild::ProcessNativeEvents() {
mozilla::ipc::IPCResult
PluginModuleChild::RecvStartProfiler(const ProfilerInitParams& params)
{
nsTArray<const char*> featureArray;
for (size_t i = 0; i < params.features().Length(); ++i) {
featureArray.AppendElement(params.features()[i].get());
nsTArray<const char*> filterArray;
for (size_t i = 0; i < params.filters().Length(); ++i) {
filterArray.AppendElement(params.filters()[i].get());
}
nsTArray<const char*> threadNameFilterArray;
for (size_t i = 0; i < params.threadFilters().Length(); ++i) {
threadNameFilterArray.AppendElement(params.threadFilters()[i].get());
}
profiler_start(params.entries(), params.interval(),
featureArray.Elements(), featureArray.Length(),
threadNameFilterArray.Elements(), threadNameFilterArray.Length());
profiler_start(params.entries(), params.interval(), params.features(),
filterArray.Elements(), filterArray.Length());
return IPC_OK();
}

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

@ -72,6 +72,12 @@ Storage::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
return StorageBinding::Wrap(aCx, this, aGivenProto);
}
int64_t
Storage::GetOriginQuotaUsage() const
{
return mCache->GetOriginQuotaUsage(this);
}
uint32_t
Storage::GetLength(nsIPrincipal& aSubjectPrincipal,
ErrorResult& aRv)

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

@ -73,6 +73,8 @@ public:
return mWindow;
}
int64_t GetOriginQuotaUsage() const;
uint32_t GetLength(nsIPrincipal& aSubjectPrincipal,
ErrorResult& aRv);

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

@ -540,6 +540,12 @@ StorageCache::CloneFrom(const StorageCache* aThat)
}
}
int64_t
StorageCache::GetOriginQuotaUsage(const Storage* aStorage) const
{
return mData[GetDataSetIndex(aStorage)].mOriginQuotaUsage;
}
// Defined in StorageManager.cpp
extern bool
PrincipalsEqual(nsIPrincipal* aObjectPrincipal,

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

@ -109,6 +109,9 @@ public:
// Copies all data from the other storage.
void CloneFrom(const StorageCache* aThat);
// Get size of per-origin data.
int64_t GetOriginQuotaUsage(const Storage* aStorage) const;
// Starts async preload of this cache if it persistent and not loaded.
void Preload();

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

@ -16,3 +16,4 @@ skip-if = toolkit == 'android'
[test_sessionStorageHttpHttps.html]
skip-if = toolkit == 'android' #TIMED_OUT
[test_sessionStorageReplace.html]
[test_sessionStorageUsage.html]

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

@ -0,0 +1,55 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>sessionStorage basic test</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript">
function setup() {
sessionStorage.clear();
SimpleTest.executeSoon(startTest);
}
function startTest()
{
var util = SpecialPowers.wrap(window)
.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
.getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
// Check initial state.
is(sessionStorage.length, 0, "storage is empty");
is(util.getStorageUsage(sessionStorage), 0, "usage is zero");
// Add some data.
sessionStorage.setItem("one", "data");
var usage = util.getStorageUsage(sessionStorage);
ok(usage > 0, "storage contains data");
// Add some more data.
sessionStorage.setItem("two", "data");
ok(usage < util.getStorageUsage(sessionStorage), "storage size grew");
// Remove data.
sessionStorage.removeItem("two");
is(util.getStorageUsage(sessionStorage), usage, "storage size shrunk");
// Cleanup.
sessionStorage.clear();
is(sessionStorage.length, 0, "storage is empty");
is(util.getStorageUsage(sessionStorage), 0, "usage is zero");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
</script>
</head>
<body onload="setup();">
</body>
</html>

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

@ -14,6 +14,8 @@ interface HTMLScriptElement : HTMLElement {
attribute DOMString src;
[SetterThrows]
attribute DOMString type;
[SetterThrows, Pref="dom.moduleScripts.enabled"]
attribute boolean noModule;
[SetterThrows]
attribute DOMString charset;
[SetterThrows]

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

@ -53,7 +53,7 @@ already_AddRefed<UnscaledFont>
NativeFontResourceFontconfig::CreateUnscaledFont(uint32_t aIndex,
const uint8_t* aInstanceData, uint32_t aInstanceDataLength)
{
RefPtr<UnscaledFont> unscaledFont = new UnscaledFontFontconfig(mFace);
RefPtr<UnscaledFont> unscaledFont = new UnscaledFontFontconfig(mFace, this);
return unscaledFont.forget();
}

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

@ -242,13 +242,23 @@ UnscaledFontFontconfig::CreateScaledFont(Float aGlyphSize,
}
const ScaledFontFontconfig::InstanceData *instanceData =
reinterpret_cast<const ScaledFontFontconfig::InstanceData*>(aInstanceData);
return ScaledFontFontconfig::CreateFromInstanceData(*instanceData, this, aGlyphSize);
return ScaledFontFontconfig::CreateFromInstanceData(*instanceData, this, aGlyphSize,
mNativeFontResource.get());
}
static cairo_user_data_key_t sNativeFontResourceKey;
static void
ReleaseNativeFontResource(void* aData)
{
static_cast<NativeFontResource*>(aData)->Release();
}
already_AddRefed<ScaledFont>
ScaledFontFontconfig::CreateFromInstanceData(const InstanceData& aInstanceData,
UnscaledFontFontconfig* aUnscaledFont,
Float aSize)
Float aSize,
NativeFontResource* aNativeFontResource)
{
FcPattern* pattern = FcPatternCreate();
if (!pattern) {
@ -271,6 +281,22 @@ ScaledFontFontconfig::CreateFromInstanceData(const InstanceData& aInstanceData,
return nullptr;
}
if (aNativeFontResource) {
// Bug 1362117 - Cairo may keep the font face alive after the owning NativeFontResource
// was freed. To prevent this, we must bind the NativeFontResource to the font face so that
// it stays alive at least as long as the font face.
if (cairo_font_face_set_user_data(font,
&sNativeFontResourceKey,
aNativeFontResource,
ReleaseNativeFontResource) != CAIRO_STATUS_SUCCESS) {
gfxWarning() << "Failed binding NativeFontResource to Cairo font face";
cairo_font_face_destroy(font);
FcPatternDestroy(pattern);
return nullptr;
}
aNativeFontResource->AddRef();
}
cairo_matrix_t sizeMatrix;
aInstanceData.SetupFontMatrix(&sizeMatrix);

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

@ -66,7 +66,8 @@ private:
static already_AddRefed<ScaledFont>
CreateFromInstanceData(const InstanceData& aInstanceData,
UnscaledFontFontconfig* aUnscaledFont,
Float aSize);
Float aSize,
NativeFontResource* aNativeFontResource = nullptr);
FcPattern* mPattern;
};

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

@ -73,6 +73,11 @@ public:
uint32_t aIndex = 0)
: UnscaledFontFreeType(aFile, aIndex)
{}
UnscaledFontFontconfig(FT_Face aFace,
NativeFontResource* aNativeFontResource)
: UnscaledFontFreeType(aFace, false)
, mNativeFontResource(aNativeFontResource)
{}
FontType GetType() const override { return FontType::FONTCONFIG; }
@ -83,6 +88,9 @@ public:
CreateScaledFont(Float aGlyphSize,
const uint8_t* aInstanceData,
uint32_t aInstanceDataLength) override;
private:
RefPtr<NativeFontResource> mNativeFontResource;
};
#endif

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

@ -1,9 +1,9 @@
gfx/harfbuzz status as of 2017-03-10:
gfx/harfbuzz status as of 2017-04-24:
This directory contains the harfbuzz source from the 'master' branch of
https://github.com/behdad/harfbuzz.
Current version: 1.4.5
Current version: 1.4.6
UPDATING:

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

@ -25,11 +25,13 @@ HBLIBS =
HBNONPCLIBS =
HBDEPS =
HBSOURCES = $(HB_BASE_sources)
HBSOURCES += $(HB_BASE_RAGEL_GENERATED_sources)
HBHEADERS = $(HB_BASE_headers)
HBNODISTHEADERS = $(HB_NODIST_headers)
if HAVE_OT
HBSOURCES += $(HB_OT_sources)
HBSOURCES += $(HB_OT_RAGEL_GENERATED_sources)
HBHEADERS += $(HB_OT_headers)
endif
@ -251,19 +253,13 @@ built-sources: $(BUILT_SOURCES)
.PHONY: unicode-tables arabic-table indic-table use-table built-sources
RAGEL_GENERATED = \
$(srcdir)/hb-buffer-deserialize-json.hh \
$(srcdir)/hb-buffer-deserialize-text.hh \
$(srcdir)/hb-ot-shape-complex-indic-machine.hh \
$(srcdir)/hb-ot-shape-complex-myanmar-machine.hh \
$(srcdir)/hb-ot-shape-complex-use-machine.hh \
$(patsubst %,$(srcdir)/%,$(HB_BASE_RAGEL_GENERATED_sources)) \
$(patsubst %,$(srcdir)/%,$(HB_OT_RAGEL_GENERATED_sources)) \
$(NULL)
BUILT_SOURCES += $(RAGEL_GENERATED)
EXTRA_DIST += \
hb-buffer-deserialize-json.rl \
hb-buffer-deserialize-text.rl \
hb-ot-shape-complex-indic-machine.rl \
hb-ot-shape-complex-myanmar-machine.rl \
hb-ot-shape-complex-use-machine.rl \
$(HB_BASE_RAGEL_sources) \
$(HB_OT_RAGEL_sources) \
$(NULL)
MAINTAINERCLEANFILES += $(RAGEL_GENERATED)
$(srcdir)/%.hh: $(srcdir)/%.rl

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

@ -186,8 +186,10 @@ lang_equal (hb_language_t v1,
const unsigned char *p1 = (const unsigned char *) v1;
const unsigned char *p2 = (const unsigned char *) v2;
while (*p1 && *p1 == canon_map[*p2])
p1++, p2++;
while (*p1 && *p1 == canon_map[*p2]) {
p1++;
p2++;
}
return *p1 == canon_map[*p2];
}
@ -667,7 +669,7 @@ parse_float (const char **pp, const char *end, float *pv)
float v;
errno = 0;
v = strtof (p, &pend);
v = strtod (p, &pend);
if (errno || p == pend)
return false;

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

@ -301,7 +301,7 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
hb_codepoint_t *pg = gids;
clusters[0].cluster = buffer->info[0].cluster;
float curradv = HB_DIRECTION_IS_BACKWARD(buffer->props.direction) ? gr_slot_origin_X(gr_seg_first_slot(seg)) : 0.;
float curradv = 0.;
if (HB_DIRECTION_IS_BACKWARD(buffer->props.direction))
{
curradv = gr_slot_origin_X(gr_seg_first_slot(seg));
@ -330,13 +330,10 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
c->base_glyph = ic;
c->num_glyphs = 0;
if (HB_DIRECTION_IS_BACKWARD(buffer->props.direction))
{
ci++;
clusters[ci].advance = curradv - gr_slot_origin_X(is);
} else {
c->advance = curradv - gr_slot_origin_X(is);
else
clusters[ci].advance = gr_slot_origin_X(is) - curradv;
ci++;
}
ci++;
curradv = gr_slot_origin_X(is);
}
clusters[ci].num_glyphs++;
@ -345,7 +342,9 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
clusters[ci].num_chars = after + 1 - clusters[ci].base_char;
}
if (!HB_DIRECTION_IS_BACKWARD(buffer->props.direction))
if (HB_DIRECTION_IS_BACKWARD(buffer->props.direction))
clusters[ci].advance += curradv;
else
clusters[ci].advance = gr_seg_advance_X(seg) - curradv;
ci++;
@ -366,11 +365,11 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
float yscale = (float) font->y_scale / upem;
yscale *= yscale / xscale;
/* Positioning. */
int currclus = -1;
const hb_glyph_info_t *info = buffer->info;
hb_glyph_position_t *pPos = hb_buffer_get_glyph_positions (buffer, NULL);
if (!HB_DIRECTION_IS_BACKWARD(buffer->props.direction))
{
int currclus = -1;
const hb_glyph_info_t *info = buffer->info;
hb_glyph_position_t *pPos = hb_buffer_get_glyph_positions (buffer, NULL);
curradvx = 0;
for (is = gr_seg_first_slot (seg); is; pPos++, ++info, is = gr_slot_next_in_segment (is))
{
@ -389,23 +388,20 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan,
}
else
{
int currclus = -1;
const hb_glyph_info_t *info = buffer->info;
hb_glyph_position_t *pPos = hb_buffer_get_glyph_positions (buffer, NULL);
curradvx = gr_seg_advance_X(seg) * xscale;
curradvx = gr_seg_advance_X(seg);
for (is = gr_seg_first_slot (seg); is; pPos++, info++, is = gr_slot_next_in_segment (is))
{
if (info->cluster != currclus)
{
pPos->x_advance = info->var1.i32 * xscale;
if (currclus != -1) curradvx -= info[-1].var1.i32 * xscale;
curradvx -= pPos->x_advance;
currclus = info->cluster;
} else
pPos->x_advance = 0.;
pPos->x_advance = 0.;
pPos->y_advance = gr_slot_advance_Y (is, grface, NULL) * yscale;
curradvy -= pPos->y_advance;
pPos->x_offset = gr_slot_origin_X (is) * xscale - curradvx + pPos->x_advance;
pPos->x_offset = (gr_slot_origin_X (is) - info->var1.i32) * xscale - curradvx + pPos->x_advance;
pPos->y_offset = gr_slot_origin_Y (is) * yscale - curradvy;
}
hb_buffer_reverse_clusters (buffer);

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

@ -342,7 +342,7 @@ struct hb_apply_context_t :
inline void init (hb_apply_context_t *c_, bool context_match = false)
{
c = c_;
match_glyph_data = NULL,
match_glyph_data = NULL;
matcher.set_match_func (NULL, NULL);
matcher.set_lookup_props (c->lookup_props);
/* Ignore ZWNJ if we are matching GSUB context, or matching GPOS. */

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

@ -101,10 +101,18 @@ _hb_ot_layout_create (hb_face_t *face)
|| (928 == gdef_len && 59332 == gpos_len && 23298 == gsub_len)
/* sha1sum:6d400781948517c3c0441ba42acb309584b73033 tahomabd.ttf from Windows 8.1 */
|| (940 == gdef_len && 60732 == gpos_len && 23310 == gsub_len)
/* tahoma.ttf v6.04 from Windows 8.1 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */
|| (964 == gdef_len && 60072 == gpos_len && 23836 == gsub_len)
/* tahomabd.ttf v6.04 from Windows 8.1 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */
|| (976 == gdef_len && 61456 == gpos_len && 23832 == gsub_len)
/* sha1sum:e55fa2dfe957a9f7ec26be516a0e30b0c925f846 tahoma.ttf from Windows 10 */
|| (994 == gdef_len && 60336 == gpos_len && 24474 == gsub_len)
/* sha1sum:7199385abb4c2cc81c83a151a7599b6368e92343 tahomabd.ttf from Windows 10 */
|| (1006 == gdef_len && 61740 == gpos_len && 24470 == gsub_len)
/* tahoma.ttf v6.91 from Windows 10 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */
|| (1006 == gdef_len && 61346 == gpos_len && 24576 == gsub_len)
/* tahomabd.ttf v6.91 from Windows 10 x64, see https://bugzilla.mozilla.org/show_bug.cgi?id=1279925 */
|| (1018 == gdef_len && 62828 == gpos_len && 24572 == gsub_len)
/* sha1sum:b9c84d820c49850d3d27ec498be93955b82772b5 tahoma.ttf from Windows 10 AU */
|| (1006 == gdef_len && 61352 == gpos_len && 24576 == gsub_len)
/* sha1sum:2bdfaab28174bdadd2f3d4200a30a7ae31db79d2 tahomabd.ttf from Windows 10 AU */
@ -125,6 +133,14 @@ _hb_ot_layout_create (hb_face_t *face)
/* 2c0c90c6f6087ffbfea76589c93113a9cbb0e75f cantarell-fonts-0.0.21/otf/Cantarell-Bold.otf */
/* 55461f5b853c6da88069ffcdf7f4dd3f8d7e3e6b cantarell-fonts-0.0.21/otf/Cantarell-Bold-Oblique.otf */
|| (188 == gdef_len && 3426 == gpos_len && 264 == gsub_len)
/* d125afa82a77a6475ac0e74e7c207914af84b37a padauk-2.80/Padauk.ttf RHEL 7.2 */
|| (1058 == gdef_len && 11818 == gpos_len && 47032 == gsub_len)
/* 0f7b80437227b90a577cc078c0216160ae61b031 padauk-2.80/Padauk-Bold.ttf RHEL 7.2*/
|| (1046 == gdef_len && 12600 == gpos_len && 47030 == gsub_len)
/* d3dde9aa0a6b7f8f6a89ef1002e9aaa11b882290 padauk-2.80/Padauk.ttf Ubuntu 16.04 */
|| (1058 == gdef_len && 16770 == gpos_len && 71796 == gsub_len)
/* 5f3c98ccccae8a953be2d122c1b3a77fd805093f padauk-2.80/Padauk-Bold.ttf Ubuntu 16.04 */
|| (1046 == gdef_len && 17862 == gpos_len && 71790 == gsub_len)
/* 6c93b63b64e8b2c93f5e824e78caca555dc887c7 padauk-2.80/Padauk-book.ttf */
|| (1046 == gdef_len && 17112 == gpos_len && 71788 == gsub_len)
/* d89b1664058359b8ec82e35d3531931125991fb9 padauk-2.80/Padauk-bookbold.ttf */

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

@ -113,7 +113,7 @@ struct hb_ot_map_t
assert (stage <= stages[table_index].len);
unsigned int start = stage ? stages[table_index][stage - 1].last_lookup : 0;
unsigned int end = stage < stages[table_index].len ? stages[table_index][stage].last_lookup : lookups[table_index].len;
*plookups = &lookups[table_index][start];
*plookups = end == start ? NULL : &lookups[table_index][start];
*lookup_count = end - start;
}

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

@ -431,11 +431,12 @@ static inline hb_bool_t
hb_non_global_user_features_present (const hb_feature_t *user_features,
unsigned int num_user_features)
{
while (num_user_features)
while (num_user_features) {
if (user_features->start != 0 || user_features->end != (unsigned int) -1)
return true;
else
num_user_features--, user_features++;
num_user_features--;
user_features++;
}
return false;
}

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

@ -38,9 +38,9 @@ HB_BEGIN_DECLS
#define HB_VERSION_MAJOR 1
#define HB_VERSION_MINOR 4
#define HB_VERSION_MICRO 5
#define HB_VERSION_MICRO 6
#define HB_VERSION_STRING "1.4.5"
#define HB_VERSION_STRING "1.4.6"
#define HB_VERSION_ATLEAST(major,minor,micro) \
((major)*10000+(minor)*100+(micro) <= \

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

@ -389,19 +389,12 @@ GPUParent::RecvNotifyGpuObservers(const nsCString& aTopic)
mozilla::ipc::IPCResult
GPUParent::RecvStartProfiler(const ProfilerInitParams& params)
{
nsTArray<const char*> featureArray;
for (size_t i = 0; i < params.features().Length(); ++i) {
featureArray.AppendElement(params.features()[i].get());
nsTArray<const char*> filterArray;
for (size_t i = 0; i < params.filters().Length(); ++i) {
filterArray.AppendElement(params.filters()[i].get());
}
nsTArray<const char*> threadNameFilterArray;
for (size_t i = 0; i < params.threadFilters().Length(); ++i) {
threadNameFilterArray.AppendElement(params.threadFilters()[i].get());
}
profiler_start(params.entries(), params.interval(),
featureArray.Elements(), featureArray.Length(),
threadNameFilterArray.Elements(),
threadNameFilterArray.Length());
profiler_start(params.entries(), params.interval(), params.features(),
filterArray.Elements(), filterArray.Length());
return IPC_OK();
}

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

@ -102,7 +102,7 @@ ContentClient::PrintInfo(std::stringstream& aStream, const char* aPrefix)
aStream << aPrefix;
aStream << nsPrintfCString("ContentClient (0x%p)", this).get();
if (profiler_feature_active("displaylistdump")) {
if (profiler_feature_active(ProfilerFeature::DisplayListDump)) {
nsAutoCString pfx(aPrefix);
pfx += " ";

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

@ -1374,7 +1374,8 @@ TextureClient::PrintInfo(std::stringstream& aStream, const char* aPrefix)
AppendToString(aStream, mFlags, " [flags=", "]");
#ifdef MOZ_DUMP_PAINTING
if (gfxPrefs::LayersDumpTexture() || profiler_feature_active("layersdump")) {
if (gfxPrefs::LayersDumpTexture() ||
profiler_feature_active(ProfilerFeature::LayersDump)) {
nsAutoCString pfx(aPrefix);
pfx += " ";

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

@ -1397,7 +1397,7 @@ TiledContentClient::PrintInfo(std::stringstream& aStream, const char* aPrefix)
aStream << aPrefix;
aStream << nsPrintfCString("%sTiledContentClient (0x%p)", mName, this).get();
if (profiler_feature_active("displaylistdump")) {
if (profiler_feature_active(ProfilerFeature::DisplayListDump)) {
nsAutoCString pfx(aPrefix);
pfx += " ";

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

@ -836,7 +836,7 @@ LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion, const nsIntRegi
// Dump to console
if (gfxPrefs::LayersDump()) {
this->Dump(/* aSorted= */true);
} else if (profiler_feature_active("layersdump")) {
} else if (profiler_feature_active(ProfilerFeature::LayersDump)) {
std::stringstream ss;
Dump(ss);
profiler_log(ss.str().c_str());

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

@ -408,7 +408,8 @@ TextureHost::PrintInfo(std::stringstream& aStream, const char* aPrefix)
}
AppendToString(aStream, mFlags, " [flags=", "]");
#ifdef MOZ_DUMP_PAINTING
if (gfxPrefs::LayersDumpTexture() || profiler_feature_active("layersdump")) {
if (gfxPrefs::LayersDumpTexture() ||
profiler_feature_active(ProfilerFeature::LayersDump)) {
nsAutoCString pfx(aPrefix);
pfx += " ";

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

@ -625,7 +625,8 @@ TiledContentHost::PrintInfo(std::stringstream& aStream, const char* aPrefix)
aStream << aPrefix;
aStream << nsPrintfCString("TiledContentHost (0x%p)", this).get();
if (gfxPrefs::LayersDumpTexture() || profiler_feature_active("layersdump")) {
if (gfxPrefs::LayersDumpTexture() ||
profiler_feature_active(ProfilerFeature::LayersDump)) {
nsAutoCString pfx(aPrefix);
pfx += " ";

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

@ -128,7 +128,10 @@ CrossProcessCompositorBridgeParent::AllocPAPZCTreeManagerParent(const uint64_t&
// to unmap our layers id, and we could get here without a parent compositor.
// In this case return an empty APZCTM.
if (!state.mParent) {
// Note: we immediately call ClearTree since otherwise the APZCTM will
// retain a reference to itself, through the checkerboard observer.
RefPtr<APZCTreeManager> temp = new APZCTreeManager();
temp->ClearTree();
return new APZCTreeManagerParent(aLayersId, temp);
}

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

@ -38,7 +38,7 @@ public:
reinterpret_cast<const uint8_t*>(aString), aLength,
aDrawTarget,
aMetrics->AppUnitsPerDevPixel(),
ComputeFlags(aMetrics),
ComputeFlags(aMetrics), nsTextFrameUtils::Flags(),
nullptr);
}
@ -49,7 +49,7 @@ public:
aString, aLength,
aDrawTarget,
aMetrics->AppUnitsPerDevPixel(),
ComputeFlags(aMetrics),
ComputeFlags(aMetrics), nsTextFrameUtils::Flags(),
nullptr);
}
@ -57,21 +57,21 @@ public:
gfxTextRun *operator->() { return mTextRun.get(); }
private:
static uint32_t ComputeFlags(nsFontMetrics* aMetrics) {
uint32_t flags = 0;
static gfx::ShapedTextFlags ComputeFlags(nsFontMetrics* aMetrics) {
gfx::ShapedTextFlags flags = gfx::ShapedTextFlags();
if (aMetrics->GetTextRunRTL()) {
flags |= gfxTextRunFactory::TEXT_IS_RTL;
flags |= gfx::ShapedTextFlags::TEXT_IS_RTL;
}
if (aMetrics->GetVertical()) {
switch (aMetrics->GetTextOrientation()) {
case NS_STYLE_TEXT_ORIENTATION_MIXED:
flags |= gfxTextRunFactory::TEXT_ORIENT_VERTICAL_MIXED;
flags |= gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_MIXED;
break;
case NS_STYLE_TEXT_ORIENTATION_UPRIGHT:
flags |= gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT;
flags |= gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_UPRIGHT;
break;
case NS_STYLE_TEXT_ORIENTATION_SIDEWAYS:
flags |= gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT;
flags |= gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT;
break;
}
}

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

@ -14,7 +14,7 @@ namespace mozilla {
void
ContextStateTrackerOGL::PushOGLSection(GLContext* aGL, const char* aSectionName)
{
if (!profiler_feature_active("gpu")) {
if (!profiler_feature_active(ProfilerFeature::GPU)) {
return;
}

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

@ -551,7 +551,7 @@ gfxDWriteFont::Measure(const gfxTextRun* aTextRun,
BoundingBoxType aBoundingBoxType,
DrawTarget* aRefDrawTarget,
Spacing* aSpacing,
uint16_t aOrientation)
gfx::ShapedTextFlags aOrientation)
{
gfxFont::RunMetrics metrics =
gfxFont::Measure(aTextRun, aStart, aEnd, aBoundingBoxType,

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

@ -54,7 +54,7 @@ public:
BoundingBoxType aBoundingBoxType,
DrawTarget *aDrawTargetForTightBoundingBox,
Spacing *aSpacing,
uint16_t aOrientation) override;
mozilla::gfx::ShapedTextFlags aOrientation) override;
virtual bool ProvidesGlyphWidths() const override;

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

@ -2032,7 +2032,7 @@ gfxFont::DrawEmphasisMarks(const gfxTextRun* aShapedText, gfxPoint* aPt,
void
gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
gfxPoint *aPt, const TextRunDrawParams& aRunParams,
uint16_t aOrientation)
gfx::ShapedTextFlags aOrientation)
{
NS_ASSERTION(aRunParams.drawMode == DrawMode::GLYPH_PATH ||
!(int(aRunParams.drawMode) & int(DrawMode::GLYPH_PATH)),
@ -2057,7 +2057,7 @@ gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
fontParams.haveColorGlyphs = GetFontEntry()->TryGetColorGlyphs();
fontParams.contextPaint = aRunParams.runContextPaint;
fontParams.isVerticalFont =
aOrientation == gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT;
aOrientation == gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_UPRIGHT;
bool sideways = false;
gfxPoint origPt = *aPt;
@ -2071,7 +2071,7 @@ gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
// with 90-degree CW rotation.
const gfxFloat
rotation = (aOrientation ==
gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT)
gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT)
? -M_PI / 2.0 : M_PI / 2.0;
gfxMatrix mat =
aRunParams.context->CurrentMatrix().
@ -2192,7 +2192,7 @@ gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
// adjust updated aPt to account for the transform we were using
gfxFloat advance = aPt->x - origPt.x;
if (aOrientation ==
gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT) {
gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT) {
*aPt = gfxPoint(origPt.x, origPt.y - advance);
} else {
*aPt = gfxPoint(origPt.x, origPt.y + advance);
@ -2290,7 +2290,7 @@ UnionRange(gfxFloat aX, gfxFloat* aDestMin, gfxFloat* aDestMax)
static bool
NeedsGlyphExtents(gfxFont *aFont, const gfxTextRun *aTextRun)
{
return (aTextRun->GetFlags() & gfxTextRunFactory::TEXT_NEED_BOUNDING_BOX) ||
return (aTextRun->GetFlags() & gfx::ShapedTextFlags::TEXT_NEED_BOUNDING_BOX) ||
aFont->GetFontEntry()->IsUserFont();
}
@ -2318,7 +2318,7 @@ gfxFont::Measure(const gfxTextRun *aTextRun,
BoundingBoxType aBoundingBoxType,
DrawTarget* aRefDrawTarget,
Spacing *aSpacing,
uint16_t aOrientation)
gfx::ShapedTextFlags aOrientation)
{
// If aBoundingBoxType is TIGHT_HINTED_OUTLINE_EXTENTS
// and the underlying cairo font may be antialiased,
@ -2341,7 +2341,7 @@ gfxFont::Measure(const gfxTextRun *aTextRun,
const int32_t appUnitsPerDevUnit = aTextRun->GetAppUnitsPerDevUnit();
// Current position in appunits
gfxFont::Orientation orientation =
aOrientation == gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT
aOrientation == gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_UPRIGHT
? eVertical : eHorizontal;
const gfxFont::Metrics& fontMetrics = GetMetrics(orientation);
@ -2571,7 +2571,7 @@ gfxFont::GetShapedWord(DrawTarget *aDrawTarget,
Script aRunScript,
bool aVertical,
int32_t aAppUnitsPerDevUnit,
uint32_t aFlags,
gfx::ShapedTextFlags aFlags,
RoundingFlags aRounding,
gfxTextPerfMetrics *aTextPerf GFX_MAYBE_UNUSED)
{
@ -2669,7 +2669,7 @@ gfxFont::CacheHashEntry::KeyEquals(const KeyTypePointer aKey) const
}
return true;
}
NS_ASSERTION((aKey->mFlags & gfxTextRunFactory::TEXT_IS_8BIT) == 0 &&
NS_ASSERTION(!(aKey->mFlags & gfx::ShapedTextFlags::TEXT_IS_8BIT) &&
!aKey->mTextIs8Bit, "didn't expect 8-bit text here");
return (0 == memcmp(sw->TextUnicode(), aKey->mText.mDouble,
aKey->mLength * sizeof(char16_t)));
@ -2872,7 +2872,7 @@ gfxFont::ShapeTextWithoutWordCache(DrawTarget *aDrawTarget,
} else if (ch == '\n') {
aTextRun->SetIsNewline(aOffset + i);
} else if (IsInvalidControlChar(ch) &&
!(aTextRun->GetFlags() & gfxTextRunFactory::TEXT_HIDE_CONTROL_CHARACTERS)) {
!(aTextRun->GetFlags() & gfx::ShapedTextFlags::TEXT_HIDE_CONTROL_CHARACTERS)) {
if (GetFontEntry()->IsUserFont() && HasCharacter(ch)) {
ShapeFragmentWithoutWordCache(aDrawTarget, aText + i,
aOffset + i, 1,
@ -2966,13 +2966,13 @@ gfxFont::SplitAndInitTextRun(DrawTarget *aDrawTarget,
InitWordCache();
// the only flags we care about for ShapedWord construction/caching
uint32_t flags = aTextRun->GetFlags();
flags &= (gfxTextRunFactory::TEXT_IS_RTL |
gfxTextRunFactory::TEXT_DISABLE_OPTIONAL_LIGATURES |
gfxTextRunFactory::TEXT_USE_MATH_SCRIPT |
gfxTextRunFactory::TEXT_ORIENT_MASK);
gfx::ShapedTextFlags flags = aTextRun->GetFlags();
flags &= (gfx::ShapedTextFlags::TEXT_IS_RTL |
gfx::ShapedTextFlags::TEXT_DISABLE_OPTIONAL_LIGATURES |
gfx::ShapedTextFlags::TEXT_USE_MATH_SCRIPT |
gfx::ShapedTextFlags::TEXT_ORIENT_MASK);
if (sizeof(T) == sizeof(uint8_t)) {
flags |= gfxTextRunFactory::TEXT_IS_8BIT;
flags |= gfx::ShapedTextFlags::TEXT_IS_8BIT;
}
uint32_t wordStart = 0;
@ -3018,13 +3018,13 @@ gfxFont::SplitAndInitTextRun(DrawTarget *aDrawTarget,
return false;
}
} else if (length > 0) {
uint32_t wordFlags = flags;
gfx::ShapedTextFlags wordFlags = flags;
// in the 8-bit version of this method, TEXT_IS_8BIT was
// already set as part of |flags|, so no need for a per-word
// adjustment here
if (sizeof(T) == sizeof(char16_t)) {
if (wordIs8Bit) {
wordFlags |= gfxTextRunFactory::TEXT_IS_8BIT;
wordFlags |= gfx::ShapedTextFlags::TEXT_IS_8BIT;
}
}
gfxShapedWord* sw = GetShapedWord(aDrawTarget,
@ -3041,11 +3041,12 @@ gfxFont::SplitAndInitTextRun(DrawTarget *aDrawTarget,
if (boundary) {
// word was terminated by a space: add that to the textrun
uint16_t orientation = flags & gfxTextRunFactory::TEXT_ORIENT_MASK;
if (orientation == gfxTextRunFactory::TEXT_ORIENT_VERTICAL_MIXED) {
gfx::ShapedTextFlags orientation =
flags & gfx::ShapedTextFlags::TEXT_ORIENT_MASK;
if (orientation == gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_MIXED) {
orientation = aVertical ?
gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT :
gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT;
gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_UPRIGHT :
gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT;
}
if (boundary != ' ' ||
!aTextRun->SetSpaceGlyphIfSimple(this, aRunStart + i, ch,
@ -3061,7 +3062,7 @@ gfxFont::SplitAndInitTextRun(DrawTarget *aDrawTarget,
GetShapedWord(aDrawTarget, &boundary, 1,
gfxShapedWord::HashMix(0, boundary),
aRunScript, aVertical, appUnitsPerDevUnit,
flags | gfxTextRunFactory::TEXT_IS_8BIT,
flags | gfx::ShapedTextFlags::TEXT_IS_8BIT,
rounding, tp);
if (sw) {
aTextRun->CopyGlyphDataFrom(sw, aRunStart + i);
@ -3090,7 +3091,7 @@ gfxFont::SplitAndInitTextRun(DrawTarget *aDrawTarget,
} else if (ch == '\n') {
aTextRun->SetIsNewline(aRunStart + i);
} else if (IsInvalidControlChar(ch) &&
!(aTextRun->GetFlags() & gfxTextRunFactory::TEXT_HIDE_CONTROL_CHARACTERS)) {
!(aTextRun->GetFlags() & gfx::ShapedTextFlags::TEXT_HIDE_CONTROL_CHARACTERS)) {
if (GetFontEntry()->IsUserFont() && HasCharacter(ch)) {
ShapeFragmentWithoutWordCache(aDrawTarget, aString + i,
aRunStart + i, 1,
@ -3135,7 +3136,7 @@ gfxFont::InitFakeSmallCapsRun(DrawTarget *aDrawTarget,
uint32_t aOffset,
uint32_t aLength,
uint8_t aMatchType,
uint16_t aOrientation,
gfx::ShapedTextFlags aOrientation,
Script aScript,
bool aSyntheticLower,
bool aSyntheticUpper)
@ -3157,7 +3158,7 @@ gfxFont::InitFakeSmallCapsRun(DrawTarget *aDrawTarget,
RunCaseAction runAction = kNoChange;
uint32_t runStart = 0;
bool vertical =
aOrientation == gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT;
aOrientation == gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_UPRIGHT;
for (uint32_t i = 0; i <= aLength; ++i) {
uint32_t extraCodeUnits = 0; // Will be set to 1 if we need to consume
@ -3257,7 +3258,9 @@ gfxFont::InitFakeSmallCapsRun(DrawTarget *aDrawTarget,
};
RefPtr<gfxTextRun> tempRun(
gfxTextRun::Create(&params, convertedString.Length(),
aTextRun->GetFontGroup(), 0));
aTextRun->GetFontGroup(),
gfx::ShapedTextFlags(),
nsTextFrameUtils::Flags()));
tempRun->AddGlyphRun(f, aMatchType, 0, true, aOrientation);
if (!f->SplitAndInitTextRun(aDrawTarget, tempRun.get(),
convertedString.BeginReading(),
@ -3267,7 +3270,9 @@ gfxFont::InitFakeSmallCapsRun(DrawTarget *aDrawTarget,
} else {
RefPtr<gfxTextRun> mergedRun(
gfxTextRun::Create(&params, runLength,
aTextRun->GetFontGroup(), 0));
aTextRun->GetFontGroup(),
gfx::ShapedTextFlags(),
nsTextFrameUtils::Flags()));
MergeCharactersInTextRun(mergedRun.get(), tempRun.get(),
charsToMergeArray.Elements(),
deletedCharsArray.Elements());
@ -3308,7 +3313,7 @@ gfxFont::InitFakeSmallCapsRun(DrawTarget *aDrawTarget,
uint32_t aOffset,
uint32_t aLength,
uint8_t aMatchType,
uint16_t aOrientation,
gfx::ShapedTextFlags aOrientation,
Script aScript,
bool aSyntheticLower,
bool aSyntheticUpper)

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

@ -220,29 +220,6 @@ struct gfxFontStyle {
}
};
struct gfxTextRange {
enum {
// flags for recording the kind of font-matching that was used
kFontGroup = 0x0001,
kPrefsFallback = 0x0002,
kSystemFallback = 0x0004
};
gfxTextRange(uint32_t aStart, uint32_t aEnd,
gfxFont* aFont, uint8_t aMatchType,
uint16_t aOrientation)
: start(aStart),
end(aEnd),
font(aFont),
matchType(aMatchType),
orientation(aOrientation)
{ }
uint32_t Length() const { return end - start; }
uint32_t start, end;
RefPtr<gfxFont> font;
uint8_t matchType;
uint16_t orientation;
};
/**
* Font cache design:
@ -454,6 +431,109 @@ public:
}
};
namespace mozilla {
namespace gfx {
// Flags that live in the gfxShapedText::mFlags field.
// (Note that gfxTextRun has an additional mFlags2 field for use
// by textrun clients like nsTextFrame.)
enum class ShapedTextFlags : uint16_t {
/**
* When set, the text string pointer used to create the text run
* is guaranteed to be available during the lifetime of the text run.
*/
TEXT_IS_PERSISTENT = 0x0001,
/**
* When set, the text is RTL.
*/
TEXT_IS_RTL = 0x0002,
/**
* When set, spacing is enabled and the textrun needs to call GetSpacing
* on the spacing provider.
*/
TEXT_ENABLE_SPACING = 0x0004,
/**
* When set, the text has no characters above 255 and it is stored
* in the textrun in 8-bit format.
*/
TEXT_IS_8BIT = 0x0008,
/**
* When set, GetHyphenationBreaks may return true for some character
* positions, otherwise it will always return false for all characters.
*/
TEXT_ENABLE_HYPHEN_BREAKS = 0x0010,
/**
* When set, the RunMetrics::mBoundingBox field will be initialized
* properly based on glyph extents, in particular, glyph extents that
* overflow the standard font-box (the box defined by the ascent, descent
* and advance width of the glyph). When not set, it may just be the
* standard font-box even if glyphs overflow.
*/
TEXT_NEED_BOUNDING_BOX = 0x0020,
/**
* When set, optional ligatures are disabled. Ligatures that are
* required for legible text should still be enabled.
*/
TEXT_DISABLE_OPTIONAL_LIGATURES = 0x0040,
/**
* When set, the textrun should favour speed of construction over
* quality. This may involve disabling ligatures and/or kerning or
* other effects.
*/
TEXT_OPTIMIZE_SPEED = 0x0080,
/**
* When set, the textrun should discard control characters instead of
* turning them into hexboxes.
*/
TEXT_HIDE_CONTROL_CHARACTERS = 0x0100,
/**
* nsTextFrameThebes sets these, but they're defined here rather than
* in nsTextFrameUtils.h because ShapedWord creation/caching also needs
* to check the _INCOMING flag
*/
TEXT_TRAILING_ARABICCHAR = 0x0200,
/**
* When set, the previous character for this textrun was an Arabic
* character. This is used for the context detection necessary for
* bidi.numeral implementation.
*/
TEXT_INCOMING_ARABICCHAR = 0x0400,
/**
* Set if the textrun should use the OpenType 'math' script.
*/
TEXT_USE_MATH_SCRIPT = 0x0800,
/**
* Field for orientation of the textrun and glyphs within it.
* Possible values of the TEXT_ORIENT_MASK field:
* TEXT_ORIENT_HORIZONTAL
* TEXT_ORIENT_VERTICAL_UPRIGHT
* TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT
* TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT
* TEXT_ORIENT_VERTICAL_MIXED
* For all VERTICAL settings, the x and y coordinates of glyph
* positions are exchanged, so that simple advances are vertical.
*
* The MIXED value indicates vertical textRuns for which the CSS
* text-orientation property is 'mixed', but is never used for
* individual glyphRuns; it will be resolved to either UPRIGHT
* or SIDEWAYS_RIGHT according to the UTR50 properties of the
* characters, and separate glyphRuns created for the resulting
* glyph orientations.
*/
TEXT_ORIENT_MASK = 0x7000,
TEXT_ORIENT_HORIZONTAL = 0x0000,
TEXT_ORIENT_VERTICAL_UPRIGHT = 0x1000,
TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT = 0x2000,
TEXT_ORIENT_VERTICAL_MIXED = 0x3000,
TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT = 0x4000,
};
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(ShapedTextFlags)
} // namespace gfx
} // namespace mozilla
class gfxTextRunFactory {
// Used by stylo
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(gfxTextRunFactory)
@ -461,118 +541,6 @@ class gfxTextRunFactory {
public:
typedef mozilla::gfx::DrawTarget DrawTarget;
// Flags in the mask 0xFFFF0000 are reserved for textrun clients
// Flags in the mask 0x0000F000 are reserved for per-platform fonts
// Flags in the mask 0x00000FFF are set by the textrun creator.
enum {
CACHE_TEXT_FLAGS = 0xF0000000,
USER_TEXT_FLAGS = 0x0FFF0000,
TEXTRUN_TEXT_FLAGS = 0x0000FFFF,
SETTABLE_FLAGS = CACHE_TEXT_FLAGS | USER_TEXT_FLAGS,
/**
* When set, the text string pointer used to create the text run
* is guaranteed to be available during the lifetime of the text run.
*/
TEXT_IS_PERSISTENT = 0x0001,
/**
* When set, the text is known to be all-ASCII (< 128).
*/
TEXT_IS_ASCII = 0x0002,
/**
* When set, the text is RTL.
*/
TEXT_IS_RTL = 0x0004,
/**
* When set, spacing is enabled and the textrun needs to call GetSpacing
* on the spacing provider.
*/
TEXT_ENABLE_SPACING = 0x0008,
/**
* When set, GetHyphenationBreaks may return true for some character
* positions, otherwise it will always return false for all characters.
*/
TEXT_ENABLE_HYPHEN_BREAKS = 0x0010,
/**
* When set, the text has no characters above 255 and it is stored
* in the textrun in 8-bit format.
*/
TEXT_IS_8BIT = 0x0020,
/**
* When set, the RunMetrics::mBoundingBox field will be initialized
* properly based on glyph extents, in particular, glyph extents that
* overflow the standard font-box (the box defined by the ascent, descent
* and advance width of the glyph). When not set, it may just be the
* standard font-box even if glyphs overflow.
*/
TEXT_NEED_BOUNDING_BOX = 0x0040,
/**
* When set, optional ligatures are disabled. Ligatures that are
* required for legible text should still be enabled.
*/
TEXT_DISABLE_OPTIONAL_LIGATURES = 0x0080,
/**
* When set, the textrun should favour speed of construction over
* quality. This may involve disabling ligatures and/or kerning or
* other effects.
*/
TEXT_OPTIMIZE_SPEED = 0x0100,
/**
* For internal use by the memory reporter when accounting for
* storage used by textruns.
* Because the reporter may visit each textrun multiple times while
* walking the frame trees and textrun cache, it needs to mark
* textruns that have been seen so as to avoid multiple-accounting.
*/
TEXT_RUN_SIZE_ACCOUNTED = 0x0200,
/**
* When set, the textrun should discard control characters instead of
* turning them into hexboxes.
*/
TEXT_HIDE_CONTROL_CHARACTERS = 0x0400,
/**
* Field for orientation of the textrun and glyphs within it.
* Possible values of the TEXT_ORIENT_MASK field:
* TEXT_ORIENT_HORIZONTAL
* TEXT_ORIENT_VERTICAL_UPRIGHT
* TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT
* TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT
* TEXT_ORIENT_VERTICAL_MIXED
* For all VERTICAL settings, the x and y coordinates of glyph
* positions are exchanged, so that simple advances are vertical.
*
* The MIXED value indicates vertical textRuns for which the CSS
* text-orientation property is 'mixed', but is never used for
* individual glyphRuns; it will be resolved to either UPRIGHT
* or SIDEWAYS_RIGHT according to the UTR50 properties of the
* characters, and separate glyphRuns created for the resulting
* glyph orientations.
*/
TEXT_ORIENT_MASK = 0xF000,
TEXT_ORIENT_HORIZONTAL = 0x0000,
TEXT_ORIENT_VERTICAL_UPRIGHT = 0x1000,
TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT = 0x2000,
TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT = 0x4000,
TEXT_ORIENT_VERTICAL_MIXED = 0x8000,
/**
* nsTextFrameThebes sets these, but they're defined here rather than
* in nsTextFrameUtils.h because ShapedWord creation/caching also needs
* to check the _INCOMING flag
*/
TEXT_TRAILING_ARABICCHAR = 0x20000000,
/**
* When set, the previous character for this textrun was an Arabic
* character. This is used for the context detection necessary for
* bidi.numeral implementation.
*/
TEXT_INCOMING_ARABICCHAR = 0x40000000,
// Set if the textrun should use the OpenType 'math' script.
TEXT_USE_MATH_SCRIPT = 0x80000000,
};
/**
* This record contains all the parameters needed to initialize a textrun.
*/
@ -598,6 +566,29 @@ protected:
virtual ~gfxTextRunFactory();
};
struct gfxTextRange {
enum {
// flags for recording the kind of font-matching that was used
kFontGroup = 0x0001,
kPrefsFallback = 0x0002,
kSystemFallback = 0x0004
};
gfxTextRange(uint32_t aStart, uint32_t aEnd,
gfxFont* aFont, uint8_t aMatchType,
mozilla::gfx::ShapedTextFlags aOrientation)
: start(aStart),
end(aEnd),
font(aFont),
matchType(aMatchType),
orientation(aOrientation)
{ }
uint32_t Length() const { return end - start; }
uint32_t start, end;
RefPtr<gfxFont> font;
uint8_t matchType;
mozilla::gfx::ShapedTextFlags orientation;
};
/**
* gfxFontShaper
*
@ -691,7 +682,7 @@ class gfxShapedText
public:
typedef mozilla::unicode::Script Script;
gfxShapedText(uint32_t aLength, uint32_t aFlags,
gfxShapedText(uint32_t aLength, mozilla::gfx::ShapedTextFlags aFlags,
int32_t aAppUnitsPerDevUnit)
: mLength(aLength)
, mFlags(aFlags)
@ -968,28 +959,30 @@ public:
const uint8_t *aString,
uint32_t aLength);
uint32_t GetFlags() const {
mozilla::gfx::ShapedTextFlags GetFlags() const {
return mFlags;
}
bool IsVertical() const {
return (GetFlags() & gfxTextRunFactory::TEXT_ORIENT_MASK) !=
gfxTextRunFactory::TEXT_ORIENT_HORIZONTAL;
return (GetFlags() & mozilla::gfx::ShapedTextFlags::TEXT_ORIENT_MASK) !=
mozilla::gfx::ShapedTextFlags::TEXT_ORIENT_HORIZONTAL;
}
bool UseCenterBaseline() const {
uint32_t orient = GetFlags() & gfxTextRunFactory::TEXT_ORIENT_MASK;
return orient == gfxTextRunFactory::TEXT_ORIENT_VERTICAL_MIXED ||
orient == gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT;
mozilla::gfx::ShapedTextFlags orient =
GetFlags() & mozilla::gfx::ShapedTextFlags::TEXT_ORIENT_MASK;
return orient == mozilla::gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_MIXED ||
orient == mozilla::gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_UPRIGHT;
}
bool IsRightToLeft() const {
return (GetFlags() & gfxTextRunFactory::TEXT_IS_RTL) != 0;
return (GetFlags() & mozilla::gfx::ShapedTextFlags::TEXT_IS_RTL) ==
mozilla::gfx::ShapedTextFlags::TEXT_IS_RTL;
}
bool IsSidewaysLeft() const {
return (GetFlags() & gfxTextRunFactory::TEXT_ORIENT_MASK) ==
gfxTextRunFactory::TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT;
return (GetFlags() & mozilla::gfx::ShapedTextFlags::TEXT_ORIENT_MASK) ==
mozilla::gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_SIDEWAYS_LEFT;
}
// Return true if the logical inline direction is reversed compared to
@ -1004,11 +997,13 @@ public:
bool DisableLigatures() const {
return (GetFlags() &
gfxTextRunFactory::TEXT_DISABLE_OPTIONAL_LIGATURES) != 0;
mozilla::gfx::ShapedTextFlags::TEXT_DISABLE_OPTIONAL_LIGATURES) ==
mozilla::gfx::ShapedTextFlags::TEXT_DISABLE_OPTIONAL_LIGATURES;
}
bool TextIs8Bit() const {
return (GetFlags() & gfxTextRunFactory::TEXT_IS_8BIT) != 0;
return (GetFlags() & mozilla::gfx::ShapedTextFlags::TEXT_IS_8BIT) ==
mozilla::gfx::ShapedTextFlags::TEXT_IS_8BIT;
}
int32_t GetAppUnitsPerDevUnit() const {
@ -1161,9 +1156,9 @@ protected:
uint32_t mLength;
// Shaping flags (direction, ligature-suppression)
uint32_t mFlags;
mozilla::gfx::ShapedTextFlags mFlags;
int32_t mAppUnitsPerDevUnit;
uint16_t mAppUnitsPerDevUnit;
};
/*
@ -1190,7 +1185,7 @@ public:
static gfxShapedWord* Create(const uint8_t *aText, uint32_t aLength,
Script aRunScript,
int32_t aAppUnitsPerDevUnit,
uint32_t aFlags,
mozilla::gfx::ShapedTextFlags aFlags,
gfxFontShaper::RoundingFlags aRounding) {
NS_ASSERTION(aLength <= gfxPlatform::GetPlatform()->WordCacheCharLimit(),
"excessive length for gfxShapedWord!");
@ -1214,7 +1209,7 @@ public:
static gfxShapedWord* Create(const char16_t *aText, uint32_t aLength,
Script aRunScript,
int32_t aAppUnitsPerDevUnit,
uint32_t aFlags,
mozilla::gfx::ShapedTextFlags aFlags,
gfxFontShaper::RoundingFlags aRounding) {
NS_ASSERTION(aLength <= gfxPlatform::GetPlatform()->WordCacheCharLimit(),
"excessive length for gfxShapedWord!");
@ -1222,7 +1217,7 @@ public:
// In the 16-bit version of Create, if the TEXT_IS_8BIT flag is set,
// then we convert the text to an 8-bit version and call the 8-bit
// Create function instead.
if (aFlags & gfxTextRunFactory::TEXT_IS_8BIT) {
if (aFlags & mozilla::gfx::ShapedTextFlags::TEXT_IS_8BIT) {
nsAutoCString narrowText;
LossyAppendUTF16toASCII(nsDependentSubstring(aText, aLength),
narrowText);
@ -1301,9 +1296,10 @@ private:
// Construct storage for a ShapedWord, ready to receive glyph data
gfxShapedWord(const uint8_t *aText, uint32_t aLength,
Script aRunScript,
int32_t aAppUnitsPerDevUnit, uint32_t aFlags,
int32_t aAppUnitsPerDevUnit,
mozilla::gfx::ShapedTextFlags aFlags,
gfxFontShaper::RoundingFlags aRounding)
: gfxShapedText(aLength, aFlags | gfxTextRunFactory::TEXT_IS_8BIT,
: gfxShapedText(aLength, aFlags | mozilla::gfx::ShapedTextFlags::TEXT_IS_8BIT,
aAppUnitsPerDevUnit)
, mScript(aRunScript)
, mRounding(aRounding)
@ -1316,7 +1312,8 @@ private:
gfxShapedWord(const char16_t *aText, uint32_t aLength,
Script aRunScript,
int32_t aAppUnitsPerDevUnit, uint32_t aFlags,
int32_t aAppUnitsPerDevUnit,
mozilla::gfx::ShapedTextFlags aFlags,
gfxFontShaper::RoundingFlags aRounding)
: gfxShapedText(aLength, aFlags, aAppUnitsPerDevUnit)
, mScript(aRunScript)
@ -1652,7 +1649,7 @@ public:
*/
void Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
gfxPoint *aPt, const TextRunDrawParams& aRunParams,
uint16_t aOrientation);
mozilla::gfx::ShapedTextFlags aOrientation);
/**
* Draw the emphasis marks for the given text run. Its prerequisite
@ -1689,7 +1686,8 @@ public:
uint32_t aStart, uint32_t aEnd,
BoundingBoxType aBoundingBoxType,
DrawTarget* aDrawTargetForTightBoundingBox,
Spacing *aSpacing, uint16_t aOrientation);
Spacing *aSpacing,
mozilla::gfx::ShapedTextFlags aOrientation);
/**
* Line breaks have been changed at the beginning and/or end of a substring
* of the text. Reshaping may be required; glyph updating is permitted.
@ -1760,7 +1758,7 @@ public:
uint32_t aOffset,
uint32_t aLength,
uint8_t aMatchType,
uint16_t aOrientation,
mozilla::gfx::ShapedTextFlags aOrientation,
Script aScript,
bool aSyntheticLower,
bool aSyntheticUpper);
@ -1787,7 +1785,7 @@ public:
Script aRunScript,
bool aVertical,
int32_t aAppUnitsPerDevUnit,
uint32_t aFlags,
mozilla::gfx::ShapedTextFlags aFlags,
RoundingFlags aRounding,
gfxTextPerfMetrics *aTextPerf);
@ -2042,7 +2040,7 @@ protected:
const char16_t *mDouble;
} mText;
uint32_t mLength;
uint32_t mFlags;
mozilla::gfx::ShapedTextFlags mFlags;
Script mScript;
int32_t mAppUnitsPerDevUnit;
PLDHashNumber mHashKey;
@ -2052,7 +2050,8 @@ protected:
CacheHashKey(const uint8_t *aText, uint32_t aLength,
uint32_t aStringHash,
Script aScriptCode, int32_t aAppUnitsPerDevUnit,
uint32_t aFlags, RoundingFlags aRounding)
mozilla::gfx::ShapedTextFlags aFlags,
RoundingFlags aRounding)
: mLength(aLength),
mFlags(aFlags),
mScript(aScriptCode),
@ -2060,12 +2059,12 @@ protected:
mHashKey(aStringHash
+ static_cast<int32_t>(aScriptCode)
+ aAppUnitsPerDevUnit * 0x100
+ aFlags * 0x10000
+ uint16_t(aFlags) * 0x10000
+ int(aRounding)),
mTextIs8Bit(true),
mRounding(aRounding)
{
NS_ASSERTION(aFlags & gfxTextRunFactory::TEXT_IS_8BIT,
NS_ASSERTION(aFlags & mozilla::gfx::ShapedTextFlags::TEXT_IS_8BIT,
"8-bit flag should have been set");
mText.mSingle = aText;
}
@ -2073,7 +2072,8 @@ protected:
CacheHashKey(const char16_t *aText, uint32_t aLength,
uint32_t aStringHash,
Script aScriptCode, int32_t aAppUnitsPerDevUnit,
uint32_t aFlags, RoundingFlags aRounding)
mozilla::gfx::ShapedTextFlags aFlags,
RoundingFlags aRounding)
: mLength(aLength),
mFlags(aFlags),
mScript(aScriptCode),
@ -2081,7 +2081,7 @@ protected:
mHashKey(aStringHash
+ static_cast<int32_t>(aScriptCode)
+ aAppUnitsPerDevUnit * 0x100
+ aFlags * 0x10000
+ uint16_t(aFlags) * 0x10000
+ int(aRounding)),
mTextIs8Bit(false),
mRounding(aRounding)

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

@ -141,7 +141,7 @@ gfxGDIFont::Measure(const gfxTextRun *aTextRun,
BoundingBoxType aBoundingBoxType,
DrawTarget *aRefDrawTarget,
Spacing *aSpacing,
uint16_t aOrientation)
gfx::ShapedTextFlags aOrientation)
{
gfxFont::RunMetrics metrics =
gfxFont::Measure(aTextRun, aStart, aEnd, aBoundingBoxType,

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

@ -42,7 +42,7 @@ public:
BoundingBoxType aBoundingBoxType,
DrawTarget *aDrawTargetForTightBoundingBox,
Spacing *aSpacing,
uint16_t aOrientation) override;
mozilla::gfx::ShapedTextFlags aOrientation) override;
/* required for MathML to suppress effects of ClearType "padding" */
mozilla::UniquePtr<gfxFont>

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

@ -1482,7 +1482,7 @@ gfxHarfBuzzShaper::ShapeText(DrawTarget *aDrawTarget,
(isRightToLeft ? HB_DIRECTION_RTL :
HB_DIRECTION_LTR));
hb_script_t scriptTag;
if (aShapedText->GetFlags() & gfxTextRunFactory::TEXT_USE_MATH_SCRIPT) {
if (aShapedText->GetFlags() & gfx::ShapedTextFlags::TEXT_USE_MATH_SCRIPT) {
scriptTag = sMathScript;
} else {
scriptTag = GetHBScriptUsedForShaping(aScript);

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

@ -199,7 +199,7 @@ gfxMacFont::Measure(const gfxTextRun *aTextRun,
BoundingBoxType aBoundingBoxType,
DrawTarget *aRefDrawTarget,
Spacing *aSpacing,
uint16_t aOrientation)
gfx::ShapedTextFlags aOrientation)
{
gfxFont::RunMetrics metrics =
gfxFont::Measure(aTextRun, aStart, aEnd,

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

@ -39,7 +39,7 @@ public:
BoundingBoxType aBoundingBoxType,
DrawTarget *aDrawTargetForTightBoundingBox,
Spacing *aSpacing,
uint16_t aOrientation) override;
mozilla::gfx::ShapedTextFlags aOrientation) override;
// We need to provide hinted (non-linear) glyph widths if using a font
// with embedded color bitmaps (Apple Color Emoji), as Core Text renders

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

@ -2045,7 +2045,7 @@ static void ShutdownCMS()
void
gfxPlatform::SetupClusterBoundaries(gfxTextRun *aTextRun, const char16_t *aString)
{
if (aTextRun->GetFlags() & gfxTextRunFactory::TEXT_IS_8BIT) {
if (aTextRun->GetFlags() & gfx::ShapedTextFlags::TEXT_IS_8BIT) {
// 8-bit text doesn't have clusters.
// XXX is this true in all languages???
// behdad: don't think so. Czech for example IIRC has a

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

@ -111,7 +111,7 @@ AccountStorageForTextRun(gfxTextRun *aTextRun, int32_t aSign)
static bool
NeedsGlyphExtents(gfxTextRun *aTextRun)
{
if (aTextRun->GetFlags() & gfxTextRunFactory::TEXT_NEED_BOUNDING_BOX)
if (aTextRun->GetFlags() & gfx::ShapedTextFlags::TEXT_NEED_BOUNDING_BOX)
return true;
uint32_t numRuns;
const gfxTextRun::GlyphRun *glyphRuns = aTextRun->GetGlyphRuns(&numRuns);
@ -145,7 +145,9 @@ gfxTextRun::AllocateStorageForTextRun(size_t aSize, uint32_t aLength)
already_AddRefed<gfxTextRun>
gfxTextRun::Create(const gfxTextRunFactory::Parameters *aParams,
uint32_t aLength, gfxFontGroup *aFontGroup, uint32_t aFlags)
uint32_t aLength, gfxFontGroup *aFontGroup,
gfx::ShapedTextFlags aFlags,
nsTextFrameUtils::Flags aFlags2)
{
void *storage = AllocateStorageForTextRun(sizeof(gfxTextRun), aLength);
if (!storage) {
@ -153,16 +155,20 @@ gfxTextRun::Create(const gfxTextRunFactory::Parameters *aParams,
}
RefPtr<gfxTextRun> result = new (storage) gfxTextRun(aParams, aLength,
aFontGroup, aFlags);
aFontGroup,
aFlags, aFlags2);
return result.forget();
}
gfxTextRun::gfxTextRun(const gfxTextRunFactory::Parameters *aParams,
uint32_t aLength, gfxFontGroup *aFontGroup, uint32_t aFlags)
uint32_t aLength, gfxFontGroup *aFontGroup,
gfx::ShapedTextFlags aFlags,
nsTextFrameUtils::Flags aFlags2)
: gfxShapedText(aLength, aFlags, aParams->mAppUnitsPerDevUnit)
, mSingleGlyphRun()
, mUserData(aParams->mUserData)
, mFontGroup(aFontGroup)
, mFlags2(aFlags2)
, mReleasedFontGroup(false)
, mHasGlyphRunArray(false)
, mShapingState(eShapingState_Normal)
@ -197,7 +203,8 @@ gfxTextRun::~gfxTextRun()
#endif
#ifdef DEBUG
// Make it easy to detect a dead text run
mFlags = 0xFFFFFFFF;
mFlags = ~gfx::ShapedTextFlags();
mFlags2 = ~nsTextFrameUtils::Flags();
#endif
if (mHasGlyphRunArray) {
@ -318,7 +325,7 @@ gfxTextRun::ComputeLigatureData(Range aPartRange,
result.mClipAfterPart = partClusterIndex + partClusterCount < totalClusterCount;
}
if (aProvider && (mFlags & gfxTextRunFactory::TEXT_ENABLE_SPACING)) {
if (aProvider && (mFlags & gfx::ShapedTextFlags::TEXT_ENABLE_SPACING)) {
gfxFont::Spacing spacing;
if (aPartRange.start == result.mRange.start) {
aProvider->GetSpacing(
@ -390,7 +397,7 @@ gfxTextRun::GetAdjustedSpacingArray(Range aRange, PropertyProvider *aProvider,
nsTArray<PropertyProvider::Spacing>*
aSpacing) const
{
if (!aProvider || !(mFlags & gfxTextRunFactory::TEXT_ENABLE_SPACING))
if (!aProvider || !(mFlags & gfx::ShapedTextFlags::TEXT_ENABLE_SPACING))
return false;
if (!aSpacing->AppendElements(aRange.Length()))
return false;
@ -426,7 +433,8 @@ gfxTextRun::ShrinkToLigatureBoundaries(Range* aRange) const
void
gfxTextRun::DrawGlyphs(gfxFont *aFont, Range aRange, gfxPoint *aPt,
PropertyProvider *aProvider, Range aSpacingRange,
TextRunDrawParams& aParams, uint16_t aOrientation) const
TextRunDrawParams& aParams,
gfx::ShapedTextFlags aOrientation) const
{
AutoTArray<PropertyProvider::Spacing,200> spacingBuffer;
bool haveSpacing = GetAdjustedSpacingArray(aRange, aProvider,
@ -463,7 +471,7 @@ void
gfxTextRun::DrawPartialLigature(gfxFont *aFont, Range aRange,
gfxPoint *aPt, PropertyProvider *aProvider,
TextRunDrawParams& aParams,
uint16_t aOrientation) const
gfx::ShapedTextFlags aOrientation) const
{
if (aRange.start >= aRange.end) {
return;
@ -766,7 +774,7 @@ gfxTextRun::AccumulateMetricsForRun(gfxFont *aFont, Range aRange,
DrawTarget* aRefDrawTarget,
PropertyProvider *aProvider,
Range aSpacingRange,
uint16_t aOrientation,
gfx::ShapedTextFlags aOrientation,
Metrics *aMetrics) const
{
AutoTArray<PropertyProvider::Spacing,200> spacingBuffer;
@ -782,7 +790,7 @@ gfxTextRun::AccumulateMetricsForRun(gfxFont *aFont, Range aRange,
void
gfxTextRun::AccumulatePartialLigatureMetrics(gfxFont *aFont, Range aRange,
gfxFont::BoundingBoxType aBoundingBoxType, DrawTarget* aRefDrawTarget,
PropertyProvider *aProvider, uint16_t aOrientation,
PropertyProvider *aProvider, gfx::ShapedTextFlags aOrientation,
Metrics *aMetrics) const
{
if (aRange.start >= aRange.end)
@ -949,7 +957,8 @@ gfxTextRun::BreakAndMeasureText(uint32_t aStart, uint32_t aMaxLength,
Range bufferRange(aStart, aStart +
std::min<uint32_t>(aMaxLength, MEASUREMENT_BUFFER_SIZE));
PropertyProvider::Spacing spacingBuffer[MEASUREMENT_BUFFER_SIZE];
bool haveSpacing = aProvider && (mFlags & gfxTextRunFactory::TEXT_ENABLE_SPACING) != 0;
bool haveSpacing = aProvider &&
!!(mFlags & gfx::ShapedTextFlags::TEXT_ENABLE_SPACING);
if (haveSpacing) {
GetAdjustedSpacing(this, bufferRange, aProvider, spacingBuffer);
}
@ -959,7 +968,7 @@ gfxTextRun::BreakAndMeasureText(uint32_t aStart, uint32_t aMaxLength,
bool haveHyphenation = aProvider &&
(aProvider->GetHyphensOption() == StyleHyphens::Auto ||
(aProvider->GetHyphensOption() == StyleHyphens::Manual &&
(mFlags & gfxTextRunFactory::TEXT_ENABLE_HYPHEN_BREAKS) != 0));
!!(mFlags & gfx::ShapedTextFlags::TEXT_ENABLE_HYPHEN_BREAKS)));
if (haveHyphenation) {
if (hyphenBuffer.AppendElements(bufferRange.Length(), fallible)) {
aProvider->GetHyphenationBreaks(bufferRange, hyphenBuffer.Elements());
@ -1224,7 +1233,7 @@ gfxTextRun::GetAdvanceWidth(Range aRange, PropertyProvider *aProvider,
// Account for all remaining spacing here. This is more efficient than
// processing it along with the glyphs.
if (aProvider && (mFlags & gfxTextRunFactory::TEXT_ENABLE_SPACING)) {
if (aProvider && (mFlags & gfx::ShapedTextFlags::TEXT_ENABLE_SPACING)) {
uint32_t i;
AutoTArray<PropertyProvider::Spacing,200> spacingBuffer;
if (spacingBuffer.AppendElements(aRange.Length())) {
@ -1289,10 +1298,10 @@ gfxTextRun::FindFirstGlyphRunContaining(uint32_t aOffset) const
nsresult
gfxTextRun::AddGlyphRun(gfxFont *aFont, uint8_t aMatchType,
uint32_t aUTF16Offset, bool aForceNewRun,
uint16_t aOrientation)
gfx::ShapedTextFlags aOrientation)
{
NS_ASSERTION(aFont, "adding glyph run for null font!");
NS_ASSERTION(aOrientation != gfxTextRunFactory::TEXT_ORIENT_VERTICAL_MIXED,
NS_ASSERTION(aOrientation != gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_MIXED,
"mixed orientation should have been resolved");
if (!aFont) {
return NS_OK;
@ -1392,7 +1401,7 @@ gfxTextRun::SortGlyphRuns()
// Now copy back, coalescing adjacent glyph runs that have the same font
mGlyphRunArray.Clear();
gfxFont* prevFont = nullptr;
uint16_t prevOrient = 0;
gfx::ShapedTextFlags prevOrient = gfx::ShapedTextFlags();
DebugOnly<uint32_t> prevOffset = 0;
for (auto& run : runs) {
// a GlyphRun with the same font and orientation as the previous can
@ -1593,7 +1602,8 @@ gfxTextRun::ClearGlyphsAndCharacters()
void
gfxTextRun::SetSpaceGlyph(gfxFont* aFont, DrawTarget* aDrawTarget,
uint32_t aCharIndex, uint16_t aOrientation)
uint32_t aCharIndex,
gfx::ShapedTextFlags aOrientation)
{
if (SetSpaceGlyphIfSimple(aFont, aCharIndex, ' ', aOrientation)) {
return;
@ -1601,12 +1611,12 @@ gfxTextRun::SetSpaceGlyph(gfxFont* aFont, DrawTarget* aDrawTarget,
aFont->InitWordCache();
static const uint8_t space = ' ';
uint32_t flags = gfxTextRunFactory::TEXT_IS_8BIT |
gfxTextRunFactory::TEXT_IS_ASCII |
gfxTextRunFactory::TEXT_IS_PERSISTENT |
aOrientation;
gfx::ShapedTextFlags
flags = gfx::ShapedTextFlags::TEXT_IS_8BIT |
gfx::ShapedTextFlags::TEXT_IS_PERSISTENT |
aOrientation;
bool vertical =
(GetFlags() & gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT) != 0;
!!(GetFlags() & gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_UPRIGHT);
gfxFontShaper::RoundingFlags roundingFlags =
aFont->GetRoundOffsetsToPixels(aDrawTarget);
gfxShapedWord* sw = aFont->GetShapedWord(aDrawTarget,
@ -1627,7 +1637,8 @@ gfxTextRun::SetSpaceGlyph(gfxFont* aFont, DrawTarget* aDrawTarget,
bool
gfxTextRun::SetSpaceGlyphIfSimple(gfxFont* aFont, uint32_t aCharIndex,
char16_t aSpaceChar, uint16_t aOrientation)
char16_t aSpaceChar,
gfx::ShapedTextFlags aOrientation)
{
uint32_t spaceGlyph = aFont->GetSpaceGlyph();
if (!spaceGlyph || !CompressedGlyph::IsSimpleGlyphID(spaceGlyph)) {
@ -1635,7 +1646,7 @@ gfxTextRun::SetSpaceGlyphIfSimple(gfxFont* aFont, uint32_t aCharIndex,
}
gfxFont::Orientation fontOrientation =
(aOrientation & gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT) ?
(aOrientation & gfx::ShapedTextFlags::TEXT_ORIENT_VERTICAL_UPRIGHT) ?
gfxFont::eVertical : gfxFont::eHorizontal;
uint32_t spaceWidthAppUnits =
NS_lroundf(aFont->GetMetrics(fontOrientation).spaceWidth *
@ -2169,26 +2180,30 @@ gfxFontGroup::IsInvalidChar(char16_t ch)
}
already_AddRefed<gfxTextRun>
gfxFontGroup::MakeEmptyTextRun(const Parameters *aParams, uint32_t aFlags)
gfxFontGroup::MakeEmptyTextRun(const Parameters *aParams,
gfx::ShapedTextFlags aFlags,
nsTextFrameUtils::Flags aFlags2)
{
aFlags |= TEXT_IS_8BIT | TEXT_IS_ASCII | TEXT_IS_PERSISTENT;
return gfxTextRun::Create(aParams, 0, this, aFlags);
aFlags |= ShapedTextFlags::TEXT_IS_8BIT | ShapedTextFlags::TEXT_IS_PERSISTENT;
return gfxTextRun::Create(aParams, 0, this, aFlags, aFlags2);
}
already_AddRefed<gfxTextRun>
gfxFontGroup::MakeSpaceTextRun(const Parameters *aParams, uint32_t aFlags)
gfxFontGroup::MakeSpaceTextRun(const Parameters *aParams,
gfx::ShapedTextFlags aFlags,
nsTextFrameUtils::Flags aFlags2)
{
aFlags |= TEXT_IS_8BIT | TEXT_IS_ASCII | TEXT_IS_PERSISTENT;
aFlags |= ShapedTextFlags::TEXT_IS_8BIT | ShapedTextFlags::TEXT_IS_PERSISTENT;
RefPtr<gfxTextRun> textRun =
gfxTextRun::Create(aParams, 1, this, aFlags);
gfxTextRun::Create(aParams, 1, this, aFlags, aFlags2);
if (!textRun) {
return nullptr;
}
uint16_t orientation = aFlags & TEXT_ORIENT_MASK;
if (orientation == TEXT_ORIENT_VERTICAL_MIXED) {
orientation = TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT;
gfx::ShapedTextFlags orientation = aFlags & ShapedTextFlags::TEXT_ORIENT_MASK;
if (orientation == ShapedTextFlags::TEXT_ORIENT_VERTICAL_MIXED) {
orientation = ShapedTextFlags::TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT;
}
gfxFont *font = GetFirstValidFont();
@ -2227,17 +2242,19 @@ gfxFontGroup::MakeSpaceTextRun(const Parameters *aParams, uint32_t aFlags)
already_AddRefed<gfxTextRun>
gfxFontGroup::MakeBlankTextRun(uint32_t aLength,
const Parameters *aParams, uint32_t aFlags)
const Parameters *aParams,
gfx::ShapedTextFlags aFlags,
nsTextFrameUtils::Flags aFlags2)
{
RefPtr<gfxTextRun> textRun =
gfxTextRun::Create(aParams, aLength, this, aFlags);
gfxTextRun::Create(aParams, aLength, this, aFlags, aFlags2);
if (!textRun) {
return nullptr;
}
uint16_t orientation = aFlags & TEXT_ORIENT_MASK;
if (orientation == TEXT_ORIENT_VERTICAL_MIXED) {
orientation = TEXT_ORIENT_VERTICAL_UPRIGHT;
gfx::ShapedTextFlags orientation = aFlags & ShapedTextFlags::TEXT_ORIENT_MASK;
if (orientation == ShapedTextFlags::TEXT_ORIENT_VERTICAL_MIXED) {
orientation = ShapedTextFlags::TEXT_ORIENT_VERTICAL_UPRIGHT;
}
textRun->AddGlyphRun(GetFirstValidFont(), gfxTextRange::kFontGroup, 0, false,
orientation);
@ -2255,12 +2272,14 @@ gfxFontGroup::MakeHyphenTextRun(DrawTarget* aDrawTarget,
gfxFont *font = GetFirstValidFont(uint32_t(hyphen));
if (font->HasCharacter(hyphen)) {
return MakeTextRun(&hyphen, 1, aDrawTarget, aAppUnitsPerDevUnit,
gfxFontGroup::TEXT_IS_PERSISTENT, nullptr);
ShapedTextFlags::TEXT_IS_PERSISTENT,
nsTextFrameUtils::Flags(), nullptr);
}
static const uint8_t dash = '-';
return MakeTextRun(&dash, 1, aDrawTarget, aAppUnitsPerDevUnit,
gfxFontGroup::TEXT_IS_PERSISTENT, nullptr);
ShapedTextFlags::TEXT_IS_PERSISTENT,
nsTextFrameUtils::Flags(), nullptr);
}
gfxFloat
@ -2280,28 +2299,30 @@ gfxFontGroup::GetHyphenWidth(const gfxTextRun::PropertyProvider* aProvider)
already_AddRefed<gfxTextRun>
gfxFontGroup::MakeTextRun(const uint8_t *aString, uint32_t aLength,
const Parameters *aParams, uint32_t aFlags,
const Parameters *aParams,
gfx::ShapedTextFlags aFlags,
nsTextFrameUtils::Flags aFlags2,
gfxMissingFontRecorder *aMFR)
{
if (aLength == 0) {
return MakeEmptyTextRun(aParams, aFlags);
return MakeEmptyTextRun(aParams, aFlags, aFlags2);
}
if (aLength == 1 && aString[0] == ' ') {
return MakeSpaceTextRun(aParams, aFlags);
return MakeSpaceTextRun(aParams, aFlags, aFlags2);
}
aFlags |= TEXT_IS_8BIT;
aFlags |= ShapedTextFlags::TEXT_IS_8BIT;
if (MOZ_UNLIKELY(GetStyle()->size == 0) ||
MOZ_UNLIKELY(GetStyle()->sizeAdjust == 0.0f)) {
// Short-circuit for size-0 fonts, as Windows and ATSUI can't handle
// them, and always create at least size 1 fonts, i.e. they still
// render something for size 0 fonts.
return MakeBlankTextRun(aLength, aParams, aFlags);
return MakeBlankTextRun(aLength, aParams, aFlags, aFlags2);
}
RefPtr<gfxTextRun> textRun = gfxTextRun::Create(aParams, aLength, this,
aFlags);
aFlags, aFlags2);
if (!textRun) {
return nullptr;
}
@ -2315,22 +2336,24 @@ gfxFontGroup::MakeTextRun(const uint8_t *aString, uint32_t aLength,
already_AddRefed<gfxTextRun>
gfxFontGroup::MakeTextRun(const char16_t *aString, uint32_t aLength,
const Parameters *aParams, uint32_t aFlags,
const Parameters *aParams,
gfx::ShapedTextFlags aFlags,
nsTextFrameUtils::Flags aFlags2,
gfxMissingFontRecorder *aMFR)
{
if (aLength == 0) {
return MakeEmptyTextRun(aParams, aFlags);
return MakeEmptyTextRun(aParams, aFlags, aFlags2);
}
if (aLength == 1 && aString[0] == ' ') {
return MakeSpaceTextRun(aParams, aFlags);
return MakeSpaceTextRun(aParams, aFlags, aFlags2);
}
if (MOZ_UNLIKELY(GetStyle()->size == 0) ||
MOZ_UNLIKELY(GetStyle()->sizeAdjust == 0.0f)) {
return MakeBlankTextRun(aLength, aParams, aFlags);
return MakeBlankTextRun(aLength, aParams, aFlags, aFlags2);
}
RefPtr<gfxTextRun> textRun = gfxTextRun::Create(aParams, aLength, this,
aFlags);
aFlags, aFlags2);
if (!textRun) {
return nullptr;
}
@ -2361,7 +2384,7 @@ gfxFontGroup::InitTextRun(DrawTarget* aDrawTarget,
// if we find any, we'll make a local copy here and use that for
// font matching and glyph generation/shaping
bool prevIsArabic =
(aTextRun->GetFlags() & gfxTextRunFactory::TEXT_INCOMING_ARABICCHAR) != 0;
!!(aTextRun->GetFlags() & ShapedTextFlags::TEXT_INCOMING_ARABICCHAR);
for (uint32_t i = 0; i < aLength; ++i) {
char16_t origCh = aString[i];
char16_t newCh = HandleNumberInChar(origCh, prevIsArabic, numOption);
@ -2541,7 +2564,7 @@ gfxFontGroup::InitScriptRun(DrawTarget* aDrawTarget,
uint32_t runStart = 0;
AutoTArray<gfxTextRange,3> fontRanges;
ComputeRanges(fontRanges, aString, aLength, aRunScript,
aTextRun->GetFlags() & gfxTextRunFactory::TEXT_ORIENT_MASK);
aTextRun->GetFlags() & ShapedTextFlags::TEXT_ORIENT_MASK);
uint32_t numRanges = fontRanges.Length();
bool missingChars = false;
@ -2550,7 +2573,7 @@ gfxFontGroup::InitScriptRun(DrawTarget* aDrawTarget,
uint32_t matchedLength = range.Length();
gfxFont *matchedFont = range.font;
bool vertical =
range.orientation == gfxTextRunFactory::TEXT_ORIENT_VERTICAL_UPRIGHT;
range.orientation == ShapedTextFlags::TEXT_ORIENT_VERTICAL_UPRIGHT;
// create the glyph run for this range
if (matchedFont && mStyle.noFallbackVariantFeatures) {
// common case - just do glyph layout and record the
@ -2748,13 +2771,14 @@ gfxFontGroup::InitScriptRun(DrawTarget* aDrawTarget,
}
gfxTextRun *
gfxFontGroup::GetEllipsisTextRun(int32_t aAppUnitsPerDevPixel, uint32_t aFlags,
gfxFontGroup::GetEllipsisTextRun(int32_t aAppUnitsPerDevPixel,
gfx::ShapedTextFlags aFlags,
LazyReferenceDrawTargetGetter& aRefDrawTargetGetter)
{
MOZ_ASSERT(!(aFlags & ~TEXT_ORIENT_MASK),
MOZ_ASSERT(!(aFlags & ~ShapedTextFlags::TEXT_ORIENT_MASK),
"flags here should only be used to specify orientation");
if (mCachedEllipsisTextRun &&
(mCachedEllipsisTextRun->GetFlags() & TEXT_ORIENT_MASK) == aFlags &&
(mCachedEllipsisTextRun->GetFlags() & ShapedTextFlags::TEXT_ORIENT_MASK) == aFlags &&
mCachedEllipsisTextRun->GetAppUnitsPerDevUnit() == aAppUnitsPerDevPixel) {
return mCachedEllipsisTextRun.get();
}
@ -2774,7 +2798,8 @@ gfxFontGroup::GetEllipsisTextRun(int32_t aAppUnitsPerDevPixel, uint32_t aFlags,
};
mCachedEllipsisTextRun =
MakeTextRun(ellipsis.get(), ellipsis.Length(), &params,
aFlags | TEXT_IS_PERSISTENT, nullptr);
aFlags | ShapedTextFlags::TEXT_IS_PERSISTENT,
nsTextFrameUtils::Flags(), nullptr);
if (!mCachedEllipsisTextRun) {
return nullptr;
}
@ -3077,7 +3102,8 @@ gfxFontGroup::FindFontForChar(uint32_t aCh, uint32_t aPrevCh, uint32_t aNextCh,
template<typename T>
void gfxFontGroup::ComputeRanges(nsTArray<gfxTextRange>& aRanges,
const T *aString, uint32_t aLength,
Script aRunScript, uint16_t aOrientation)
Script aRunScript,
gfx::ShapedTextFlags aOrientation)
{
NS_ASSERTION(aRanges.Length() == 0, "aRanges must be initially empty");
NS_ASSERTION(aLength > 0, "don't call ComputeRanges for zero-length text");
@ -3151,18 +3177,18 @@ void gfxFontGroup::ComputeRanges(nsTArray<gfxTextRange>& aRanges,
prevCh = ch;
uint16_t orient = aOrientation;
if (aOrientation == gfxTextRunFactory::TEXT_ORIENT_VERTICAL_MIXED) {
ShapedTextFlags orient = aOrientation;
if (aOrientation == ShapedTextFlags::TEXT_ORIENT_VERTICAL_MIXED) {
// For CSS text-orientation:mixed, we need to resolve orientation
// on a per-character basis using the UTR50 orientation property.
switch (GetVerticalOrientation(ch)) {
case VERTICAL_ORIENTATION_U:
case VERTICAL_ORIENTATION_Tr:
case VERTICAL_ORIENTATION_Tu:
orient = TEXT_ORIENT_VERTICAL_UPRIGHT;
orient = ShapedTextFlags::TEXT_ORIENT_VERTICAL_UPRIGHT;
break;
case VERTICAL_ORIENTATION_R:
orient = TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT;
orient = ShapedTextFlags::TEXT_ORIENT_VERTICAL_SIDEWAYS_RIGHT;
break;
}
}

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

@ -20,6 +20,7 @@
#include "harfbuzz/hb.h"
#include "nsUnicodeScriptCodes.h"
#include "nsColor.h"
#include "nsTextFrameUtils.h"
#ifdef DEBUG
#include <stdio.h>
@ -431,15 +432,11 @@ public:
void *GetUserData() const { return mUserData; }
void SetUserData(void *aUserData) { mUserData = aUserData; }
void SetFlagBits(uint32_t aFlags) {
NS_ASSERTION(!(aFlags & ~gfxTextRunFactory::SETTABLE_FLAGS),
"Only user flags should be mutable");
mFlags |= aFlags;
void SetFlagBits(nsTextFrameUtils::Flags aFlags) {
mFlags2 |= aFlags;
}
void ClearFlagBits(uint32_t aFlags) {
NS_ASSERTION(!(aFlags & ~gfxTextRunFactory::SETTABLE_FLAGS),
"Only user flags should be mutable");
mFlags &= ~aFlags;
void ClearFlagBits(nsTextFrameUtils::Flags aFlags) {
mFlags2 &= ~aFlags;
}
const gfxSkipChars& GetSkipChars() const { return mSkipChars; }
gfxFontGroup *GetFontGroup() const { return mFontGroup; }
@ -450,14 +447,15 @@ public:
static already_AddRefed<gfxTextRun>
Create(const gfxTextRunFactory::Parameters *aParams,
uint32_t aLength, gfxFontGroup *aFontGroup,
uint32_t aFlags);
mozilla::gfx::ShapedTextFlags aFlags,
nsTextFrameUtils::Flags aFlags2);
// The text is divided into GlyphRuns as necessary. (In the vast majority
// of cases, a gfxTextRun contains just a single GlyphRun.)
struct GlyphRun {
RefPtr<gfxFont> mFont; // never null in a valid GlyphRun
uint32_t mCharacterOffset; // into original UTF16 string
uint16_t mOrientation; // gfxTextRunFactory::TEXT_ORIENT_* value
mozilla::gfx::ShapedTextFlags mOrientation; // gfxTextRunFactory::TEXT_ORIENT_* value
uint8_t mMatchType;
};
@ -518,15 +516,18 @@ public:
*/
nsresult AddGlyphRun(gfxFont *aFont, uint8_t aMatchType,
uint32_t aStartCharIndex, bool aForceNewRun,
uint16_t aOrientation);
mozilla::gfx::ShapedTextFlags aOrientation);
void ResetGlyphRuns()
{
if (mHasGlyphRunArray) {
mGlyphRunArray.~nsTArray<GlyphRun>();
mHasGlyphRunArray = false;
} else {
mSingleGlyphRun.mFont = nullptr;
MOZ_ASSERT(mGlyphRunArray.Length() > 1);
// Discard all but the first GlyphRun...
mGlyphRunArray.TruncateLength(1);
// ...and then convert to the single-run representation.
ConvertFromGlyphRunArray();
}
// Clear out the one remaining GlyphRun.
mSingleGlyphRun.mFont = nullptr;
}
void SortGlyphRuns();
void SanitizeGlyphRuns();
@ -544,7 +545,8 @@ public:
void ClearGlyphsAndCharacters();
void SetSpaceGlyph(gfxFont* aFont, DrawTarget* aDrawTarget,
uint32_t aCharIndex, uint16_t aOrientation);
uint32_t aCharIndex,
mozilla::gfx::ShapedTextFlags aOrientation);
// Set the glyph data for the given character index to the font's
// space glyph, IF this can be done as a "simple" glyph record
@ -560,7 +562,8 @@ public:
// if it returns false, the caller needs to fall back to some other
// means to create the necessary (detailed) glyph data.
bool SetSpaceGlyphIfSimple(gfxFont *aFont, uint32_t aCharIndex,
char16_t aSpaceChar, uint16_t aOrientation);
char16_t aSpaceChar,
mozilla::gfx::ShapedTextFlags aOrientation);
// Record the positions of specific characters that layout may need to
// detect in the textrun, even though it doesn't have an explicit copy
@ -639,23 +642,27 @@ public:
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
MOZ_MUST_OVERRIDE;
nsTextFrameUtils::Flags GetFlags2() const {
return mFlags2;
}
// Get the size, if it hasn't already been gotten, marking as it goes.
size_t MaybeSizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) {
if (mFlags & gfxTextRunFactory::TEXT_RUN_SIZE_ACCOUNTED) {
if (mFlags2 & nsTextFrameUtils::Flags::TEXT_RUN_SIZE_ACCOUNTED) {
return 0;
}
mFlags |= gfxTextRunFactory::TEXT_RUN_SIZE_ACCOUNTED;
mFlags2 |= nsTextFrameUtils::Flags::TEXT_RUN_SIZE_ACCOUNTED;
return SizeOfIncludingThis(aMallocSizeOf);
}
void ResetSizeOfAccountingFlags() {
mFlags &= ~gfxTextRunFactory::TEXT_RUN_SIZE_ACCOUNTED;
mFlags2 &= ~nsTextFrameUtils::Flags::TEXT_RUN_SIZE_ACCOUNTED;
}
// shaping state - for some font features, fallback is required that
// affects the entire run. for example, fallback for one script/font
// portion of a textrun requires fallback to be applied to the entire run
enum ShapingState {
enum ShapingState : uint8_t {
eShapingState_Normal, // default state
eShapingState_ShapingWithFeature, // have shaped with feature
eShapingState_ShapingWithFallback, // have shaped with fallback
@ -698,7 +705,9 @@ protected:
* follow the base textrun object.
*/
gfxTextRun(const gfxTextRunFactory::Parameters *aParams,
uint32_t aLength, gfxFontGroup *aFontGroup, uint32_t aFlags);
uint32_t aLength, gfxFontGroup *aFontGroup,
mozilla::gfx::ShapedTextFlags aFlags,
nsTextFrameUtils::Flags aFlags2);
/**
* Helper for the Create() factory method to allocate the required
@ -744,7 +753,7 @@ private:
void DrawPartialLigature(gfxFont *aFont, Range aRange,
gfxPoint *aPt, PropertyProvider *aProvider,
TextRunDrawParams& aParams,
uint16_t aOrientation) const;
mozilla::gfx::ShapedTextFlags aOrientation) const;
// Advance aRange.start to the start of the nearest ligature, back
// up aRange.end to the nearest ligature end; may result in
// aRange->start == aRange->end.
@ -756,7 +765,7 @@ private:
gfxFont::BoundingBoxType aBoundingBoxType,
DrawTarget* aRefDrawTarget,
PropertyProvider *aProvider,
uint16_t aOrientation,
mozilla::gfx::ShapedTextFlags aOrientation,
Metrics *aMetrics) const;
// **** measurement helper ****
@ -765,13 +774,14 @@ private:
DrawTarget* aRefDrawTarget,
PropertyProvider *aProvider,
Range aSpacingRange,
uint16_t aOrientation,
mozilla::gfx::ShapedTextFlags aOrientation,
Metrics *aMetrics) const;
// **** drawing helper ****
void DrawGlyphs(gfxFont *aFont, Range aRange, gfxPoint *aPt,
PropertyProvider *aProvider, Range aSpacingRange,
TextRunDrawParams& aParams, uint16_t aOrientation) const;
TextRunDrawParams& aParams,
mozilla::gfx::ShapedTextFlags aOrientation) const;
// The textrun holds either a single GlyphRun -or- an array;
// the flag mHasGlyphRunArray tells us which is present.
@ -802,6 +812,8 @@ private:
// may be released by ReleaseFontGroup()
gfxSkipChars mSkipChars;
nsTextFrameUtils::Flags mFlags2; // additional flags (see also gfxShapedText::mFlags)
bool mSkipDrawing; // true if the font group we used had a user font
// download that's in progress, so we should hide text
// until the download completes (or timeout fires)
@ -857,7 +869,9 @@ public:
*/
virtual already_AddRefed<gfxTextRun>
MakeTextRun(const char16_t *aString, uint32_t aLength,
const Parameters *aParams, uint32_t aFlags,
const Parameters *aParams,
mozilla::gfx::ShapedTextFlags aFlags,
nsTextFrameUtils::Flags aFlags2,
gfxMissingFontRecorder *aMFR);
/**
* Make a textrun for a given string.
@ -867,7 +881,9 @@ public:
*/
virtual already_AddRefed<gfxTextRun>
MakeTextRun(const uint8_t *aString, uint32_t aLength,
const Parameters *aParams, uint32_t aFlags,
const Parameters *aParams,
mozilla::gfx::ShapedTextFlags aFlags,
nsTextFrameUtils::Flags aFlags2,
gfxMissingFontRecorder *aMFR);
/**
@ -879,13 +895,14 @@ public:
MakeTextRun(const T* aString, uint32_t aLength,
DrawTarget* aRefDrawTarget,
int32_t aAppUnitsPerDevUnit,
uint32_t aFlags,
mozilla::gfx::ShapedTextFlags aFlags,
nsTextFrameUtils::Flags aFlags2,
gfxMissingFontRecorder *aMFR)
{
gfxTextRunFactory::Parameters params = {
aRefDrawTarget, nullptr, nullptr, nullptr, 0, aAppUnitsPerDevUnit
};
return MakeTextRun(aString, aLength, &params, aFlags, aMFR);
return MakeTextRun(aString, aLength, &params, aFlags, aFlags2, aMFR);
}
// Get the (possibly-cached) width of the hyphen character.
@ -966,7 +983,8 @@ public:
// (which might use a different appUnitsPerDev value or flags) for the font
// group, or until UpdateUserFonts is called, or the fontgroup is destroyed.
// Get it/use it/forget it :) - don't keep a reference that might go stale.
gfxTextRun* GetEllipsisTextRun(int32_t aAppUnitsPerDevPixel, uint32_t aFlags,
gfxTextRun* GetEllipsisTextRun(int32_t aAppUnitsPerDevPixel,
mozilla::gfx::ShapedTextFlags aFlags,
LazyReferenceDrawTargetGetter& aRefDrawTargetGetter);
protected:
@ -980,7 +998,8 @@ protected:
template<typename T>
void ComputeRanges(nsTArray<gfxTextRange>& mRanges,
const T *aString, uint32_t aLength,
Script aRunScript, uint16_t aOrientation);
Script aRunScript,
mozilla::gfx::ShapedTextFlags aOrientation);
class FamilyFace {
public:
@ -1158,14 +1177,19 @@ protected:
* call a font shaper to generate glyphs.
*/
already_AddRefed<gfxTextRun>
MakeEmptyTextRun(const Parameters *aParams, uint32_t aFlags);
MakeEmptyTextRun(const Parameters *aParams,
mozilla::gfx::ShapedTextFlags aFlags,
nsTextFrameUtils::Flags aFlags2);
already_AddRefed<gfxTextRun>
MakeSpaceTextRun(const Parameters *aParams, uint32_t aFlags);
MakeSpaceTextRun(const Parameters *aParams,
mozilla::gfx::ShapedTextFlags aFlags,
nsTextFrameUtils::Flags aFlags2);
already_AddRefed<gfxTextRun>
MakeBlankTextRun(uint32_t aLength, const Parameters *aParams,
uint32_t aFlags);
mozilla::gfx::ShapedTextFlags aFlags,
nsTextFrameUtils::Flags aFlags2);
// Initialize the list of fonts
void BuildFontList();

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

@ -435,11 +435,20 @@ FrameAnimator::RequestRefresh(AnimationState& aState,
LookupResult
FrameAnimator::GetCompositedFrame(AnimationState& aState)
{
LookupResult result =
SurfaceCache::Lookup(ImageKey(mImage),
RasterSurfaceKey(mSize,
DefaultSurfaceFlags(),
PlaybackType::eAnimated));
if (aState.mCompositedFrameInvalid) {
MOZ_ASSERT(gfxPrefs::ImageMemAnimatedDiscardable());
MOZ_ASSERT(aState.GetHasBeenDecoded());
MOZ_ASSERT(!aState.GetIsCurrentlyDecoded());
return LookupResult(MatchType::NOT_FOUND);
if (result.Type() == MatchType::NOT_FOUND) {
return result;
}
return LookupResult(MatchType::PENDING);
}
// If we have a composited version of this frame, return that.
@ -451,11 +460,6 @@ FrameAnimator::GetCompositedFrame(AnimationState& aState)
// Otherwise return the raw frame. DoBlend is required to ensure that we only
// hit this case if the frame is not paletted and doesn't require compositing.
LookupResult result =
SurfaceCache::Lookup(ImageKey(mImage),
RasterSurfaceKey(mSize,
DefaultSurfaceFlags(),
PlaybackType::eAnimated));
if (!result) {
return result;
}
@ -463,7 +467,10 @@ FrameAnimator::GetCompositedFrame(AnimationState& aState)
// Seek to the appropriate frame. If seeking fails, it means that we couldn't
// get the frame we're looking for; treat this as if the lookup failed.
if (NS_FAILED(result.Surface().Seek(aState.mCurrentAnimationFrameIndex))) {
return LookupResult(MatchType::NOT_FOUND);
if (result.Type() == MatchType::NOT_FOUND) {
return result;
}
return LookupResult(MatchType::PENDING);
}
MOZ_ASSERT(!result.Surface()->GetIsPaletted(),

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше