mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-24 16:17:29 +09:00
[Layout] Hold stronger references to FontFaces.
This commit is contained in:
parent
0c2770ff7b
commit
5e12078904
1 changed files with 13 additions and 8 deletions
|
|
@ -324,10 +324,18 @@ FontFaceSet::Load(JSContext* aCx,
|
||||||
|
|
||||||
nsTArray<RefPtr<Promise>> promises;
|
nsTArray<RefPtr<Promise>> promises;
|
||||||
|
|
||||||
nsTArray<FontFace*> faces;
|
nsTArray<RefPtr<FontFace>> faces;
|
||||||
FindMatchingFontFaces(aFont, aText, faces, aRv);
|
{
|
||||||
if (aRv.Failed()) {
|
nsTArray<FontFace*> weakFaces;
|
||||||
return nullptr;
|
FindMatchingFontFaces(aFont, aText, weakFaces, aRv);
|
||||||
|
if (aRv.Failed()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
if (!faces.AppendElements(weakFaces, fallible) ||
|
||||||
|
!promises.SetCapacity(weakFaces.Length(), fallible)) {
|
||||||
|
aRv.Throw(NS_ERROR_FAILURE);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (FontFace* f : faces) {
|
for (FontFace* f : faces) {
|
||||||
|
|
@ -335,10 +343,7 @@ FontFaceSet::Load(JSContext* aCx,
|
||||||
if (aRv.Failed()) {
|
if (aRv.Failed()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (!promises.AppendElement(promise, fallible)) {
|
promises.AppendElement(promise);
|
||||||
aRv.Throw(NS_ERROR_FAILURE);
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise::All(aCx, promises, aRv);
|
return Promise::All(aCx, promises, aRv);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue