| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 { | 65 { |
| 66 if (derefBase()) | 66 if (derefBase()) |
| 67 destroy(); | 67 destroy(); |
| 68 } | 68 } |
| 69 #endif // !ENABLE(OILPAN) | 69 #endif // !ENABLE(OILPAN) |
| 70 | 70 |
| 71 // FIXME: There shouldn't be any need for the null parent version. | 71 // FIXME: There shouldn't be any need for the null parent version. |
| 72 PassRefPtr<CSSRule> createCSSOMWrapper(CSSStyleSheet* parentSheet = 0) const
; | 72 PassRefPtr<CSSRule> createCSSOMWrapper(CSSStyleSheet* parentSheet = 0) const
; |
| 73 PassRefPtr<CSSRule> createCSSOMWrapper(CSSRule* parentRule) const; | 73 PassRefPtr<CSSRule> createCSSOMWrapper(CSSRule* parentRule) const; |
| 74 | 74 |
| 75 void trace(Visitor*); | |
| 76 void traceAfterDispatch(Visitor*) { }; | |
| 77 void finalizeGarbageCollectedObject(); | |
| 78 | |
| 79 protected: | 75 protected: |
| 80 StyleRuleBase(Type type) : m_type(type) { } | 76 StyleRuleBase(Type type) : m_type(type) { } |
| 81 StyleRuleBase(const StyleRuleBase& o) : m_type(o.m_type) { } | 77 StyleRuleBase(const StyleRuleBase& o) : m_type(o.m_type) { } |
| 82 | 78 |
| 83 ~StyleRuleBase() { } | 79 ~StyleRuleBase() { } |
| 84 | 80 |
| 85 private: | 81 private: |
| 86 void destroy(); | 82 void destroy(); |
| 87 | 83 |
| 88 PassRefPtr<CSSRule> createCSSOMWrapper(CSSStyleSheet* parentSheet, CSSRule*
parentRule) const; | 84 PassRefPtr<CSSRule> createCSSOMWrapper(CSSStyleSheet* parentSheet, CSSRule*
parentRule) const; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 102 MutableStylePropertySet& mutableProperties(); | 98 MutableStylePropertySet& mutableProperties(); |
| 103 | 99 |
| 104 void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors
) { m_selectorList.adoptSelectorVector(selectors); } | 100 void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors
) { m_selectorList.adoptSelectorVector(selectors); } |
| 105 void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.a
dopt(selectors); } | 101 void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.a
dopt(selectors); } |
| 106 void setProperties(PassRefPtr<StylePropertySet>); | 102 void setProperties(PassRefPtr<StylePropertySet>); |
| 107 | 103 |
| 108 PassRefPtr<StyleRule> copy() const { return adoptRef(new StyleRule(*this));
} | 104 PassRefPtr<StyleRule> copy() const { return adoptRef(new StyleRule(*this));
} |
| 109 | 105 |
| 110 static unsigned averageSizeInBytes(); | 106 static unsigned averageSizeInBytes(); |
| 111 | 107 |
| 112 void traceAfterDispatch(Visitor*); | |
| 113 | |
| 114 private: | 108 private: |
| 115 StyleRule(); | 109 StyleRule(); |
| 116 StyleRule(const StyleRule&); | 110 StyleRule(const StyleRule&); |
| 117 | 111 |
| 118 RefPtr<StylePropertySet> m_properties; // Cannot be null. | 112 RefPtr<StylePropertySet> m_properties; // Cannot be null. |
| 119 CSSSelectorList m_selectorList; | 113 CSSSelectorList m_selectorList; |
| 120 }; | 114 }; |
| 121 | 115 |
| 122 class StyleRuleFontFace : public StyleRuleBase { | 116 class StyleRuleFontFace : public StyleRuleBase { |
| 123 public: | 117 public: |
| 124 static PassRefPtr<StyleRuleFontFace> create() { return adoptRef(new StyleRul
eFontFace); } | 118 static PassRefPtr<StyleRuleFontFace> create() { return adoptRef(new StyleRul
eFontFace); } |
| 125 | 119 |
| 126 ~StyleRuleFontFace(); | 120 ~StyleRuleFontFace(); |
| 127 | 121 |
| 128 const StylePropertySet& properties() const { return *m_properties; } | 122 const StylePropertySet& properties() const { return *m_properties; } |
| 129 MutableStylePropertySet& mutableProperties(); | 123 MutableStylePropertySet& mutableProperties(); |
| 130 | 124 |
| 131 void setProperties(PassRefPtr<StylePropertySet>); | 125 void setProperties(PassRefPtr<StylePropertySet>); |
| 132 | 126 |
| 133 PassRefPtr<StyleRuleFontFace> copy() const { return adoptRef(new StyleRuleFo
ntFace(*this)); } | 127 PassRefPtr<StyleRuleFontFace> copy() const { return adoptRef(new StyleRuleFo
ntFace(*this)); } |
| 134 | 128 |
| 135 void traceAfterDispatch(Visitor*); | |
| 136 | |
| 137 private: | 129 private: |
| 138 StyleRuleFontFace(); | 130 StyleRuleFontFace(); |
| 139 StyleRuleFontFace(const StyleRuleFontFace&); | 131 StyleRuleFontFace(const StyleRuleFontFace&); |
| 140 | 132 |
| 141 RefPtr<StylePropertySet> m_properties; // Cannot be null. | 133 RefPtr<StylePropertySet> m_properties; // Cannot be null. |
| 142 }; | 134 }; |
| 143 | 135 |
| 144 class StyleRuleGroup : public StyleRuleBase { | 136 class StyleRuleGroup : public StyleRuleBase { |
| 145 public: | 137 public: |
| 146 const Vector<RefPtr<StyleRuleBase> >& childRules() const { return m_childRul
es; } | 138 const Vector<RefPtr<StyleRuleBase> >& childRules() const { return m_childRul
es; } |
| 147 | 139 |
| 148 void wrapperInsertRule(unsigned, PassRefPtr<StyleRuleBase>); | 140 void wrapperInsertRule(unsigned, PassRefPtr<StyleRuleBase>); |
| 149 void wrapperRemoveRule(unsigned); | 141 void wrapperRemoveRule(unsigned); |
| 150 | 142 |
| 151 void traceAfterDispatch(Visitor*); | |
| 152 | |
| 153 protected: | 143 protected: |
| 154 StyleRuleGroup(Type, Vector<RefPtr<StyleRuleBase> >& adoptRule); | 144 StyleRuleGroup(Type, Vector<RefPtr<StyleRuleBase> >& adoptRule); |
| 155 StyleRuleGroup(const StyleRuleGroup&); | 145 StyleRuleGroup(const StyleRuleGroup&); |
| 156 | 146 |
| 157 private: | 147 private: |
| 158 Vector<RefPtr<StyleRuleBase> > m_childRules; | 148 Vector<RefPtr<StyleRuleBase> > m_childRules; |
| 159 }; | 149 }; |
| 160 | 150 |
| 161 class StyleRuleMedia : public StyleRuleGroup { | 151 class StyleRuleMedia : public StyleRuleGroup { |
| 162 public: | 152 public: |
| 163 static PassRefPtr<StyleRuleMedia> create(PassRefPtr<MediaQuerySet> media, Ve
ctor<RefPtr<StyleRuleBase> >& adoptRules) | 153 static PassRefPtr<StyleRuleMedia> create(PassRefPtr<MediaQuerySet> media, Ve
ctor<RefPtr<StyleRuleBase> >& adoptRules) |
| 164 { | 154 { |
| 165 return adoptRef(new StyleRuleMedia(media, adoptRules)); | 155 return adoptRef(new StyleRuleMedia(media, adoptRules)); |
| 166 } | 156 } |
| 167 | 157 |
| 168 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); } | 158 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); } |
| 169 | 159 |
| 170 PassRefPtr<StyleRuleMedia> copy() const { return adoptRef(new StyleRuleMedia
(*this)); } | 160 PassRefPtr<StyleRuleMedia> copy() const { return adoptRef(new StyleRuleMedia
(*this)); } |
| 171 | 161 |
| 172 void traceAfterDispatch(Visitor*); | |
| 173 | |
| 174 private: | 162 private: |
| 175 StyleRuleMedia(PassRefPtr<MediaQuerySet>, Vector<RefPtr<StyleRuleBase> >& ad
optRules); | 163 StyleRuleMedia(PassRefPtr<MediaQuerySet>, Vector<RefPtr<StyleRuleBase> >& ad
optRules); |
| 176 StyleRuleMedia(const StyleRuleMedia&); | 164 StyleRuleMedia(const StyleRuleMedia&); |
| 177 | 165 |
| 178 RefPtr<MediaQuerySet> m_mediaQueries; | 166 RefPtr<MediaQuerySet> m_mediaQueries; |
| 179 }; | 167 }; |
| 180 | 168 |
| 181 class StyleRuleSupports : public StyleRuleGroup { | 169 class StyleRuleSupports : public StyleRuleGroup { |
| 182 public: | 170 public: |
| 183 static PassRefPtr<StyleRuleSupports> create(const String& conditionText, boo
l conditionIsSupported, Vector<RefPtr<StyleRuleBase> >& adoptRules) | 171 static PassRefPtr<StyleRuleSupports> create(const String& conditionText, boo
l conditionIsSupported, Vector<RefPtr<StyleRuleBase> >& adoptRules) |
| 184 { | 172 { |
| 185 return adoptRef(new StyleRuleSupports(conditionText, conditionIsSupporte
d, adoptRules)); | 173 return adoptRef(new StyleRuleSupports(conditionText, conditionIsSupporte
d, adoptRules)); |
| 186 } | 174 } |
| 187 | 175 |
| 188 String conditionText() const { return m_conditionText; } | 176 String conditionText() const { return m_conditionText; } |
| 189 bool conditionIsSupported() const { return m_conditionIsSupported; } | 177 bool conditionIsSupported() const { return m_conditionIsSupported; } |
| 190 PassRefPtr<StyleRuleSupports> copy() const { return adoptRef(new StyleRuleSu
pports(*this)); } | 178 PassRefPtr<StyleRuleSupports> copy() const { return adoptRef(new StyleRuleSu
pports(*this)); } |
| 191 | 179 |
| 192 void traceAfterDispatch(Visitor* visitor) { StyleRuleGroup::traceAfterDispat
ch(visitor); } | |
| 193 | |
| 194 private: | 180 private: |
| 195 StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Ve
ctor<RefPtr<StyleRuleBase> >& adoptRules); | 181 StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Ve
ctor<RefPtr<StyleRuleBase> >& adoptRules); |
| 196 StyleRuleSupports(const StyleRuleSupports&); | 182 StyleRuleSupports(const StyleRuleSupports&); |
| 197 | 183 |
| 198 String m_conditionText; | 184 String m_conditionText; |
| 199 bool m_conditionIsSupported; | 185 bool m_conditionIsSupported; |
| 200 }; | 186 }; |
| 201 | 187 |
| 202 class StyleRuleFilter : public StyleRuleBase { | 188 class StyleRuleFilter : public StyleRuleBase { |
| 203 public: | 189 public: |
| 204 static PassRefPtr<StyleRuleFilter> create(const String& filterName) { return
adoptRef(new StyleRuleFilter(filterName)); } | 190 static PassRefPtr<StyleRuleFilter> create(const String& filterName) { return
adoptRef(new StyleRuleFilter(filterName)); } |
| 205 | 191 |
| 206 ~StyleRuleFilter(); | 192 ~StyleRuleFilter(); |
| 207 | 193 |
| 208 const String& filterName() const { return m_filterName; } | 194 const String& filterName() const { return m_filterName; } |
| 209 | 195 |
| 210 const StylePropertySet& properties() const { return *m_properties; } | 196 const StylePropertySet& properties() const { return *m_properties; } |
| 211 MutableStylePropertySet& mutableProperties(); | 197 MutableStylePropertySet& mutableProperties(); |
| 212 | 198 |
| 213 void setProperties(PassRefPtr<StylePropertySet>); | 199 void setProperties(PassRefPtr<StylePropertySet>); |
| 214 | 200 |
| 215 PassRefPtr<StyleRuleFilter> copy() const { return adoptRef(new StyleRuleFilt
er(*this)); } | 201 PassRefPtr<StyleRuleFilter> copy() const { return adoptRef(new StyleRuleFilt
er(*this)); } |
| 216 | 202 |
| 217 void traceAfterDispatch(Visitor*); | |
| 218 | |
| 219 private: | 203 private: |
| 220 StyleRuleFilter(const String&); | 204 StyleRuleFilter(const String&); |
| 221 StyleRuleFilter(const StyleRuleFilter&); | 205 StyleRuleFilter(const StyleRuleFilter&); |
| 222 | 206 |
| 223 String m_filterName; | 207 String m_filterName; |
| 224 RefPtr<StylePropertySet> m_properties; | 208 RefPtr<StylePropertySet> m_properties; |
| 225 }; | 209 }; |
| 226 | 210 |
| 227 #define DEFINE_STYLE_RULE_TYPE_CASTS(Type) \ | 211 #define DEFINE_STYLE_RULE_TYPE_CASTS(Type) \ |
| 228 DEFINE_TYPE_CASTS(StyleRule##Type, StyleRuleBase, rule, rule->is##Type##Rule
(), rule.is##Type##Rule()) | 212 DEFINE_TYPE_CASTS(StyleRule##Type, StyleRuleBase, rule, rule->is##Type##Rule
(), rule.is##Type##Rule()) |
| 229 | 213 |
| 230 DEFINE_TYPE_CASTS(StyleRule, StyleRuleBase, rule, rule->isStyleRule(), rule.isSt
yleRule()); | 214 DEFINE_TYPE_CASTS(StyleRule, StyleRuleBase, rule, rule->isStyleRule(), rule.isSt
yleRule()); |
| 231 DEFINE_STYLE_RULE_TYPE_CASTS(FontFace); | 215 DEFINE_STYLE_RULE_TYPE_CASTS(FontFace); |
| 232 DEFINE_STYLE_RULE_TYPE_CASTS(Media); | 216 DEFINE_STYLE_RULE_TYPE_CASTS(Media); |
| 233 DEFINE_STYLE_RULE_TYPE_CASTS(Supports); | 217 DEFINE_STYLE_RULE_TYPE_CASTS(Supports); |
| 234 DEFINE_STYLE_RULE_TYPE_CASTS(Filter); | 218 DEFINE_STYLE_RULE_TYPE_CASTS(Filter); |
| 235 | 219 |
| 236 } // namespace blink | 220 } // namespace blink |
| 237 | 221 |
| 238 #endif // StyleRule_h | 222 #endif // StyleRule_h |
| OLD | NEW |