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, 2013 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 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 */ | 20 */ |
21 | 21 |
22 #ifndef StyleRule_h | 22 #ifndef StyleRule_h |
23 #define StyleRule_h | 23 #define StyleRule_h |
24 | 24 |
25 #include "core/css/CSSSelectorList.h" | 25 #include "core/css/CSSSelectorList.h" |
26 #include "core/css/MediaList.h" | 26 #include "core/css/MediaList.h" |
27 #include <wtf/RefPtr.h> | 27 #include <wtf/RefPtr.h> |
28 | 28 |
29 namespace WebCore { | 29 namespace WebCore { |
30 | 30 |
31 class CSSRule; | 31 class CSSRule; |
32 class CSSStyleRule; | 32 class CSSStyleRule; |
33 class CSSStyleSheet; | 33 class CSSStyleSheet; |
| 34 class MutableStylePropertySet; |
34 class StylePropertySet; | 35 class StylePropertySet; |
35 | 36 |
36 class StyleRuleBase : public WTF::RefCountedBase { | 37 class StyleRuleBase : public WTF::RefCountedBase { |
37 WTF_MAKE_FAST_ALLOCATED; | 38 WTF_MAKE_FAST_ALLOCATED; |
38 public: | 39 public: |
39 enum Type { | 40 enum Type { |
40 Unknown, // Not used. | 41 Unknown, // Not used. |
41 Style, | 42 Style, |
42 Charset, // Not used. These are internally strings owned by the style sh
eet. | 43 Charset, // Not used. These are internally strings owned by the style sh
eet. |
43 Import, | 44 Import, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 106 |
106 class StyleRule : public StyleRuleBase { | 107 class StyleRule : public StyleRuleBase { |
107 WTF_MAKE_FAST_ALLOCATED; | 108 WTF_MAKE_FAST_ALLOCATED; |
108 public: | 109 public: |
109 static PassRefPtr<StyleRule> create(int sourceLine) { return adoptRef(new St
yleRule(sourceLine)); } | 110 static PassRefPtr<StyleRule> create(int sourceLine) { return adoptRef(new St
yleRule(sourceLine)); } |
110 | 111 |
111 ~StyleRule(); | 112 ~StyleRule(); |
112 | 113 |
113 const CSSSelectorList& selectorList() const { return m_selectorList; } | 114 const CSSSelectorList& selectorList() const { return m_selectorList; } |
114 const StylePropertySet* properties() const { return m_properties.get(); } | 115 const StylePropertySet* properties() const { return m_properties.get(); } |
115 StylePropertySet* mutableProperties(); | 116 MutableStylePropertySet* mutableProperties(); |
116 | 117 |
117 void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors
) { m_selectorList.adoptSelectorVector(selectors); } | 118 void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors
) { m_selectorList.adoptSelectorVector(selectors); } |
118 void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.a
dopt(selectors); } | 119 void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.a
dopt(selectors); } |
119 void setProperties(PassRefPtr<StylePropertySet>); | 120 void setProperties(PassRefPtr<StylePropertySet>); |
120 | 121 |
121 PassRefPtr<StyleRule> copy() const { return adoptRef(new StyleRule(*this));
} | 122 PassRefPtr<StyleRule> copy() const { return adoptRef(new StyleRule(*this));
} |
122 | 123 |
123 static unsigned averageSizeInBytes(); | 124 static unsigned averageSizeInBytes(); |
124 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; | 125 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; |
125 | 126 |
(...skipping 11 matching lines...) Expand all Loading... |
137 return static_cast<const StyleRule*>(rule); | 138 return static_cast<const StyleRule*>(rule); |
138 } | 139 } |
139 | 140 |
140 class StyleRuleFontFace : public StyleRuleBase { | 141 class StyleRuleFontFace : public StyleRuleBase { |
141 public: | 142 public: |
142 static PassRefPtr<StyleRuleFontFace> create() { return adoptRef(new StyleRul
eFontFace); } | 143 static PassRefPtr<StyleRuleFontFace> create() { return adoptRef(new StyleRul
eFontFace); } |
143 | 144 |
144 ~StyleRuleFontFace(); | 145 ~StyleRuleFontFace(); |
145 | 146 |
146 const StylePropertySet* properties() const { return m_properties.get(); } | 147 const StylePropertySet* properties() const { return m_properties.get(); } |
147 StylePropertySet* mutableProperties(); | 148 MutableStylePropertySet* mutableProperties(); |
148 | 149 |
149 void setProperties(PassRefPtr<StylePropertySet>); | 150 void setProperties(PassRefPtr<StylePropertySet>); |
150 | 151 |
151 PassRefPtr<StyleRuleFontFace> copy() const { return adoptRef(new StyleRuleFo
ntFace(*this)); } | 152 PassRefPtr<StyleRuleFontFace> copy() const { return adoptRef(new StyleRuleFo
ntFace(*this)); } |
152 | 153 |
153 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; | 154 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; |
154 | 155 |
155 private: | 156 private: |
156 StyleRuleFontFace(); | 157 StyleRuleFontFace(); |
157 StyleRuleFontFace(const StyleRuleFontFace&); | 158 StyleRuleFontFace(const StyleRuleFontFace&); |
158 | 159 |
159 RefPtr<StylePropertySet> m_properties; | 160 RefPtr<StylePropertySet> m_properties; |
160 }; | 161 }; |
161 | 162 |
162 class StyleRulePage : public StyleRuleBase { | 163 class StyleRulePage : public StyleRuleBase { |
163 public: | 164 public: |
164 static PassRefPtr<StyleRulePage> create() { return adoptRef(new StyleRulePag
e); } | 165 static PassRefPtr<StyleRulePage> create() { return adoptRef(new StyleRulePag
e); } |
165 | 166 |
166 ~StyleRulePage(); | 167 ~StyleRulePage(); |
167 | 168 |
168 const CSSSelector* selector() const { return m_selectorList.first(); } | 169 const CSSSelector* selector() const { return m_selectorList.first(); } |
169 const StylePropertySet* properties() const { return m_properties.get(); } | 170 const StylePropertySet* properties() const { return m_properties.get(); } |
170 StylePropertySet* mutableProperties(); | 171 MutableStylePropertySet* mutableProperties(); |
171 | 172 |
172 void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors
) { m_selectorList.adoptSelectorVector(selectors); } | 173 void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors
) { m_selectorList.adoptSelectorVector(selectors); } |
173 void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.a
dopt(selectors); } | 174 void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.a
dopt(selectors); } |
174 void setProperties(PassRefPtr<StylePropertySet>); | 175 void setProperties(PassRefPtr<StylePropertySet>); |
175 | 176 |
176 PassRefPtr<StyleRulePage> copy() const { return adoptRef(new StyleRulePage(*
this)); } | 177 PassRefPtr<StyleRulePage> copy() const { return adoptRef(new StyleRulePage(*
this)); } |
177 | 178 |
178 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; | 179 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; |
179 | 180 |
180 private: | 181 private: |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 }; | 277 }; |
277 | 278 |
278 #if ENABLE(CSS_DEVICE_ADAPTATION) | 279 #if ENABLE(CSS_DEVICE_ADAPTATION) |
279 class StyleRuleViewport : public StyleRuleBase { | 280 class StyleRuleViewport : public StyleRuleBase { |
280 public: | 281 public: |
281 static PassRefPtr<StyleRuleViewport> create() { return adoptRef(new StyleRul
eViewport); } | 282 static PassRefPtr<StyleRuleViewport> create() { return adoptRef(new StyleRul
eViewport); } |
282 | 283 |
283 ~StyleRuleViewport(); | 284 ~StyleRuleViewport(); |
284 | 285 |
285 const StylePropertySet* properties() const { return m_properties.get(); } | 286 const StylePropertySet* properties() const { return m_properties.get(); } |
286 StylePropertySet* mutableProperties(); | 287 MutableStylePropertySet* mutableProperties(); |
287 | 288 |
288 void setProperties(PassRefPtr<StylePropertySet>); | 289 void setProperties(PassRefPtr<StylePropertySet>); |
289 | 290 |
290 PassRefPtr<StyleRuleViewport> copy() const { return adoptRef(new StyleRuleVi
ewport(*this)); } | 291 PassRefPtr<StyleRuleViewport> copy() const { return adoptRef(new StyleRuleVi
ewport(*this)); } |
291 | 292 |
292 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; | 293 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; |
293 | 294 |
294 private: | 295 private: |
295 StyleRuleViewport(); | 296 StyleRuleViewport(); |
296 StyleRuleViewport(const StyleRuleViewport&); | 297 StyleRuleViewport(const StyleRuleViewport&); |
(...skipping 22 matching lines...) Expand all Loading... |
319 | 320 |
320 class StyleRuleFilter : public StyleRuleBase { | 321 class StyleRuleFilter : public StyleRuleBase { |
321 public: | 322 public: |
322 static PassRefPtr<StyleRuleFilter> create(const String& filterName) { return
adoptRef(new StyleRuleFilter(filterName)); } | 323 static PassRefPtr<StyleRuleFilter> create(const String& filterName) { return
adoptRef(new StyleRuleFilter(filterName)); } |
323 | 324 |
324 ~StyleRuleFilter(); | 325 ~StyleRuleFilter(); |
325 | 326 |
326 const String& filterName() const { return m_filterName; } | 327 const String& filterName() const { return m_filterName; } |
327 | 328 |
328 const StylePropertySet* properties() const { return m_properties.get(); } | 329 const StylePropertySet* properties() const { return m_properties.get(); } |
329 StylePropertySet* mutableProperties(); | 330 MutableStylePropertySet* mutableProperties(); |
330 | 331 |
331 void setProperties(PassRefPtr<StylePropertySet>); | 332 void setProperties(PassRefPtr<StylePropertySet>); |
332 | 333 |
333 PassRefPtr<StyleRuleFilter> copy() const { return adoptRef(new StyleRuleFilt
er(*this)); } | 334 PassRefPtr<StyleRuleFilter> copy() const { return adoptRef(new StyleRuleFilt
er(*this)); } |
334 | 335 |
335 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; | 336 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; |
336 | 337 |
337 private: | 338 private: |
338 StyleRuleFilter(const String&); | 339 StyleRuleFilter(const String&); |
339 StyleRuleFilter(const StyleRuleFilter&); | 340 StyleRuleFilter(const StyleRuleFilter&); |
340 | 341 |
341 String m_filterName; | 342 String m_filterName; |
342 RefPtr<StylePropertySet> m_properties; | 343 RefPtr<StylePropertySet> m_properties; |
343 }; | 344 }; |
344 | 345 |
345 } // namespace WebCore | 346 } // namespace WebCore |
346 | 347 |
347 #endif // StyleRule_h | 348 #endif // StyleRule_h |
OLD | NEW |