| 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, 2013 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 * |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 WTF_MAKE_FAST_ALLOCATED; | 35 WTF_MAKE_FAST_ALLOCATED; |
| 36 public: | 36 public: |
| 37 enum Type { | 37 enum Type { |
| 38 Unknown, // Not used. | 38 Unknown, // Not used. |
| 39 Style, | 39 Style, |
| 40 Media, | 40 Media, |
| 41 FontFace = 4, | 41 FontFace = 4, |
| 42 Keyframes = 5, | 42 Keyframes = 5, |
| 43 Keyframe, // Not used. These are internally non-rule StyleKeyframe objec
ts. | 43 Keyframe, // Not used. These are internally non-rule StyleKeyframe objec
ts. |
| 44 Supports = 12, | 44 Supports = 12, |
| 45 Filter = 17 | |
| 46 }; | 45 }; |
| 47 | 46 |
| 48 Type type() const { return static_cast<Type>(m_type); } | 47 Type type() const { return static_cast<Type>(m_type); } |
| 49 | 48 |
| 50 bool isFontFaceRule() const { return type() == FontFace; } | 49 bool isFontFaceRule() const { return type() == FontFace; } |
| 51 bool isKeyframesRule() const { return type() == Keyframes; } | 50 bool isKeyframesRule() const { return type() == Keyframes; } |
| 52 bool isMediaRule() const { return type() == Media; } | 51 bool isMediaRule() const { return type() == Media; } |
| 53 bool isStyleRule() const { return type() == Style; } | 52 bool isStyleRule() const { return type() == Style; } |
| 54 bool isSupportsRule() const { return type() == Supports; } | 53 bool isSupportsRule() const { return type() == Supports; } |
| 55 bool isFilterRule() const { return type() == Filter; } | |
| 56 | 54 |
| 57 void deref() | 55 void deref() |
| 58 { | 56 { |
| 59 if (derefBase()) | 57 if (derefBase()) |
| 60 destroy(); | 58 destroy(); |
| 61 } | 59 } |
| 62 | 60 |
| 63 protected: | 61 protected: |
| 64 StyleRuleBase(Type type) : m_type(type) { } | 62 StyleRuleBase(Type type) : m_type(type) { } |
| 65 | 63 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 String conditionText() const { return m_conditionText; } | 148 String conditionText() const { return m_conditionText; } |
| 151 bool conditionIsSupported() const { return m_conditionIsSupported; } | 149 bool conditionIsSupported() const { return m_conditionIsSupported; } |
| 152 | 150 |
| 153 private: | 151 private: |
| 154 StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Ve
ctor<RefPtr<StyleRuleBase> >& adoptRules); | 152 StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Ve
ctor<RefPtr<StyleRuleBase> >& adoptRules); |
| 155 | 153 |
| 156 String m_conditionText; | 154 String m_conditionText; |
| 157 bool m_conditionIsSupported; | 155 bool m_conditionIsSupported; |
| 158 }; | 156 }; |
| 159 | 157 |
| 160 class StyleRuleFilter final : public StyleRuleBase { | |
| 161 WTF_MAKE_NONCOPYABLE(StyleRuleFilter); | |
| 162 public: | |
| 163 static PassRefPtr<StyleRuleFilter> create(const String& filterName) { return
adoptRef(new StyleRuleFilter(filterName)); } | |
| 164 | |
| 165 ~StyleRuleFilter(); | |
| 166 | |
| 167 const String& filterName() const { return m_filterName; } | |
| 168 | |
| 169 const StylePropertySet& properties() const { return *m_properties; } | |
| 170 | |
| 171 void setProperties(PassRefPtr<StylePropertySet>); | |
| 172 | |
| 173 private: | |
| 174 StyleRuleFilter(const String&); | |
| 175 | |
| 176 String m_filterName; | |
| 177 RefPtr<StylePropertySet> m_properties; | |
| 178 }; | |
| 179 | |
| 180 #define DEFINE_STYLE_RULE_TYPE_CASTS(Type) \ | 158 #define DEFINE_STYLE_RULE_TYPE_CASTS(Type) \ |
| 181 DEFINE_TYPE_CASTS(StyleRule##Type, StyleRuleBase, rule, rule->is##Type##Rule
(), rule.is##Type##Rule()) | 159 DEFINE_TYPE_CASTS(StyleRule##Type, StyleRuleBase, rule, rule->is##Type##Rule
(), rule.is##Type##Rule()) |
| 182 | 160 |
| 183 DEFINE_TYPE_CASTS(StyleRule, StyleRuleBase, rule, rule->isStyleRule(), rule.isSt
yleRule()); | 161 DEFINE_TYPE_CASTS(StyleRule, StyleRuleBase, rule, rule->isStyleRule(), rule.isSt
yleRule()); |
| 184 DEFINE_STYLE_RULE_TYPE_CASTS(FontFace); | 162 DEFINE_STYLE_RULE_TYPE_CASTS(FontFace); |
| 185 DEFINE_STYLE_RULE_TYPE_CASTS(Media); | 163 DEFINE_STYLE_RULE_TYPE_CASTS(Media); |
| 186 DEFINE_STYLE_RULE_TYPE_CASTS(Supports); | 164 DEFINE_STYLE_RULE_TYPE_CASTS(Supports); |
| 187 DEFINE_STYLE_RULE_TYPE_CASTS(Filter); | |
| 188 | 165 |
| 189 } // namespace blink | 166 } // namespace blink |
| 190 | 167 |
| 191 #endif // SKY_ENGINE_CORE_CSS_STYLERULE_H_ | 168 #endif // SKY_ENGINE_CORE_CSS_STYLERULE_H_ |
| OLD | NEW |