OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) | 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) |
4 * Copyright (C) 2002, 2006, 2008, 2012 Apple Inc. All rights reserved. | 4 * Copyright (C) 2002, 2006, 2008, 2012 Apple Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 void deref() | 79 void deref() |
80 { | 80 { |
81 if (derefBase()) | 81 if (derefBase()) |
82 destroy(); | 82 destroy(); |
83 } | 83 } |
84 | 84 |
85 // FIXME: There shouldn't be any need for the null parent version. | 85 // FIXME: There shouldn't be any need for the null parent version. |
86 PassRefPtr<CSSRule> createCSSOMWrapper(CSSStyleSheet* parentSheet = 0) const
; | 86 PassRefPtr<CSSRule> createCSSOMWrapper(CSSStyleSheet* parentSheet = 0) const
; |
87 PassRefPtr<CSSRule> createCSSOMWrapper(CSSRule* parentRule) const; | 87 PassRefPtr<CSSRule> createCSSOMWrapper(CSSRule* parentRule) const; |
88 | 88 |
89 void reportMemoryUsage(MemoryObjectInfo*) const; | |
90 | |
91 protected: | 89 protected: |
92 StyleRuleBase(Type type, signed sourceLine = 0) : m_type(type), m_sourceLine
(sourceLine) { } | 90 StyleRuleBase(Type type, signed sourceLine = 0) : m_type(type), m_sourceLine
(sourceLine) { } |
93 StyleRuleBase(const StyleRuleBase& o) : WTF::RefCountedBase(), m_type(o.m_ty
pe), m_sourceLine(o.m_sourceLine) { } | 91 StyleRuleBase(const StyleRuleBase& o) : WTF::RefCountedBase(), m_type(o.m_ty
pe), m_sourceLine(o.m_sourceLine) { } |
94 | 92 |
95 ~StyleRuleBase() { } | 93 ~StyleRuleBase() { } |
96 | 94 |
97 private: | 95 private: |
98 void destroy(); | 96 void destroy(); |
99 | 97 |
100 PassRefPtr<CSSRule> createCSSOMWrapper(CSSStyleSheet* parentSheet, CSSRule*
parentRule) const; | 98 PassRefPtr<CSSRule> createCSSOMWrapper(CSSStyleSheet* parentSheet, CSSRule*
parentRule) const; |
(...skipping 13 matching lines...) Expand all Loading... |
114 const StylePropertySet* properties() const { return m_properties.get(); } | 112 const StylePropertySet* properties() const { return m_properties.get(); } |
115 StylePropertySet* mutableProperties(); | 113 StylePropertySet* mutableProperties(); |
116 | 114 |
117 void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors
) { m_selectorList.adoptSelectorVector(selectors); } | 115 void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors
) { m_selectorList.adoptSelectorVector(selectors); } |
118 void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.a
dopt(selectors); } | 116 void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.a
dopt(selectors); } |
119 void setProperties(PassRefPtr<StylePropertySet>); | 117 void setProperties(PassRefPtr<StylePropertySet>); |
120 | 118 |
121 PassRefPtr<StyleRule> copy() const { return adoptRef(new StyleRule(*this));
} | 119 PassRefPtr<StyleRule> copy() const { return adoptRef(new StyleRule(*this));
} |
122 | 120 |
123 static unsigned averageSizeInBytes(); | 121 static unsigned averageSizeInBytes(); |
124 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; | |
125 | 122 |
126 private: | 123 private: |
127 StyleRule(int sourceLine); | 124 StyleRule(int sourceLine); |
128 StyleRule(const StyleRule&); | 125 StyleRule(const StyleRule&); |
129 | 126 |
130 RefPtr<StylePropertySet> m_properties; | 127 RefPtr<StylePropertySet> m_properties; |
131 CSSSelectorList m_selectorList; | 128 CSSSelectorList m_selectorList; |
132 }; | 129 }; |
133 | 130 |
134 class StyleRuleFontFace : public StyleRuleBase { | 131 class StyleRuleFontFace : public StyleRuleBase { |
135 public: | 132 public: |
136 static PassRefPtr<StyleRuleFontFace> create() { return adoptRef(new StyleRul
eFontFace); } | 133 static PassRefPtr<StyleRuleFontFace> create() { return adoptRef(new StyleRul
eFontFace); } |
137 | 134 |
138 ~StyleRuleFontFace(); | 135 ~StyleRuleFontFace(); |
139 | 136 |
140 const StylePropertySet* properties() const { return m_properties.get(); } | 137 const StylePropertySet* properties() const { return m_properties.get(); } |
141 StylePropertySet* mutableProperties(); | 138 StylePropertySet* mutableProperties(); |
142 | 139 |
143 void setProperties(PassRefPtr<StylePropertySet>); | 140 void setProperties(PassRefPtr<StylePropertySet>); |
144 | 141 |
145 PassRefPtr<StyleRuleFontFace> copy() const { return adoptRef(new StyleRuleFo
ntFace(*this)); } | 142 PassRefPtr<StyleRuleFontFace> copy() const { return adoptRef(new StyleRuleFo
ntFace(*this)); } |
146 | 143 |
147 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; | |
148 | 144 |
149 private: | 145 private: |
150 StyleRuleFontFace(); | 146 StyleRuleFontFace(); |
151 StyleRuleFontFace(const StyleRuleFontFace&); | 147 StyleRuleFontFace(const StyleRuleFontFace&); |
152 | 148 |
153 RefPtr<StylePropertySet> m_properties; | 149 RefPtr<StylePropertySet> m_properties; |
154 }; | 150 }; |
155 | 151 |
156 class StyleRulePage : public StyleRuleBase { | 152 class StyleRulePage : public StyleRuleBase { |
157 public: | 153 public: |
158 static PassRefPtr<StyleRulePage> create() { return adoptRef(new StyleRulePag
e); } | 154 static PassRefPtr<StyleRulePage> create() { return adoptRef(new StyleRulePag
e); } |
159 | 155 |
160 ~StyleRulePage(); | 156 ~StyleRulePage(); |
161 | 157 |
162 const CSSSelector* selector() const { return m_selectorList.first(); } | 158 const CSSSelector* selector() const { return m_selectorList.first(); } |
163 const StylePropertySet* properties() const { return m_properties.get(); } | 159 const StylePropertySet* properties() const { return m_properties.get(); } |
164 StylePropertySet* mutableProperties(); | 160 StylePropertySet* mutableProperties(); |
165 | 161 |
166 void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors
) { m_selectorList.adoptSelectorVector(selectors); } | 162 void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors
) { m_selectorList.adoptSelectorVector(selectors); } |
167 void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.a
dopt(selectors); } | 163 void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.a
dopt(selectors); } |
168 void setProperties(PassRefPtr<StylePropertySet>); | 164 void setProperties(PassRefPtr<StylePropertySet>); |
169 | 165 |
170 PassRefPtr<StyleRulePage> copy() const { return adoptRef(new StyleRulePage(*
this)); } | 166 PassRefPtr<StyleRulePage> copy() const { return adoptRef(new StyleRulePage(*
this)); } |
171 | 167 |
172 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; | |
173 | |
174 private: | 168 private: |
175 StyleRulePage(); | 169 StyleRulePage(); |
176 StyleRulePage(const StyleRulePage&); | 170 StyleRulePage(const StyleRulePage&); |
177 | 171 |
178 RefPtr<StylePropertySet> m_properties; | 172 RefPtr<StylePropertySet> m_properties; |
179 CSSSelectorList m_selectorList; | 173 CSSSelectorList m_selectorList; |
180 }; | 174 }; |
181 | 175 |
182 class StyleRuleGroup : public StyleRuleBase { | 176 class StyleRuleGroup : public StyleRuleBase { |
183 public: | 177 public: |
184 const Vector<RefPtr<StyleRuleBase> >& childRules() const { return m_childRul
es; } | 178 const Vector<RefPtr<StyleRuleBase> >& childRules() const { return m_childRul
es; } |
185 | 179 |
186 void wrapperInsertRule(unsigned, PassRefPtr<StyleRuleBase>); | 180 void wrapperInsertRule(unsigned, PassRefPtr<StyleRuleBase>); |
187 void wrapperRemoveRule(unsigned); | 181 void wrapperRemoveRule(unsigned); |
188 | |
189 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; | |
190 | 182 |
191 protected: | 183 protected: |
192 StyleRuleGroup(Type, Vector<RefPtr<StyleRuleBase> >& adoptRule); | 184 StyleRuleGroup(Type, Vector<RefPtr<StyleRuleBase> >& adoptRule); |
193 StyleRuleGroup(const StyleRuleGroup&); | 185 StyleRuleGroup(const StyleRuleGroup&); |
194 | 186 |
195 private: | 187 private: |
196 Vector<RefPtr<StyleRuleBase> > m_childRules; | 188 Vector<RefPtr<StyleRuleBase> > m_childRules; |
197 }; | 189 }; |
198 | 190 |
199 class StyleRuleMedia : public StyleRuleGroup { | 191 class StyleRuleMedia : public StyleRuleGroup { |
200 public: | 192 public: |
201 static PassRefPtr<StyleRuleMedia> create(PassRefPtr<MediaQuerySet> media, Ve
ctor<RefPtr<StyleRuleBase> >& adoptRules) | 193 static PassRefPtr<StyleRuleMedia> create(PassRefPtr<MediaQuerySet> media, Ve
ctor<RefPtr<StyleRuleBase> >& adoptRules) |
202 { | 194 { |
203 return adoptRef(new StyleRuleMedia(media, adoptRules)); | 195 return adoptRef(new StyleRuleMedia(media, adoptRules)); |
204 } | 196 } |
205 | 197 |
206 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); } | 198 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); } |
207 | 199 |
208 PassRefPtr<StyleRuleMedia> copy() const { return adoptRef(new StyleRuleMedia
(*this)); } | 200 PassRefPtr<StyleRuleMedia> copy() const { return adoptRef(new StyleRuleMedia
(*this)); } |
209 | 201 |
210 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; | |
211 | |
212 private: | 202 private: |
213 StyleRuleMedia(PassRefPtr<MediaQuerySet>, Vector<RefPtr<StyleRuleBase> >& ad
optRules); | 203 StyleRuleMedia(PassRefPtr<MediaQuerySet>, Vector<RefPtr<StyleRuleBase> >& ad
optRules); |
214 StyleRuleMedia(const StyleRuleMedia&); | 204 StyleRuleMedia(const StyleRuleMedia&); |
215 | 205 |
216 RefPtr<MediaQuerySet> m_mediaQueries; | 206 RefPtr<MediaQuerySet> m_mediaQueries; |
217 }; | 207 }; |
218 | 208 |
219 class StyleRuleSupports : public StyleRuleGroup { | 209 class StyleRuleSupports : public StyleRuleGroup { |
220 public: | 210 public: |
221 static PassRefPtr<StyleRuleSupports> create(const String& conditionText, boo
l conditionIsSupported, Vector<RefPtr<StyleRuleBase> >& adoptRules) | 211 static PassRefPtr<StyleRuleSupports> create(const String& conditionText, boo
l conditionIsSupported, Vector<RefPtr<StyleRuleBase> >& adoptRules) |
(...skipping 17 matching lines...) Expand all Loading... |
239 public: | 229 public: |
240 static PassRefPtr<StyleRuleRegion> create(Vector<OwnPtr<CSSParserSelector> >
* selectors, Vector<RefPtr<StyleRuleBase> >& adoptRules) | 230 static PassRefPtr<StyleRuleRegion> create(Vector<OwnPtr<CSSParserSelector> >
* selectors, Vector<RefPtr<StyleRuleBase> >& adoptRules) |
241 { | 231 { |
242 return adoptRef(new StyleRuleRegion(selectors, adoptRules)); | 232 return adoptRef(new StyleRuleRegion(selectors, adoptRules)); |
243 } | 233 } |
244 | 234 |
245 const CSSSelectorList& selectorList() const { return m_selectorList; } | 235 const CSSSelectorList& selectorList() const { return m_selectorList; } |
246 | 236 |
247 PassRefPtr<StyleRuleRegion> copy() const { return adoptRef(new StyleRuleRegi
on(*this)); } | 237 PassRefPtr<StyleRuleRegion> copy() const { return adoptRef(new StyleRuleRegi
on(*this)); } |
248 | 238 |
249 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; | |
250 | |
251 private: | 239 private: |
252 StyleRuleRegion(Vector<OwnPtr<CSSParserSelector> >*, Vector<RefPtr<StyleRule
Base> >& adoptRules); | 240 StyleRuleRegion(Vector<OwnPtr<CSSParserSelector> >*, Vector<RefPtr<StyleRule
Base> >& adoptRules); |
253 StyleRuleRegion(const StyleRuleRegion&); | 241 StyleRuleRegion(const StyleRuleRegion&); |
254 | 242 |
255 CSSSelectorList m_selectorList; | 243 CSSSelectorList m_selectorList; |
256 }; | 244 }; |
257 | 245 |
258 class StyleRuleHost : public StyleRuleGroup { | 246 class StyleRuleHost : public StyleRuleGroup { |
259 public: | 247 public: |
260 static PassRefPtr<StyleRuleHost> create(Vector<RefPtr<StyleRuleBase> >& adop
tRules) | 248 static PassRefPtr<StyleRuleHost> create(Vector<RefPtr<StyleRuleBase> >& adop
tRules) |
(...skipping 15 matching lines...) Expand all Loading... |
276 | 264 |
277 ~StyleRuleViewport(); | 265 ~StyleRuleViewport(); |
278 | 266 |
279 const StylePropertySet* properties() const { return m_properties.get(); } | 267 const StylePropertySet* properties() const { return m_properties.get(); } |
280 StylePropertySet* mutableProperties(); | 268 StylePropertySet* mutableProperties(); |
281 | 269 |
282 void setProperties(PassRefPtr<StylePropertySet>); | 270 void setProperties(PassRefPtr<StylePropertySet>); |
283 | 271 |
284 PassRefPtr<StyleRuleViewport> copy() const { return adoptRef(new StyleRuleVi
ewport(*this)); } | 272 PassRefPtr<StyleRuleViewport> copy() const { return adoptRef(new StyleRuleVi
ewport(*this)); } |
285 | 273 |
286 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; | |
287 | |
288 private: | 274 private: |
289 StyleRuleViewport(); | 275 StyleRuleViewport(); |
290 StyleRuleViewport(const StyleRuleViewport&); | 276 StyleRuleViewport(const StyleRuleViewport&); |
291 | 277 |
292 RefPtr<StylePropertySet> m_properties; | 278 RefPtr<StylePropertySet> m_properties; |
293 }; | 279 }; |
294 #endif // ENABLE(CSS_DEVICE_ADAPTATION) | 280 #endif // ENABLE(CSS_DEVICE_ADAPTATION) |
295 | 281 |
296 inline const StyleRuleMedia* toStyleRuleMedia(const StyleRuleGroup* rule) | 282 inline const StyleRuleMedia* toStyleRuleMedia(const StyleRuleGroup* rule) |
297 { | 283 { |
(...skipping 21 matching lines...) Expand all Loading... |
319 | 305 |
320 const String& filterName() const { return m_filterName; } | 306 const String& filterName() const { return m_filterName; } |
321 | 307 |
322 const StylePropertySet* properties() const { return m_properties.get(); } | 308 const StylePropertySet* properties() const { return m_properties.get(); } |
323 StylePropertySet* mutableProperties(); | 309 StylePropertySet* mutableProperties(); |
324 | 310 |
325 void setProperties(PassRefPtr<StylePropertySet>); | 311 void setProperties(PassRefPtr<StylePropertySet>); |
326 | 312 |
327 PassRefPtr<StyleRuleFilter> copy() const { return adoptRef(new StyleRuleFilt
er(*this)); } | 313 PassRefPtr<StyleRuleFilter> copy() const { return adoptRef(new StyleRuleFilt
er(*this)); } |
328 | 314 |
329 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; | |
330 | |
331 private: | 315 private: |
332 StyleRuleFilter(const String&); | 316 StyleRuleFilter(const String&); |
333 StyleRuleFilter(const StyleRuleFilter&); | 317 StyleRuleFilter(const StyleRuleFilter&); |
334 | 318 |
335 String m_filterName; | 319 String m_filterName; |
336 RefPtr<StylePropertySet> m_properties; | 320 RefPtr<StylePropertySet> m_properties; |
337 }; | 321 }; |
338 | 322 |
339 } // namespace WebCore | 323 } // namespace WebCore |
340 | 324 |
341 #endif // StyleRule_h | 325 #endif // StyleRule_h |
OLD | NEW |