Chromium Code Reviews| 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); |
| +} |
| } |