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

Unified Diff: Source/core/css/StyleSheetContents.cpp

Issue 82583005: Use removeFontFace to avoid resetting fontSelector. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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
Index: Source/core/css/StyleSheetContents.cpp
diff --git a/Source/core/css/StyleSheetContents.cpp b/Source/core/css/StyleSheetContents.cpp
index f162dda10b9e55e42398b0b5683c9e03beb070e1..a0b29f6009fbdd27b56129a146e41b75cc5aab1c 100644
--- a/Source/core/css/StyleSheetContents.cpp
+++ b/Source/core/css/StyleSheetContents.cpp
@@ -548,5 +548,31 @@ void StyleSheetContents::clearRuleSet()
parentSheet->clearRuleSet();
}
+static void extractFontFaceRuleFromRules(const Vector<RefPtr<StyleRuleBase> >& rules, Vector<const StyleRuleFontFace*>& fontFaceRules)
+{
+ for (unsigned i = 0; i < rules.size(); ++i) {
+ StyleRuleBase* rule = rules[i].get();
+
+ if (rule->isFontFaceRule()) {
+ fontFaceRules.append(toStyleRuleFontFace(rule));
+ } else if (rule->isMediaRule()) {
+ StyleRuleMedia* mediaRule = static_cast<StyleRuleMedia*>(rule);
+ // We cannot know whether the media rule matches or not, but
+ // for safety, remove @font-face in the media rule (if exists).
+ extractFontFaceRuleFromRules(mediaRule->childRules(), fontFaceRules);
+ }
+ }
+}
+
+void StyleSheetContents::extractFontFaceRule(Vector<const StyleRuleFontFace*>& fontFaceRules)
dglazkov 2013/11/25 16:27:29 extractFontFaceRules? Actually, you're not removin
tasak 2013/11/26 07:49:06 I see. Done.
+{
+ for (unsigned i = 0; i < m_importRules.size(); ++i) {
+ if (!m_importRules[i]->styleSheet())
+ continue;
+ m_importRules[i]->styleSheet()->extractFontFaceRule(fontFaceRules);
+ }
+
+ extractFontFaceRuleFromRules(childRules(), fontFaceRules);
+}
}

Powered by Google App Engine
This is Rietveld 408576698