| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 , m_usesRemUnits(false) | 64 , m_usesRemUnits(false) |
| 65 , m_isMutable(false) | 65 , m_isMutable(false) |
| 66 , m_isInMemoryCache(false) | 66 , m_isInMemoryCache(false) |
| 67 , m_hasFontFaceRule(false) | 67 , m_hasFontFaceRule(false) |
| 68 , m_hasMediaQueries(false) | 68 , m_hasMediaQueries(false) |
| 69 , m_parserContext(context) | 69 , m_parserContext(context) |
| 70 { | 70 { |
| 71 } | 71 } |
| 72 | 72 |
| 73 StyleSheetContents::StyleSheetContents(const StyleSheetContents& o) | 73 StyleSheetContents::StyleSheetContents(const StyleSheetContents& o) |
| 74 : m_ownerRule(0) | 74 : m_ownerRule(nullptr) |
| 75 , m_originalURL(o.m_originalURL) | 75 , m_originalURL(o.m_originalURL) |
| 76 , m_encodingFromCharsetRule(o.m_encodingFromCharsetRule) | 76 , m_encodingFromCharsetRule(o.m_encodingFromCharsetRule) |
| 77 , m_importRules(o.m_importRules.size()) | 77 , m_importRules(o.m_importRules.size()) |
| 78 , m_childRules(o.m_childRules.size()) | 78 , m_childRules(o.m_childRules.size()) |
| 79 , m_namespaces(o.m_namespaces) | 79 , m_namespaces(o.m_namespaces) |
| 80 , m_hasSyntacticallyValidCSSHeader(o.m_hasSyntacticallyValidCSSHeader) | 80 , m_hasSyntacticallyValidCSSHeader(o.m_hasSyntacticallyValidCSSHeader) |
| 81 , m_didLoadErrorOccur(false) | 81 , m_didLoadErrorOccur(false) |
| 82 , m_usesRemUnits(o.m_usesRemUnits) | 82 , m_usesRemUnits(o.m_usesRemUnits) |
| 83 , m_isMutable(false) | 83 , m_isMutable(false) |
| 84 , m_isInMemoryCache(false) | 84 , m_isInMemoryCache(false) |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 } | 575 } |
| 576 m_ruleSet.clear(); | 576 m_ruleSet.clear(); |
| 577 } | 577 } |
| 578 | 578 |
| 579 void StyleSheetContents::notifyRemoveFontFaceRule(const StyleRuleFontFace* fontF
aceRule) | 579 void StyleSheetContents::notifyRemoveFontFaceRule(const StyleRuleFontFace* fontF
aceRule) |
| 580 { | 580 { |
| 581 StyleSheetContents* root = rootStyleSheet(); | 581 StyleSheetContents* root = rootStyleSheet(); |
| 582 | 582 |
| 583 for (unsigned i = 0; i < root->m_clients.size(); ++i) { | 583 for (unsigned i = 0; i < root->m_clients.size(); ++i) { |
| 584 if (Node* ownerNode = root->m_clients[0]->ownerNode()) | 584 if (Node* ownerNode = root->m_clients[0]->ownerNode()) |
| 585 ownerNode->document().styleEngine()->removeFontFaceRules(Vector<cons
t StyleRuleFontFace*>(1, fontFaceRule)); | 585 ownerNode->document().styleEngine()->removeFontFaceRules(WillBeHeapV
ector<RawPtrWillBeMember<const StyleRuleFontFace> >(1, fontFaceRule)); |
| 586 } | 586 } |
| 587 } | 587 } |
| 588 | 588 |
| 589 static void findFontFaceRulesFromRules(const WillBeHeapVector<RefPtrWillBeMember
<StyleRuleBase> >& rules, Vector<const StyleRuleFontFace*>& fontFaceRules) | 589 static void findFontFaceRulesFromRules(const WillBeHeapVector<RefPtrWillBeMember
<StyleRuleBase> >& rules, WillBeHeapVector<RawPtrWillBeMember<const StyleRuleFon
tFace> >& fontFaceRules) |
| 590 { | 590 { |
| 591 for (unsigned i = 0; i < rules.size(); ++i) { | 591 for (unsigned i = 0; i < rules.size(); ++i) { |
| 592 StyleRuleBase* rule = rules[i].get(); | 592 StyleRuleBase* rule = rules[i].get(); |
| 593 | 593 |
| 594 if (rule->isFontFaceRule()) { | 594 if (rule->isFontFaceRule()) { |
| 595 fontFaceRules.append(toStyleRuleFontFace(rule)); | 595 fontFaceRules.append(toStyleRuleFontFace(rule)); |
| 596 } else if (rule->isMediaRule()) { | 596 } else if (rule->isMediaRule()) { |
| 597 StyleRuleMedia* mediaRule = toStyleRuleMedia(rule); | 597 StyleRuleMedia* mediaRule = toStyleRuleMedia(rule); |
| 598 // We cannot know whether the media rule matches or not, but | 598 // We cannot know whether the media rule matches or not, but |
| 599 // for safety, remove @font-face in the media rule (if exists). | 599 // for safety, remove @font-face in the media rule (if exists). |
| 600 findFontFaceRulesFromRules(mediaRule->childRules(), fontFaceRules); | 600 findFontFaceRulesFromRules(mediaRule->childRules(), fontFaceRules); |
| 601 } | 601 } |
| 602 } | 602 } |
| 603 } | 603 } |
| 604 | 604 |
| 605 void StyleSheetContents::findFontFaceRules(Vector<const StyleRuleFontFace*>& fon
tFaceRules) | 605 void StyleSheetContents::findFontFaceRules(WillBeHeapVector<RawPtrWillBeMember<c
onst StyleRuleFontFace> >& fontFaceRules) |
| 606 { | 606 { |
| 607 for (unsigned i = 0; i < m_importRules.size(); ++i) { | 607 for (unsigned i = 0; i < m_importRules.size(); ++i) { |
| 608 if (!m_importRules[i]->styleSheet()) | 608 if (!m_importRules[i]->styleSheet()) |
| 609 continue; | 609 continue; |
| 610 m_importRules[i]->styleSheet()->findFontFaceRules(fontFaceRules); | 610 m_importRules[i]->styleSheet()->findFontFaceRules(fontFaceRules); |
| 611 } | 611 } |
| 612 | 612 |
| 613 findFontFaceRulesFromRules(childRules(), fontFaceRules); | 613 findFontFaceRulesFromRules(childRules(), fontFaceRules); |
| 614 } | 614 } |
| 615 | 615 |
| 616 void StyleSheetContents::trace(Visitor* visitor) | 616 void StyleSheetContents::trace(Visitor* visitor) |
| 617 { | 617 { |
| 618 visitor->trace(m_ownerRule); |
| 618 visitor->trace(m_importRules); | 619 visitor->trace(m_importRules); |
| 619 visitor->trace(m_childRules); | 620 visitor->trace(m_childRules); |
| 620 } | 621 } |
| 621 | 622 |
| 622 } | 623 } |
| OLD | NEW |