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

Unified Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 103273002: CSSSegmentedFontFaceCache should not know about Document. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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/css/CSSSegmentedFontFaceCache.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/resolver/StyleResolver.cpp
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
index 25a940938b40222011ec24b4e557760485c1ba9d..30dccde5365630e8d28aba4a7f294ffb8b3d5bf4 100644
--- a/Source/core/css/resolver/StyleResolver.cpp
+++ b/Source/core/css/resolver/StyleResolver.cpp
@@ -42,6 +42,7 @@
#include "core/animation/css/CSSAnimations.h"
#include "core/css/CSSCalculationValue.h"
#include "core/css/CSSDefaultStyleSheets.h"
+#include "core/css/CSSFontFace.h"
#include "core/css/CSSFontSelector.h"
#include "core/css/CSSKeyframeRule.h"
#include "core/css/CSSKeyframesRule.h"
@@ -121,6 +122,13 @@ static StylePropertySet* rightToLeftDeclaration()
return rightToLeftDecl;
}
+static void addFontFaceRule(Document* document, CSSFontSelector* cssFontSelector, const StyleRuleFontFace* fontFaceRule)
+{
+ RefPtr<CSSFontFace> cssFontFace = CSSFontFace::createFromStyleRule(document, fontFaceRule);
+ if (cssFontFace)
+ cssFontSelector->addFontFaceRule(fontFaceRule, cssFontFace);
+}
+
StyleResolver::StyleResolver(Document& document)
: m_document(document)
, m_fontSelector(CSSFontSelector::create(&document))
@@ -163,7 +171,7 @@ StyleResolver::StyleResolver(Document& document)
const HashSet<SVGFontFaceElement*>& svgFontFaceElements = document.svgExtensions()->svgFontFaceElements();
HashSet<SVGFontFaceElement*>::const_iterator end = svgFontFaceElements.end();
for (HashSet<SVGFontFaceElement*>::const_iterator it = svgFontFaceElements.begin(); it != end; ++it)
- fontSelector()->addFontFaceRule((*it)->fontFaceRule());
+ addFontFaceRule(&document, fontSelector(), (*it)->fontFaceRule());
}
#endif
}
@@ -268,7 +276,7 @@ void StyleResolver::processScopedRules(const RuleSet& authorRules, const KURL& s
if (!scope || scope->isDocumentNode()) {
const Vector<StyleRuleFontFace*> fontFaceRules = authorRules.fontFaceRules();
for (unsigned i = 0; i < fontFaceRules.size(); ++i)
- fontSelector()->addFontFaceRule(fontFaceRules[i]);
+ addFontFaceRule(&m_document, fontSelector(), fontFaceRules[i]);
if (fontFaceRules.size())
invalidateMatchedPropertiesCache();
} else {
« no previous file with comments | « Source/core/css/CSSSegmentedFontFaceCache.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698