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

Unified Diff: Source/core/dom/StyleEngine.cpp

Issue 82583005: Use removeFontFace to avoid resetting fontSelector. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix fast/text/international/ regression Created 6 years, 11 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: Source/core/dom/StyleEngine.cpp
diff --git a/Source/core/dom/StyleEngine.cpp b/Source/core/dom/StyleEngine.cpp
index 01609cef72dfe1f672f2fcbbfee63fd30f384544..75eae601f450967ab659ce35f14b083c135196e0 100644
--- a/Source/core/dom/StyleEngine.cpp
+++ b/Source/core/dom/StyleEngine.cpp
@@ -535,26 +535,35 @@ StyleResolverChange StyleEngine::resolverChanged(RecalcStyleTime time, StyleReso
return change;
}
-void StyleEngine::resetFontSelector()
+void StyleEngine::clearFontCache()
+{
+ // We should not recreate FontSelector. Instead, clear fontFaceCache.
+ if (m_fontSelector)
+ m_fontSelector->fontFaceCache()->clear();
+ if (m_resolver)
+ m_resolver->invalidateMatchedPropertiesCache();
+}
+
+void StyleEngine::updateGenericFontFamilySettings()
dglazkov 2014/01/29 05:11:50 Why do we need a separate function for this? When
tasak 2014/01/29 10:13:43 The updateGenericFontFamilySettings will be invoke
{
if (!m_fontSelector)
return;
- m_fontSelector->clearDocument();
- if (m_resolver) {
- m_fontSelector->unregisterForInvalidationCallbacks(m_resolver.get());
+ m_fontSelector->updateGenericFontFamilySettings(m_document);
+ if (m_resolver)
m_resolver->invalidateMatchedPropertiesCache();
- }
+}
- // If the document has been already detached, we don't need to recreate
- // CSSFontSelector.
- if (m_document.isActive()) {
- m_fontSelector = CSSFontSelector::create(&m_document);
- if (m_resolver)
- m_fontSelector->registerForInvalidationCallbacks(m_resolver.get());
- } else {
- m_fontSelector = 0;
- }
+void StyleEngine::removeFontFaceRules(const Vector<const StyleRuleFontFace*>& fontFaceRules)
+{
+ if (!m_fontSelector)
+ return;
+
+ CSSSegmentedFontFaceCache* cache = m_fontSelector->fontFaceCache();
+ for (unsigned i = 0; i < fontFaceRules.size(); ++i)
+ cache->remove(fontFaceRules[i]);
+ if (m_resolver)
+ m_resolver->invalidateMatchedPropertiesCache();
}
void StyleEngine::markTreeScopeDirty(TreeScope& scope)

Powered by Google App Engine
This is Rietveld 408576698