Bug 1163879 - Remove FontFaceSet::mUnavailableFontFaces. r=jdaggett
This commit is contained in:
@@ -77,9 +77,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(FontFace)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(FontFace)
|
||||
if (!tmp->IsInFontFaceSet()) {
|
||||
tmp->mFontFaceSet->RemoveUnavailableFontFace(tmp);
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mParent)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mLoaded)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mRule)
|
||||
@@ -127,10 +124,6 @@ FontFace::~FontFace()
|
||||
|
||||
SetUserFontEntry(nullptr);
|
||||
|
||||
if (mFontFaceSet && !IsInFontFaceSet()) {
|
||||
mFontFaceSet->RemoveUnavailableFontFace(this);
|
||||
}
|
||||
|
||||
if (mSourceBuffer) {
|
||||
free(mSourceBuffer);
|
||||
}
|
||||
@@ -189,7 +182,6 @@ FontFace::Constructor(const GlobalObject& aGlobal,
|
||||
}
|
||||
|
||||
nsRefPtr<FontFace> obj = new FontFace(global, doc->Fonts());
|
||||
obj->mFontFaceSet->AddUnavailableFontFace(obj);
|
||||
if (!obj->SetDescriptors(aFamily, aDescriptors)) {
|
||||
return obj.forget();
|
||||
}
|
||||
|
||||
@@ -232,12 +232,6 @@ FontFaceSet::Add(FontFace& aFontFace, ErrorResult& aRv)
|
||||
MOZ_ASSERT(!aFontFace.HasRule(),
|
||||
"rule-backed FontFaces should always be in the FontFaceSet");
|
||||
|
||||
bool removed = mUnavailableFaces.RemoveElement(&aFontFace);
|
||||
if (!removed) {
|
||||
MOZ_ASSERT(false, "should have found aFontFace in mUnavailableFaces");
|
||||
return this;
|
||||
}
|
||||
|
||||
aFontFace.SetIsInFontFaceSet(true);
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -273,11 +267,6 @@ FontFaceSet::Clear()
|
||||
for (size_t i = 0; i < mNonRuleFaces.Length(); i++) {
|
||||
FontFace* f = mNonRuleFaces[i].mFontFace;
|
||||
f->SetIsInFontFaceSet(false);
|
||||
|
||||
MOZ_ASSERT(!mUnavailableFaces.Contains(f),
|
||||
"FontFace should not occur in mUnavailableFaces twice");
|
||||
|
||||
mUnavailableFaces.AppendElement(f);
|
||||
}
|
||||
|
||||
mNonRuleFaces.Clear();
|
||||
@@ -310,11 +299,6 @@ FontFaceSet::Delete(FontFace& aFontFace)
|
||||
|
||||
aFontFace.SetIsInFontFaceSet(false);
|
||||
|
||||
MOZ_ASSERT(!mUnavailableFaces.Contains(&aFontFace),
|
||||
"FontFace should not occur in mUnavailableFaces twice");
|
||||
|
||||
mUnavailableFaces.AppendElement(&aFontFace);
|
||||
|
||||
mNonRuleFacesDirty = true;
|
||||
RebuildUserFontSet();
|
||||
mHasLoadingFontFacesIsDirty = true;
|
||||
@@ -607,10 +591,6 @@ FontFaceSet::UpdateRules(const nsTArray<nsFontFaceRuleContainer>& aRules)
|
||||
}
|
||||
|
||||
// Any left over FontFace objects should also cease being rule backed.
|
||||
MOZ_ASSERT(!mUnavailableFaces.Contains(f),
|
||||
"FontFace should not occur in mUnavailableFaces twice");
|
||||
|
||||
mUnavailableFaces.AppendElement(f);
|
||||
f->DisconnectFromRule();
|
||||
}
|
||||
}
|
||||
@@ -1260,30 +1240,6 @@ FontFaceSet::GetPrivateBrowsing()
|
||||
return loadContext && loadContext->UsePrivateBrowsing();
|
||||
}
|
||||
|
||||
void
|
||||
FontFaceSet::AddUnavailableFontFace(FontFace* aFontFace)
|
||||
{
|
||||
MOZ_ASSERT(!aFontFace->HasRule());
|
||||
MOZ_ASSERT(!aFontFace->IsInFontFaceSet());
|
||||
MOZ_ASSERT(!mUnavailableFaces.Contains(aFontFace));
|
||||
|
||||
mUnavailableFaces.AppendElement(aFontFace);
|
||||
}
|
||||
|
||||
void
|
||||
FontFaceSet::RemoveUnavailableFontFace(FontFace* aFontFace)
|
||||
{
|
||||
MOZ_ASSERT(!aFontFace->HasRule());
|
||||
MOZ_ASSERT(!aFontFace->IsInFontFaceSet());
|
||||
|
||||
// We might not actually find the FontFace in mUnavailableFaces, since we
|
||||
// might be shutting down the document and had DestroyUserFontSet called
|
||||
// on us, which clears out mUnavailableFaces.
|
||||
mUnavailableFaces.RemoveElement(aFontFace);
|
||||
|
||||
MOZ_ASSERT(!mUnavailableFaces.Contains(aFontFace));
|
||||
}
|
||||
|
||||
void
|
||||
FontFaceSet::OnFontFaceStatusChanged(FontFace* aFontFace)
|
||||
{
|
||||
|
||||
@@ -112,18 +112,6 @@ public:
|
||||
|
||||
void IncrementGeneration(bool aIsRebuild = false);
|
||||
|
||||
/**
|
||||
* Adds the specified FontFace to the mUnavailableFaces array. This is called
|
||||
* when a new FontFace object has just been created in JS by the author.
|
||||
*/
|
||||
void AddUnavailableFontFace(FontFace* aFontFace);
|
||||
|
||||
/**
|
||||
* Removes the specified FontFace from the mUnavailableFaces array. This
|
||||
* is called when a FontFace object is about be destroyed.
|
||||
*/
|
||||
void RemoveUnavailableFontFace(FontFace* aFontFace);
|
||||
|
||||
/**
|
||||
* Finds an existing entry in the user font cache or creates a new user
|
||||
* font entry for the given FontFace object.
|
||||
@@ -308,10 +296,6 @@ private:
|
||||
// FontFaceSet.
|
||||
nsTArray<FontFaceRecord> mNonRuleFaces;
|
||||
|
||||
// The non rule backed FontFace objects that have not been added to
|
||||
// this FontFaceSet.
|
||||
nsTArray<FontFace*> mUnavailableFaces;
|
||||
|
||||
// The overall status of the loading or loaded fonts in the FontFaceSet.
|
||||
mozilla::dom::FontFaceSetLoadStatus mStatus;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user