Commit 471df3ea authored by Emilio Cobos Álvarez's avatar Emilio Cobos Álvarez
Browse files

Bug 1821131 - Make font visibility part of the fontconfig substitution cache key. r=jfkthame

This is one possible option, the other one is to just cache the
substitute results.

Differential Revision: https://phabricator.services.mozilla.com/D172578
parent cb2a32d8
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@
#include "gfxFontConstants.h"
#include "gfxFT2Utils.h"
#include "gfxPlatform.h"
#include "nsPresContext.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/ContentParent.h"
@@ -2174,6 +2175,10 @@ bool gfxFcPlatformFontList::FindAndAddFamiliesLocked(
  }

  cacheKey.Append(familyName);
  auto vis =
      aPresContext ? aPresContext->GetFontVisibility() : FontVisibility::User;
  cacheKey.Append(':');
  cacheKey.AppendInt(int(vis));
  if (const auto& cached = mFcSubstituteCache.Lookup(cacheKey)) {
    if (cached->IsEmpty()) {
      return false;
+1 −1
Original line number Diff line number Diff line
@@ -823,7 +823,7 @@ already_AddRefed<nsFontMetrics> nsPresContext::GetMetricsFor(
  return mFontCache->GetMetricsFor(aFont, aParams);
}

nsresult nsPresContext::FlushFontCache(void) {
nsresult nsPresContext::FlushFontCache() {
  if (mFontCache) {
    mFontCache->Flush();
  }