Document should be a FontSelectorClient.
[WebKit-https.git] / Source / WebCore / dom / Document.cpp
index 649a260..aa71226 100644 (file)
@@ -1942,10 +1942,21 @@ void Document::createStyleResolver()
     m_styleSheetCollection.combineCSSFeatureFlags();
 }
 
+void Document::fontsNeedUpdate(FontSelector*)
+{
+    if (m_styleResolver)
+        m_styleResolver->invalidateMatchedPropertiesCache();
+    if (inPageCache() || !renderView())
+        return;
+    scheduleForcedStyleRecalc();
+}
+
 CSSFontSelector& Document::fontSelector()
 {
-    if (!m_fontSelector)
+    if (!m_fontSelector) {
         m_fontSelector = CSSFontSelector::create(*this);
+        m_fontSelector->registerForInvalidationCallbacks(this);
+    }
     return *m_fontSelector;
 }
 
@@ -1956,6 +1967,7 @@ void Document::clearStyleResolver()
     // FIXME: It would be better if the FontSelector could survive this operation.
     if (m_fontSelector) {
         m_fontSelector->clearDocument();
+        m_fontSelector->unregisterForInvalidationCallbacks(this);
         m_fontSelector = nullptr;
     }
 }