Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 541 // See the StyleResolver calls in ScopedStyleResolver::addRulesFromSheet. | 541 // See the StyleResolver calls in ScopedStyleResolver::addRulesFromSheet. |
| 542 for (size_t i = 0; i < m_clients.size(); ++i) { | 542 for (size_t i = 0; i < m_clients.size(); ++i) { |
| 543 if (Document* document = m_clients[i]->ownerDocument()) | 543 if (Document* document = m_clients[i]->ownerDocument()) |
| 544 document->styleEngine()->clearResolver(); | 544 document->styleEngine()->clearResolver(); |
| 545 } | 545 } |
| 546 m_ruleSet.clear(); | 546 m_ruleSet.clear(); |
| 547 if (StyleSheetContents* parentSheet = parentStyleSheet()) | 547 if (StyleSheetContents* parentSheet = parentStyleSheet()) |
| 548 parentSheet->clearRuleSet(); | 548 parentSheet->clearRuleSet(); |
| 549 } | 549 } |
| 550 | 550 |
| 551 static void extractFontFaceRuleFromRules(const Vector<RefPtr<StyleRuleBase> >& r ules, Vector<const StyleRuleFontFace*>& fontFaceRules) | |
| 552 { | |
| 553 for (unsigned i = 0; i < rules.size(); ++i) { | |
| 554 StyleRuleBase* rule = rules[i].get(); | |
| 555 | |
| 556 if (rule->isFontFaceRule()) { | |
| 557 fontFaceRules.append(toStyleRuleFontFace(rule)); | |
| 558 } else if (rule->isMediaRule()) { | |
| 559 StyleRuleMedia* mediaRule = static_cast<StyleRuleMedia*>(rule); | |
| 560 // We cannot know whether the media rule matches or not, but | |
| 561 // for safety, remove @font-face in the media rule (if exists). | |
| 562 extractFontFaceRuleFromRules(mediaRule->childRules(), fontFaceRules) ; | |
| 563 } | |
| 564 } | |
| 565 } | |
| 566 | |
| 567 void StyleSheetContents::extractFontFaceRule(Vector<const StyleRuleFontFace*>& f ontFaceRules) | |
|
dglazkov
2013/11/25 16:27:29
extractFontFaceRules? Actually, you're not removin
tasak
2013/11/26 07:49:06
I see. Done.
| |
| 568 { | |
| 569 for (unsigned i = 0; i < m_importRules.size(); ++i) { | |
| 570 if (!m_importRules[i]->styleSheet()) | |
| 571 continue; | |
| 572 m_importRules[i]->styleSheet()->extractFontFaceRule(fontFaceRules); | |
| 573 } | |
| 574 | |
| 575 extractFontFaceRuleFromRules(childRules(), fontFaceRules); | |
| 576 } | |
| 551 | 577 |
| 552 } | 578 } |
| OLD | NEW |