diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h index f51c08ea82ac..fa6fd6a83f28 100644 --- a/gfx/thebes/gfxFont.h +++ b/gfx/thebes/gfxFont.h @@ -1527,9 +1527,7 @@ class gfxFont { // and therefore needs us to use a mask for text-shadow even when // we're not actually blurring. bool AlwaysNeedsMaskForShadow() const { - return mFontEntry->TryGetColorGlyphs() || mFontEntry->TryGetSVGData(this) || - mFontEntry->HasFontTable(TRUETYPE_TAG('C', 'B', 'D', 'T')) || - mFontEntry->HasFontTable(TRUETYPE_TAG('s', 'b', 'i', 'x')); + return mFontEntry->AlwaysNeedsMaskForShadow(); } // whether a feature is supported by the font (limited to a small set diff --git a/gfx/thebes/gfxFontEntry.cpp b/gfx/thebes/gfxFontEntry.cpp index b038452d6980..840ef8943f9c 100644 --- a/gfx/thebes/gfxFontEntry.cpp +++ b/gfx/thebes/gfxFontEntry.cpp @@ -79,6 +79,7 @@ gfxFontEntry::gfxFontEntry(const nsACString& aName, bool aIsStandardFace) mHasGraphiteTables(LazyFlag::Uninitialized), mHasGraphiteSpaceContextuals(LazyFlag::Uninitialized), mHasColorBitmapTable(LazyFlag::Uninitialized), + mNeedsMaskForShadow(LazyFlag::Uninitialized), mHasSpaceFeatures(SpaceFeatures::Uninitialized) { mTrakTable.exchange(kTrakTableUninitialized); memset(&mDefaultSubSpaceFeatures, 0, sizeof(mDefaultSubSpaceFeatures)); @@ -355,7 +356,7 @@ bool gfxFontEntry::TryGetSVGData(const gfxFont* aFont) { mSVGInitialized = true; } - if (GetSVGGlyphs()) { + if (GetSVGGlyphs() && aFont) { AutoWriteLock lock(mLock); if (!mFontsUsingSVGGlyphs.Contains(aFont)) { mFontsUsingSVGGlyphs.AppendElement(aFont); diff --git a/gfx/thebes/gfxFontEntry.h b/gfx/thebes/gfxFontEntry.h index 364cf6c79e46..82218d561142 100644 --- a/gfx/thebes/gfxFontEntry.h +++ b/gfx/thebes/gfxFontEntry.h @@ -273,6 +273,18 @@ class gfxFontEntry { return flag == LazyFlag::Yes; } + inline bool AlwaysNeedsMaskForShadow() { + LazyFlag flag = mNeedsMaskForShadow; + if (flag == LazyFlag::Uninitialized) { + flag = + TryGetColorGlyphs() || TryGetSVGData(nullptr) || HasColorBitmapTable() + ? LazyFlag::Yes + : LazyFlag::No; + mNeedsMaskForShadow = flag; + } + return flag == LazyFlag::Yes; + } + inline bool HasCmapTable() { if (!mCharacterMap && !mShmemCharacterMap) { ReadCMAP(); @@ -670,6 +682,7 @@ class gfxFontEntry { std::atomic mHasGraphiteTables; std::atomic mHasGraphiteSpaceContextuals; std::atomic mHasColorBitmapTable; + std::atomic mNeedsMaskForShadow; enum class SpaceFeatures : uint8_t { Uninitialized = 0xff,