Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: third_party/WebKit/Source/core/css/CSSFontSelector.cpp

Issue 2624893003: Move the FontFaceCache stored in CSSFontSelector to be stored in Document. (Closed)
Patch Set: Rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/CSSFontSelector.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSFontSelector.cpp b/third_party/WebKit/Source/core/css/CSSFontSelector.cpp
index a4d1100995d9579fbf7b852d1bbefb47d2b5c9ad..13c4993a3573e3aa33f7cd9c1042c4dd1af3e24d 100644
--- a/third_party/WebKit/Source/core/css/CSSFontSelector.cpp
+++ b/third_party/WebKit/Source/core/css/CSSFontSelector.cpp
@@ -52,8 +52,7 @@ CSSFontSelector::CSSFontSelector(Document* document)
ASSERT(m_document);
DCHECK(m_document->frame());
FontCache::fontCache()->addClient(this);
- FontFaceSet::from(*document)->addFontFacesToFontFaceCache(&m_fontFaceCache,
- this);
+ FontFaceSet::from(*document)->addFontFacesToFontFaceCache(this);
}
CSSFontSelector::~CSSFontSelector() {}
@@ -69,7 +68,7 @@ void CSSFontSelector::unregisterForInvalidationCallbacks(
}
void CSSFontSelector::dispatchInvalidationCallbacks() {
- m_fontFaceCache.incrementVersion();
+ m_document->incrementFontFaceVersion();
HeapVector<Member<CSSFontSelectorClient>> clients;
copyToVector(m_clients, clients);
@@ -121,15 +120,15 @@ static AtomicString familyNameFromSettings(
PassRefPtr<FontData> CSSFontSelector::getFontData(
const FontDescription& fontDescription,
- const AtomicString& familyName) {
- if (CSSSegmentedFontFace* face =
- m_fontFaceCache.get(fontDescription, familyName))
+ const AtomicString& family) {
+ CSSSegmentedFontFace* face = getFontFaceFromCache(fontDescription, family);
+ if (face)
return face->getFontData(fontDescription);
// Try to return the correct font based off our settings, in case we were
// handed the generic font family name.
AtomicString settingsFamilyName = familyNameFromSettings(
- m_genericFontFamilySettings, fontDescription, familyName);
+ m_genericFontFamilySettings, fontDescription, family);
if (settingsFamilyName.isEmpty())
return nullptr;
@@ -140,7 +139,7 @@ PassRefPtr<FontData> CSSFontSelector::getFontData(
void CSSFontSelector::willUseFontData(const FontDescription& fontDescription,
const AtomicString& family,
const String& text) {
- CSSSegmentedFontFace* face = m_fontFaceCache.get(fontDescription, family);
+ CSSSegmentedFontFace* face = getFontFaceFromCache(fontDescription, family);
if (face)
face->willUseFontData(fontDescription, text);
}
@@ -148,7 +147,7 @@ void CSSFontSelector::willUseFontData(const FontDescription& fontDescription,
void CSSFontSelector::willUseRange(const FontDescription& fontDescription,
const AtomicString& family,
const FontDataForRangeSet& rangeSet) {
- CSSSegmentedFontFace* face = m_fontFaceCache.get(fontDescription, family);
+ CSSSegmentedFontFace* face = getFontFaceFromCache(fontDescription, family);
if (face)
face->willUseRange(fontDescription, rangeSet);
}
@@ -174,7 +173,6 @@ void CSSFontSelector::updateGenericFontFamilySettings(Document& document) {
DEFINE_TRACE(CSSFontSelector) {
visitor->trace(m_document);
- visitor->trace(m_fontFaceCache);
visitor->trace(m_clients);
FontSelector::trace(visitor);
}
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSFontSelector.h ('k') | third_party/WebKit/Source/core/css/FontFaceSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698