| 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 28 matching lines...) Expand all Loading... |
| 39 enum Type { | 39 enum Type { |
| 40 Unknown, // Not used. | 40 Unknown, // Not used. |
| 41 Style, | 41 Style, |
| 42 Charset, // Not used. These are internally strings owned by the style sh
eet. | 42 Charset, // Not used. These are internally strings owned by the style sh
eet. |
| 43 Import, | 43 Import, |
| 44 Media, | 44 Media, |
| 45 FontFace, | 45 FontFace, |
| 46 Page, | 46 Page, |
| 47 Keyframes, | 47 Keyframes, |
| 48 Keyframe, // Not used. These are internally non-rule StyleKeyframe objec
ts. | 48 Keyframe, // Not used. These are internally non-rule StyleKeyframe objec
ts. |
| 49 #if ENABLE(CSS3_CONDITIONAL_RULES) | |
| 50 Supports = 12, | 49 Supports = 12, |
| 51 #endif | |
| 52 #if ENABLE(CSS_DEVICE_ADAPTATION) | 50 #if ENABLE(CSS_DEVICE_ADAPTATION) |
| 53 Viewport = 15, | 51 Viewport = 15, |
| 54 #endif | 52 #endif |
| 55 Region = 16, | 53 Region = 16, |
| 56 Filter = 17, | 54 Filter = 17, |
| 57 HostInternal = 18, // Spec says Host = 1001, but we can use only 5 bit f
or type(). | 55 HostInternal = 18, // Spec says Host = 1001, but we can use only 5 bit f
or type(). |
| 58 }; | 56 }; |
| 59 | 57 |
| 60 Type type() const { return static_cast<Type>(m_type); } | 58 Type type() const { return static_cast<Type>(m_type); } |
| 61 | 59 |
| 62 bool isCharsetRule() const { return type() == Charset; } | 60 bool isCharsetRule() const { return type() == Charset; } |
| 63 bool isFontFaceRule() const { return type() == FontFace; } | 61 bool isFontFaceRule() const { return type() == FontFace; } |
| 64 bool isKeyframesRule() const { return type() == Keyframes; } | 62 bool isKeyframesRule() const { return type() == Keyframes; } |
| 65 bool isMediaRule() const { return type() == Media; } | 63 bool isMediaRule() const { return type() == Media; } |
| 66 bool isPageRule() const { return type() == Page; } | 64 bool isPageRule() const { return type() == Page; } |
| 67 bool isStyleRule() const { return type() == Style; } | 65 bool isStyleRule() const { return type() == Style; } |
| 68 bool isRegionRule() const { return type() == Region; } | 66 bool isRegionRule() const { return type() == Region; } |
| 69 #if ENABLE(CSS3_CONDITIONAL_RULES) | |
| 70 bool isSupportsRule() const { return type() == Supports; } | 67 bool isSupportsRule() const { return type() == Supports; } |
| 71 #endif | |
| 72 #if ENABLE(CSS_DEVICE_ADAPTATION) | 68 #if ENABLE(CSS_DEVICE_ADAPTATION) |
| 73 bool isViewportRule() const { return type() == Viewport; } | 69 bool isViewportRule() const { return type() == Viewport; } |
| 74 #endif | 70 #endif |
| 75 bool isImportRule() const { return type() == Import; } | 71 bool isImportRule() const { return type() == Import; } |
| 76 bool isHostRule() const { return type() == HostInternal; } | 72 bool isHostRule() const { return type() == HostInternal; } |
| 77 bool isFilterRule() const { return type() == Filter; } | 73 bool isFilterRule() const { return type() == Filter; } |
| 78 | 74 |
| 79 PassRefPtr<StyleRuleBase> copy() const; | 75 PassRefPtr<StyleRuleBase> copy() const; |
| 80 | 76 |
| 81 int sourceLine() const { return m_sourceLine; } | 77 int sourceLine() const { return m_sourceLine; } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 209 |
| 214 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; | 210 void reportDescendantMemoryUsage(MemoryObjectInfo*) const; |
| 215 | 211 |
| 216 private: | 212 private: |
| 217 StyleRuleMedia(PassRefPtr<MediaQuerySet>, Vector<RefPtr<StyleRuleBase> >& ad
optRules); | 213 StyleRuleMedia(PassRefPtr<MediaQuerySet>, Vector<RefPtr<StyleRuleBase> >& ad
optRules); |
| 218 StyleRuleMedia(const StyleRuleMedia&); | 214 StyleRuleMedia(const StyleRuleMedia&); |
| 219 | 215 |
| 220 RefPtr<MediaQuerySet> m_mediaQueries; | 216 RefPtr<MediaQuerySet> m_mediaQueries; |
| 221 }; | 217 }; |
| 222 | 218 |
| 223 #if ENABLE(CSS3_CONDITIONAL_RULES) | |
| 224 class StyleRuleSupports : public StyleRuleGroup { | 219 class StyleRuleSupports : public StyleRuleGroup { |
| 225 public: | 220 public: |
| 226 static PassRefPtr<StyleRuleSupports> create(const String& conditionText, boo
l conditionIsSupported, Vector<RefPtr<StyleRuleBase> >& adoptRules) | 221 static PassRefPtr<StyleRuleSupports> create(const String& conditionText, boo
l conditionIsSupported, Vector<RefPtr<StyleRuleBase> >& adoptRules) |
| 227 { | 222 { |
| 228 return adoptRef(new StyleRuleSupports(conditionText, conditionIsSupporte
d, adoptRules)); | 223 return adoptRef(new StyleRuleSupports(conditionText, conditionIsSupporte
d, adoptRules)); |
| 229 } | 224 } |
| 230 | 225 |
| 231 String conditionText() const { return m_conditionText; } | 226 String conditionText() const { return m_conditionText; } |
| 232 bool conditionIsSupported() const { return m_conditionIsSupported; } | 227 bool conditionIsSupported() const { return m_conditionIsSupported; } |
| 233 PassRefPtr<StyleRuleSupports> copy() const { return adoptRef(new StyleRuleSu
pports(*this)); } | 228 PassRefPtr<StyleRuleSupports> copy() const { return adoptRef(new StyleRuleSu
pports(*this)); } |
| 234 | 229 |
| 235 private: | 230 private: |
| 236 StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Ve
ctor<RefPtr<StyleRuleBase> >& adoptRules); | 231 StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Ve
ctor<RefPtr<StyleRuleBase> >& adoptRules); |
| 237 StyleRuleSupports(const StyleRuleSupports&); | 232 StyleRuleSupports(const StyleRuleSupports&); |
| 238 | 233 |
| 239 String m_conditionText; | 234 String m_conditionText; |
| 240 bool m_conditionIsSupported; | 235 bool m_conditionIsSupported; |
| 241 }; | 236 }; |
| 242 #endif | |
| 243 | 237 |
| 244 class StyleRuleRegion : public StyleRuleGroup { | 238 class StyleRuleRegion : public StyleRuleGroup { |
| 245 public: | 239 public: |
| 246 static PassRefPtr<StyleRuleRegion> create(Vector<OwnPtr<CSSParserSelector> >
* selectors, Vector<RefPtr<StyleRuleBase> >& adoptRules) | 240 static PassRefPtr<StyleRuleRegion> create(Vector<OwnPtr<CSSParserSelector> >
* selectors, Vector<RefPtr<StyleRuleBase> >& adoptRules) |
| 247 { | 241 { |
| 248 return adoptRef(new StyleRuleRegion(selectors, adoptRules)); | 242 return adoptRef(new StyleRuleRegion(selectors, adoptRules)); |
| 249 } | 243 } |
| 250 | 244 |
| 251 const CSSSelectorList& selectorList() const { return m_selectorList; } | 245 const CSSSelectorList& selectorList() const { return m_selectorList; } |
| 252 | 246 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 RefPtr<StylePropertySet> m_properties; | 292 RefPtr<StylePropertySet> m_properties; |
| 299 }; | 293 }; |
| 300 #endif // ENABLE(CSS_DEVICE_ADAPTATION) | 294 #endif // ENABLE(CSS_DEVICE_ADAPTATION) |
| 301 | 295 |
| 302 inline const StyleRuleMedia* toStyleRuleMedia(const StyleRuleGroup* rule) | 296 inline const StyleRuleMedia* toStyleRuleMedia(const StyleRuleGroup* rule) |
| 303 { | 297 { |
| 304 ASSERT_WITH_SECURITY_IMPLICATION(!rule || rule->isMediaRule()); | 298 ASSERT_WITH_SECURITY_IMPLICATION(!rule || rule->isMediaRule()); |
| 305 return static_cast<const StyleRuleMedia*>(rule); | 299 return static_cast<const StyleRuleMedia*>(rule); |
| 306 } | 300 } |
| 307 | 301 |
| 308 #if ENABLE(CSS3_CONDITIONAL_RULES) | |
| 309 inline const StyleRuleSupports* toStyleRuleSupports(const StyleRuleGroup* rule) | 302 inline const StyleRuleSupports* toStyleRuleSupports(const StyleRuleGroup* rule) |
| 310 { | 303 { |
| 311 ASSERT_WITH_SECURITY_IMPLICATION(!rule || rule->isSupportsRule()); | 304 ASSERT_WITH_SECURITY_IMPLICATION(!rule || rule->isSupportsRule()); |
| 312 return static_cast<const StyleRuleSupports*>(rule); | 305 return static_cast<const StyleRuleSupports*>(rule); |
| 313 } | 306 } |
| 314 #endif | |
| 315 | 307 |
| 316 inline const StyleRuleRegion* toStyleRuleRegion(const StyleRuleGroup* rule) | 308 inline const StyleRuleRegion* toStyleRuleRegion(const StyleRuleGroup* rule) |
| 317 { | 309 { |
| 318 ASSERT_WITH_SECURITY_IMPLICATION(!rule || rule->isRegionRule()); | 310 ASSERT_WITH_SECURITY_IMPLICATION(!rule || rule->isRegionRule()); |
| 319 return static_cast<const StyleRuleRegion*>(rule); | 311 return static_cast<const StyleRuleRegion*>(rule); |
| 320 } | 312 } |
| 321 | 313 |
| 322 class StyleRuleFilter : public StyleRuleBase { | 314 class StyleRuleFilter : public StyleRuleBase { |
| 323 public: | 315 public: |
| 324 static PassRefPtr<StyleRuleFilter> create(const String& filterName) { return
adoptRef(new StyleRuleFilter(filterName)); } | 316 static PassRefPtr<StyleRuleFilter> create(const String& filterName) { return
adoptRef(new StyleRuleFilter(filterName)); } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 340 StyleRuleFilter(const String&); | 332 StyleRuleFilter(const String&); |
| 341 StyleRuleFilter(const StyleRuleFilter&); | 333 StyleRuleFilter(const StyleRuleFilter&); |
| 342 | 334 |
| 343 String m_filterName; | 335 String m_filterName; |
| 344 RefPtr<StylePropertySet> m_properties; | 336 RefPtr<StylePropertySet> m_properties; |
| 345 }; | 337 }; |
| 346 | 338 |
| 347 } // namespace WebCore | 339 } // namespace WebCore |
| 348 | 340 |
| 349 #endif // StyleRule_h | 341 #endif // StyleRule_h |
| OLD | NEW |