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

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

Issue 157853002: Revert of Use removeFontFace to avoid resetting fontSelector. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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
« no previous file with comments | « Source/core/dom/StyleEngine.h ('k') | Source/core/dom/TreeScopeStyleSheetCollection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/StyleEngine.cpp
diff --git a/Source/core/dom/StyleEngine.cpp b/Source/core/dom/StyleEngine.cpp
index 4e74558d6694a414c65a4d61dbe0aa2458319a5c..0ff80095c06339cf162bdc730520c7571fa9cf92 100644
--- a/Source/core/dom/StyleEngine.cpp
+++ b/Source/core/dom/StyleEngine.cpp
@@ -32,7 +32,6 @@
#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"
@@ -520,35 +519,26 @@
return change;
}
-void StyleEngine::clearFontCache()
-{
- // We should not recreate FontSelector. Instead, clear fontFaceCache.
- if (m_fontSelector)
- m_fontSelector->fontFaceCache()->clear();
- if (m_resolver)
+void StyleEngine::resetFontSelector()
+{
+ if (!m_fontSelector)
+ return;
+
+ m_fontSelector->clearDocument();
+ if (m_resolver) {
+ m_fontSelector->unregisterForInvalidationCallbacks(m_resolver.get());
m_resolver->invalidateMatchedPropertiesCache();
-}
-
-void StyleEngine::updateGenericFontFamilySettings()
-{
- if (!m_fontSelector)
- return;
-
- m_fontSelector->updateGenericFontFamilySettings(m_document);
- if (m_resolver)
- m_resolver->invalidateMatchedPropertiesCache();
-}
-
-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();
+ }
+
+ // 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::markTreeScopeDirty(TreeScope& scope)
« no previous file with comments | « Source/core/dom/StyleEngine.h ('k') | Source/core/dom/TreeScopeStyleSheetCollection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698