Index: Source/core/dom/StyleEngine.cpp |
diff --git a/Source/core/dom/StyleEngine.cpp b/Source/core/dom/StyleEngine.cpp |
index 5a4f467ff12e23a5976381947fcfb33dcb8d5990..8f329f86d8b09868db9d3542e761387d3aa7062d 100644 |
--- a/Source/core/dom/StyleEngine.cpp |
+++ b/Source/core/dom/StyleEngine.cpp |
@@ -32,6 +32,7 @@ |
#include "SVGNames.h" |
#include "core/css/CSSFontSelector.h" |
#include "core/css/CSSStyleSheet.h" |
+#include "core/css/FontFaceCache.h" |
#include "core/css/StyleInvalidationAnalysis.h" |
#include "core/css/StyleSheetContents.h" |
#include "core/dom/DocumentStyleSheetCollector.h" |
@@ -519,26 +520,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() |
{ |
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; |
+ |
+ FontFaceCache* 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) |