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

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

Issue 87503003: Moving fontSelector from StyleResolver to StyleEngine. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Removed document.fontSelector() Created 7 years 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/html/canvas/CanvasRenderingContext2D.cpp » ('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 bea7b4954ea14bef55b78a15e653bc42595db129..b7f4a225a3f7feadef7918984bb7d5a070fdb304 100644
--- a/Source/core/dom/StyleEngine.cpp
+++ b/Source/core/dom/StyleEngine.cpp
@@ -30,6 +30,7 @@
#include "HTMLNames.h"
#include "SVGNames.h"
+#include "core/css/CSSFontSelector.h"
#include "core/css/CSSStyleSheet.h"
#include "core/css/StyleInvalidationAnalysis.h"
#include "core/css/StyleSheetContents.h"
@@ -70,11 +71,18 @@ StyleEngine::StyleEngine(Document& document)
, m_didCalculateResolver(false)
, m_lastResolverAccessCount(0)
, m_resolverThrowawayTimer(this, &StyleEngine::resolverThrowawayTimerFired)
+ , m_fontSelector(document.frame() ? CSSFontSelector::create(&document) : 0)
ojan 2013/12/05 18:57:15 Is this null checking document.frame() for import
tasak 2013/12/06 07:13:47 Yes, and also for HTMLTemplateElement. I found, if
{
}
StyleEngine::~StyleEngine()
{
+ if (m_fontSelector) {
ojan 2013/12/05 18:57:15 Why do we need to do this?
tasak 2013/12/06 07:13:47 I see. Looking at ~CSSFontSelector, we don't need
+ if (m_resolver)
+ m_fontSelector->unregisterForInvalidationCallbacks(m_resolver.get());
+ m_fontSelector->clearDocument();
+ }
+
for (unsigned i = 0; i < m_injectedAuthorStyleSheets.size(); ++i)
m_injectedAuthorStyleSheets[i]->clearOwnerNode();
for (unsigned i = 0; i < m_authorStyleSheets.size(); ++i)
@@ -470,6 +478,7 @@ void StyleEngine::createResolver()
m_resolver = adoptPtr(new StyleResolver(m_document));
appendActiveAuthorStyleSheets();
+ m_fontSelector->registerForInvalidationCallbacks(m_resolver.get());
combineCSSFeatureFlags(m_resolver->ensureRuleFeatureSet());
}
@@ -477,6 +486,8 @@ void StyleEngine::clearResolver()
{
ASSERT(!m_document.inStyleRecalc());
ASSERT(isMaster() || !m_resolver);
+ if (m_resolver)
+ m_fontSelector->unregisterForInvalidationCallbacks(m_resolver.get());
m_resolver.clear();
}
@@ -498,11 +509,6 @@ void StyleEngine::resolverThrowawayTimerFired(Timer<StyleEngine>*)
m_lastResolverAccessCount = resolverAccessCount();
}
-CSSFontSelector* StyleEngine::fontSelector()
-{
- return m_resolver ? m_resolver->fontSelector() : 0;
-}
-
void StyleEngine::didAttach()
{
m_resolverThrowawayTimer.startRepeating(60);
@@ -546,4 +552,19 @@ StyleResolverChange StyleEngine::resolverChanged(RecalcStyleTime time, StyleReso
return change;
}
+void StyleEngine::resetFontSelector()
+{
+ if (!m_document.frame())
ojan 2013/12/05 18:57:15 Should this be if (!m_fontSelector)?
tasak 2013/12/06 07:13:47 I think, should be if (!m_fontSelector || !m_docum
+ return;
+
+ m_fontSelector->clearDocument();
+ if (m_resolver) {
+ m_fontSelector->unregisterForInvalidationCallbacks(m_resolver.get());
+ m_resolver->invalidateMatchedPropertiesCache();
+ }
+ m_fontSelector = CSSFontSelector::create(&m_document);
+ if (m_resolver)
+ m_fontSelector->registerForInvalidationCallbacks(m_resolver.get());
+}
+
}
« no previous file with comments | « Source/core/dom/StyleEngine.h ('k') | Source/core/html/canvas/CanvasRenderingContext2D.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698