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

Side by Side Diff: sky/engine/core/css/StyleSheetContents.h

Issue 758573005: Remove CSSOM mutability in StyleRule. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 unified diff | Download patch
« no previous file with comments | « sky/engine/core/css/StyleRuleKeyframes.cpp ('k') | sky/engine/core/css/StyleSheetContents.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 Node* singleOwnerNode() const; 65 Node* singleOwnerNode() const;
66 Document* singleOwnerDocument() const; 66 Document* singleOwnerDocument() const;
67 67
68 bool hasFailedOrCanceledSubresources() const; 68 bool hasFailedOrCanceledSubresources() const;
69 69
70 KURL completeURL(const String& url) const; 70 KURL completeURL(const String& url) const;
71 71
72 void setHasSyntacticallyValidCSSHeader(bool isValidCss); 72 void setHasSyntacticallyValidCSSHeader(bool isValidCss);
73 bool hasSyntacticallyValidCSSHeader() const { return m_hasSyntacticallyValid CSSHeader; } 73 bool hasSyntacticallyValidCSSHeader() const { return m_hasSyntacticallyValid CSSHeader; }
74 74
75 void setHasFontFaceRule(bool b) { m_hasFontFaceRule = b; }
76 bool hasFontFaceRule() const { return m_hasFontFaceRule; }
77 void findFontFaceRules(Vector<RawPtr<const StyleRuleFontFace> >& fontFaceRul es);
78
79 void parserAppendRule(PassRefPtr<StyleRuleBase>); 75 void parserAppendRule(PassRefPtr<StyleRuleBase>);
80 void parserSetUsesRemUnits(bool b) { m_usesRemUnits = b; } 76 void parserSetUsesRemUnits(bool b) { m_usesRemUnits = b; }
81 77
82 void clearRules(); 78 void clearRules();
83 79
84 // Rules other than @charset and @import. 80 // Rules other than @charset and @import.
85 const Vector<RefPtr<StyleRuleBase> >& childRules() const { return m_childRul es; } 81 const Vector<RefPtr<StyleRuleBase> >& childRules() const { return m_childRul es; }
86 82
87 // Note that href is the URL that started the redirect chain that led to 83 // Note that href is the URL that started the redirect chain that led to
88 // this style sheet. This property probably isn't useful for much except 84 // this style sheet. This property probably isn't useful for much except
89 // the JavaScript binding (which needs to use this value for security). 85 // the JavaScript binding (which needs to use this value for security).
90 String originalURL() const { return m_originalURL; } 86 String originalURL() const { return m_originalURL; }
91 const KURL& baseURL() const { return m_parserContext.baseURL(); } 87 const KURL& baseURL() const { return m_parserContext.baseURL(); }
92 88
93 unsigned ruleCount() const; 89 unsigned ruleCount() const;
94 StyleRuleBase* ruleAt(unsigned index) const; 90 StyleRuleBase* ruleAt(unsigned index) const;
95 91
96 bool usesRemUnits() const { return m_usesRemUnits; } 92 bool usesRemUnits() const { return m_usesRemUnits; }
97 93
98 unsigned estimatedSizeInBytes() const;
99
100 bool wrapperInsertRule(PassRefPtr<StyleRuleBase>, unsigned index);
101 void wrapperDeleteRule(unsigned index);
102
103 PassRefPtr<StyleSheetContents> copy() const
104 {
105 return adoptRef(new StyleSheetContents(*this));
106 }
107
108 void registerClient(CSSStyleSheet*); 94 void registerClient(CSSStyleSheet*);
109 void unregisterClient(CSSStyleSheet*); 95 void unregisterClient(CSSStyleSheet*);
110 size_t clientSize() const { return m_loadingClients.size() + m_completedClie nts.size(); } 96 size_t clientSize() const { return m_loadingClients.size() + m_completedClie nts.size(); }
111 bool hasOneClient() const { return clientSize() == 1; } 97 bool hasOneClient() const { return clientSize() == 1; }
112 98
113 bool isMutable() const { return m_isMutable; }
114 void setMutable() { m_isMutable = true; }
115
116 void removeSheetFromCache(Document*); 99 void removeSheetFromCache(Document*);
117 100
118 bool isInMemoryCache() const { return m_isInMemoryCache; }
119 void addedToMemoryCache();
120 void removedFromMemoryCache();
121
122 void setHasMediaQueries(); 101 void setHasMediaQueries();
123 bool hasMediaQueries() const { return m_hasMediaQueries; } 102 bool hasMediaQueries() const { return m_hasMediaQueries; }
124 103
125 bool didLoadErrorOccur() const { return m_didLoadErrorOccur; }
126
127 void shrinkToFit(); 104 void shrinkToFit();
128 RuleSet& ruleSet() { ASSERT(m_ruleSet); return *m_ruleSet.get(); } 105 RuleSet& ruleSet() { ASSERT(m_ruleSet); return *m_ruleSet.get(); }
129 RuleSet& ensureRuleSet(const MediaQueryEvaluator&, AddRuleFlags); 106 RuleSet& ensureRuleSet(const MediaQueryEvaluator&, AddRuleFlags);
130 void clearRuleSet(); 107 void clearRuleSet();
131 108
132 private: 109 private:
133 StyleSheetContents(const String& originalURL, const CSSParserContext&); 110 StyleSheetContents(const String& originalURL, const CSSParserContext&);
134 StyleSheetContents(const StyleSheetContents&); 111
135 void notifyRemoveFontFaceRule(const StyleRuleFontFace*); 112 void notifyRemoveFontFaceRule(const StyleRuleFontFace*);
136 113
137 Document* clientSingleOwnerDocument() const; 114 Document* clientSingleOwnerDocument() const;
138 115
139 String m_originalURL;
140
141 Vector<RefPtr<StyleRuleBase> > m_childRules;
142 typedef HashMap<AtomicString, AtomicString> PrefixNamespaceURIMap;
143 PrefixNamespaceURIMap m_namespaces;
144
145 bool m_hasSyntacticallyValidCSSHeader : 1; 116 bool m_hasSyntacticallyValidCSSHeader : 1;
146 bool m_didLoadErrorOccur : 1;
147 bool m_usesRemUnits : 1; 117 bool m_usesRemUnits : 1;
148 bool m_isMutable : 1;
149 bool m_isInMemoryCache : 1;
150 bool m_hasFontFaceRule : 1;
151 bool m_hasMediaQueries : 1; 118 bool m_hasMediaQueries : 1;
152 bool m_hasSingleOwnerDocument : 1; 119 bool m_hasSingleOwnerDocument : 1;
153 120
121 String m_originalURL;
122 OwnPtr<RuleSet> m_ruleSet;
123 Vector<RefPtr<StyleRuleBase> > m_childRules;
154 CSSParserContext m_parserContext; 124 CSSParserContext m_parserContext;
155 125
156 HashSet<RawPtr<CSSStyleSheet> > m_loadingClients; 126 HashSet<RawPtr<CSSStyleSheet> > m_loadingClients;
157 HashSet<RawPtr<CSSStyleSheet> > m_completedClients; 127 HashSet<RawPtr<CSSStyleSheet> > m_completedClients;
158 typedef HashSet<RawPtr<CSSStyleSheet> >::iterator ClientsIterator; 128 typedef HashSet<RawPtr<CSSStyleSheet> >::iterator ClientsIterator;
159
160 OwnPtr<RuleSet> m_ruleSet;
161 }; 129 };
162 130
163 } // namespace 131 } // namespace
164 132
165 #endif // SKY_ENGINE_CORE_CSS_STYLESHEETCONTENTS_H_ 133 #endif // SKY_ENGINE_CORE_CSS_STYLESHEETCONTENTS_H_
OLDNEW
« no previous file with comments | « sky/engine/core/css/StyleRuleKeyframes.cpp ('k') | sky/engine/core/css/StyleSheetContents.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698