| 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, 2008, 2009, 2010, 2012 Apple Inc. All rights
reserved. | 3 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010, 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 return adoptRef(new StyleSheetContents(context)); | 48 return adoptRef(new StyleSheetContents(context)); |
| 49 } | 49 } |
| 50 | 50 |
| 51 ~StyleSheetContents(); | 51 ~StyleSheetContents(); |
| 52 | 52 |
| 53 const CSSParserContext& parserContext() const { return m_parserContext; } | 53 const CSSParserContext& parserContext() const { return m_parserContext; } |
| 54 | 54 |
| 55 bool parseString(const String&); | 55 bool parseString(const String&); |
| 56 bool parseStringAtPosition(const String&, const TextPosition&, bool); | 56 bool parseStringAtPosition(const String&, const TextPosition&, bool); |
| 57 | 57 |
| 58 bool hasSingleOwnerNode() const; | |
| 59 Node* singleOwnerNode() const; | |
| 60 Document* singleOwnerDocument() const; | |
| 61 | |
| 62 void parserAppendRule(PassRefPtr<StyleRuleBase>); | 58 void parserAppendRule(PassRefPtr<StyleRuleBase>); |
| 63 void parserSetUsesRemUnits(bool b) { m_usesRemUnits = b; } | 59 void parserSetUsesRemUnits(bool b) { m_usesRemUnits = b; } |
| 64 | 60 |
| 65 void clearRules(); | |
| 66 | |
| 67 // Rules other than @charset and @import. | 61 // Rules other than @charset and @import. |
| 68 const Vector<RefPtr<StyleRuleBase> >& childRules() const { return m_childRul
es; } | 62 const Vector<RefPtr<StyleRuleBase> >& childRules() const { return m_childRul
es; } |
| 69 | 63 |
| 70 unsigned ruleCount() const; | 64 unsigned ruleCount() const; |
| 71 StyleRuleBase* ruleAt(unsigned index) const; | 65 StyleRuleBase* ruleAt(unsigned index) const; |
| 72 | 66 |
| 73 bool usesRemUnits() const { return m_usesRemUnits; } | 67 bool usesRemUnits() const { return m_usesRemUnits; } |
| 74 | 68 |
| 75 void registerClient(CSSStyleSheet*); | 69 void registerClient(CSSStyleSheet*); |
| 76 void unregisterClient(CSSStyleSheet*); | 70 void unregisterClient(CSSStyleSheet*); |
| 77 size_t clientSize() const { return m_loadingClients.size() + m_completedClie
nts.size(); } | |
| 78 bool hasOneClient() const { return clientSize() == 1; } | |
| 79 | |
| 80 void removeSheetFromCache(Document*); | |
| 81 | 71 |
| 82 void setHasMediaQueries(); | 72 void setHasMediaQueries(); |
| 83 bool hasMediaQueries() const { return m_hasMediaQueries; } | 73 bool hasMediaQueries() const { return m_hasMediaQueries; } |
| 84 | 74 |
| 85 void shrinkToFit(); | 75 void shrinkToFit(); |
| 86 RuleSet& ruleSet() { ASSERT(m_ruleSet); return *m_ruleSet.get(); } | 76 RuleSet& ruleSet() { ASSERT(m_ruleSet); return *m_ruleSet.get(); } |
| 87 RuleSet& ensureRuleSet(const MediaQueryEvaluator&, AddRuleFlags); | 77 RuleSet& ensureRuleSet(const MediaQueryEvaluator&, AddRuleFlags); |
| 88 void clearRuleSet(); | 78 void clearRuleSet(); |
| 89 | 79 |
| 90 private: | 80 private: |
| 91 explicit StyleSheetContents(const CSSParserContext&); | 81 explicit StyleSheetContents(const CSSParserContext&); |
| 92 | 82 |
| 93 void notifyRemoveFontFaceRule(const StyleRuleFontFace*); | 83 void notifyRemoveFontFaceRule(const StyleRuleFontFace*); |
| 94 | 84 |
| 95 Document* clientSingleOwnerDocument() const; | |
| 96 | |
| 97 bool m_usesRemUnits : 1; | 85 bool m_usesRemUnits : 1; |
| 98 bool m_hasMediaQueries : 1; | 86 bool m_hasMediaQueries : 1; |
| 99 bool m_hasSingleOwnerDocument : 1; | |
| 100 | 87 |
| 101 OwnPtr<RuleSet> m_ruleSet; | 88 OwnPtr<RuleSet> m_ruleSet; |
| 102 Vector<RefPtr<StyleRuleBase> > m_childRules; | 89 Vector<RefPtr<StyleRuleBase> > m_childRules; |
| 103 CSSParserContext m_parserContext; | 90 CSSParserContext m_parserContext; |
| 104 | 91 |
| 105 HashSet<RawPtr<CSSStyleSheet> > m_loadingClients; | 92 HashSet<RawPtr<CSSStyleSheet> > m_loadingClients; |
| 106 HashSet<RawPtr<CSSStyleSheet> > m_completedClients; | 93 HashSet<RawPtr<CSSStyleSheet> > m_completedClients; |
| 107 typedef HashSet<RawPtr<CSSStyleSheet> >::iterator ClientsIterator; | 94 typedef HashSet<RawPtr<CSSStyleSheet> >::iterator ClientsIterator; |
| 108 }; | 95 }; |
| 109 | 96 |
| 110 } // namespace | 97 } // namespace |
| 111 | 98 |
| 112 #endif // SKY_ENGINE_CORE_CSS_STYLESHEETCONTENTS_H_ | 99 #endif // SKY_ENGINE_CORE_CSS_STYLESHEETCONTENTS_H_ |
| OLD | NEW |