| 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 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 #include "core/CoreExport.h" | 25 #include "core/CoreExport.h" |
| 26 #include "core/css/CSSSelectorList.h" | 26 #include "core/css/CSSSelectorList.h" |
| 27 #include "core/css/MediaList.h" | 27 #include "core/css/MediaList.h" |
| 28 #include "core/css/StylePropertySet.h" | 28 #include "core/css/StylePropertySet.h" |
| 29 #include "platform/heap/Handle.h" | 29 #include "platform/heap/Handle.h" |
| 30 #include "wtf/RefPtr.h" | 30 #include "wtf/RefPtr.h" |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 class CSSDeserializeStream; |
| 34 class CSSRule; | 35 class CSSRule; |
| 35 class CSSStyleSheet; | 36 class CSSStyleSheet; |
| 37 class CSSSerializeStream; |
| 36 | 38 |
| 37 class CORE_EXPORT StyleRuleBase : public RefCountedWillBeGarbageCollectedFinaliz
ed<StyleRuleBase> { | 39 class CORE_EXPORT StyleRuleBase : public RefCountedWillBeGarbageCollectedFinaliz
ed<StyleRuleBase> { |
| 38 USING_FAST_MALLOC_WITH_TYPE_NAME_WILL_BE_REMOVED(blink::StyleRuleBase); | 40 USING_FAST_MALLOC_WITH_TYPE_NAME_WILL_BE_REMOVED(blink::StyleRuleBase); |
| 39 public: | 41 public: |
| 40 enum Type { | 42 enum Type { |
| 41 Charset, | 43 Charset, |
| 42 Style, | 44 Style, |
| 43 Import, | 45 Import, |
| 44 Media, | 46 Media, |
| 45 FontFace, | 47 FontFace, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 58 bool isKeyframesRule() const { return type() == Keyframes; } | 60 bool isKeyframesRule() const { return type() == Keyframes; } |
| 59 bool isKeyframeRule() const { return type() == Keyframe; } | 61 bool isKeyframeRule() const { return type() == Keyframe; } |
| 60 bool isNamespaceRule() const { return type() == Namespace; } | 62 bool isNamespaceRule() const { return type() == Namespace; } |
| 61 bool isMediaRule() const { return type() == Media; } | 63 bool isMediaRule() const { return type() == Media; } |
| 62 bool isPageRule() const { return type() == Page; } | 64 bool isPageRule() const { return type() == Page; } |
| 63 bool isStyleRule() const { return type() == Style; } | 65 bool isStyleRule() const { return type() == Style; } |
| 64 bool isSupportsRule() const { return type() == Supports; } | 66 bool isSupportsRule() const { return type() == Supports; } |
| 65 bool isViewportRule() const { return type() == Viewport; } | 67 bool isViewportRule() const { return type() == Viewport; } |
| 66 bool isImportRule() const { return type() == Import; } | 68 bool isImportRule() const { return type() == Import; } |
| 67 | 69 |
| 70 static PassRefPtrWillBeRawPtr<StyleRuleBase> deserialize(CSSDeserializeStrea
m*); |
| 68 PassRefPtrWillBeRawPtr<StyleRuleBase> copy() const; | 71 PassRefPtrWillBeRawPtr<StyleRuleBase> copy() const; |
| 69 | 72 |
| 70 #if !ENABLE(OILPAN) | 73 #if !ENABLE(OILPAN) |
| 71 void deref() | 74 void deref() |
| 72 { | 75 { |
| 73 if (derefBase()) | 76 if (derefBase()) |
| 74 destroy(); | 77 destroy(); |
| 75 } | 78 } |
| 76 #endif // !ENABLE(OILPAN) | 79 #endif // !ENABLE(OILPAN) |
| 77 | 80 |
| 78 // FIXME: There shouldn't be any need for the null parent version. | 81 // FIXME: There shouldn't be any need for the null parent version. |
| 79 PassRefPtrWillBeRawPtr<CSSRule> createCSSOMWrapper(CSSStyleSheet* parentShee
t = 0) const; | 82 PassRefPtrWillBeRawPtr<CSSRule> createCSSOMWrapper(CSSStyleSheet* parentShee
t = 0) const; |
| 80 PassRefPtrWillBeRawPtr<CSSRule> createCSSOMWrapper(CSSRule* parentRule) cons
t; | 83 PassRefPtrWillBeRawPtr<CSSRule> createCSSOMWrapper(CSSRule* parentRule) cons
t; |
| 81 | 84 |
| 85 void serialize(CSSSerializeStream*) const; |
| 86 |
| 82 DECLARE_TRACE(); | 87 DECLARE_TRACE(); |
| 83 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { } | 88 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { } |
| 84 void finalizeGarbageCollectedObject(); | 89 void finalizeGarbageCollectedObject(); |
| 85 | 90 |
| 86 // ~StyleRuleBase should be public, because non-public ~StyleRuleBase | 91 // ~StyleRuleBase should be public, because non-public ~StyleRuleBase |
| 87 // causes C2248 error : 'blink::StyleRuleBase::~StyleRuleBase' : cannot | 92 // causes C2248 error : 'blink::StyleRuleBase::~StyleRuleBase' : cannot |
| 88 // access protected member declared in class 'blink::StyleRuleBase' when | 93 // access protected member declared in class 'blink::StyleRuleBase' when |
| 89 // compiling 'source\wtf\refcounted.h' by using msvc. | 94 // compiling 'source\wtf\refcounted.h' by using msvc. |
| 90 ~StyleRuleBase() { } | 95 ~StyleRuleBase() { } |
| 91 | 96 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 115 const CSSSelectorList& selectorList() const { return m_selectorList; } | 120 const CSSSelectorList& selectorList() const { return m_selectorList; } |
| 116 const StylePropertySet& properties() const { return *m_properties; } | 121 const StylePropertySet& properties() const { return *m_properties; } |
| 117 MutableStylePropertySet& mutableProperties(); | 122 MutableStylePropertySet& mutableProperties(); |
| 118 | 123 |
| 119 void wrapperAdoptSelectorList(CSSSelectorList selectors) { m_selectorList =
std::move(selectors); } | 124 void wrapperAdoptSelectorList(CSSSelectorList selectors) { m_selectorList =
std::move(selectors); } |
| 120 | 125 |
| 121 PassRefPtrWillBeRawPtr<StyleRule> copy() const { return adoptRefWillBeNoop(n
ew StyleRule(*this)); } | 126 PassRefPtrWillBeRawPtr<StyleRule> copy() const { return adoptRefWillBeNoop(n
ew StyleRule(*this)); } |
| 122 | 127 |
| 123 static unsigned averageSizeInBytes(); | 128 static unsigned averageSizeInBytes(); |
| 124 | 129 |
| 130 static PassRefPtrWillBeRawPtr<StyleRule> deserializeAfterDispatch(CSSDeseria
lizeStream*); |
| 131 void serializeAfterDispatch(CSSSerializeStream*) const; |
| 132 |
| 125 DECLARE_TRACE_AFTER_DISPATCH(); | 133 DECLARE_TRACE_AFTER_DISPATCH(); |
| 126 | 134 |
| 127 private: | 135 private: |
| 128 StyleRule(CSSSelectorList, PassRefPtrWillBeRawPtr<StylePropertySet>); | 136 StyleRule(CSSSelectorList, PassRefPtrWillBeRawPtr<StylePropertySet>); |
| 129 StyleRule(const StyleRule&); | 137 StyleRule(const StyleRule&); |
| 130 | 138 |
| 131 RefPtrWillBeMember<StylePropertySet> m_properties; // Cannot be null. | 139 RefPtrWillBeMember<StylePropertySet> m_properties; // Cannot be null. |
| 132 CSSSelectorList m_selectorList; | 140 CSSSelectorList m_selectorList; |
| 133 }; | 141 }; |
| 134 | 142 |
| 135 class StyleRuleFontFace : public StyleRuleBase { | 143 class StyleRuleFontFace : public StyleRuleBase { |
| 136 public: | 144 public: |
| 137 static PassRefPtrWillBeRawPtr<StyleRuleFontFace> create(PassRefPtrWillBeRawP
tr<StylePropertySet> properties) | 145 static PassRefPtrWillBeRawPtr<StyleRuleFontFace> create(PassRefPtrWillBeRawP
tr<StylePropertySet> properties) |
| 138 { | 146 { |
| 139 return adoptRefWillBeNoop(new StyleRuleFontFace(properties)); | 147 return adoptRefWillBeNoop(new StyleRuleFontFace(properties)); |
| 140 } | 148 } |
| 149 static PassRefPtrWillBeRawPtr<StyleRuleFontFace> deserializeAfterDispatch(CS
SDeserializeStream*); |
| 141 | 150 |
| 142 ~StyleRuleFontFace(); | 151 ~StyleRuleFontFace(); |
| 143 | 152 |
| 144 const StylePropertySet& properties() const { return *m_properties; } | 153 const StylePropertySet& properties() const { return *m_properties; } |
| 145 MutableStylePropertySet& mutableProperties(); | 154 MutableStylePropertySet& mutableProperties(); |
| 146 | 155 |
| 147 PassRefPtrWillBeRawPtr<StyleRuleFontFace> copy() const { return adoptRefWill
BeNoop(new StyleRuleFontFace(*this)); } | 156 PassRefPtrWillBeRawPtr<StyleRuleFontFace> copy() const { return adoptRefWill
BeNoop(new StyleRuleFontFace(*this)); } |
| 148 | 157 |
| 158 void serializeAfterDispatch(CSSSerializeStream*) const; |
| 159 |
| 149 DECLARE_TRACE_AFTER_DISPATCH(); | 160 DECLARE_TRACE_AFTER_DISPATCH(); |
| 150 | 161 |
| 151 private: | 162 private: |
| 152 StyleRuleFontFace(PassRefPtrWillBeRawPtr<StylePropertySet>); | 163 StyleRuleFontFace(PassRefPtrWillBeRawPtr<StylePropertySet>); |
| 153 StyleRuleFontFace(const StyleRuleFontFace&); | 164 StyleRuleFontFace(const StyleRuleFontFace&); |
| 154 | 165 |
| 155 RefPtrWillBeMember<StylePropertySet> m_properties; // Cannot be null. | 166 RefPtrWillBeMember<StylePropertySet> m_properties; // Cannot be null. |
| 156 }; | 167 }; |
| 157 | 168 |
| 158 class StyleRulePage : public StyleRuleBase { | 169 class StyleRulePage : public StyleRuleBase { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 183 CSSSelectorList m_selectorList; | 194 CSSSelectorList m_selectorList; |
| 184 }; | 195 }; |
| 185 | 196 |
| 186 class StyleRuleGroup : public StyleRuleBase { | 197 class StyleRuleGroup : public StyleRuleBase { |
| 187 public: | 198 public: |
| 188 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>>& childRules() cons
t { return m_childRules; } | 199 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>>& childRules() cons
t { return m_childRules; } |
| 189 | 200 |
| 190 void wrapperInsertRule(unsigned, PassRefPtrWillBeRawPtr<StyleRuleBase>); | 201 void wrapperInsertRule(unsigned, PassRefPtrWillBeRawPtr<StyleRuleBase>); |
| 191 void wrapperRemoveRule(unsigned); | 202 void wrapperRemoveRule(unsigned); |
| 192 | 203 |
| 204 void serializeAfterDispatch(CSSSerializeStream*) const; |
| 205 void deserializeAfterDispatch(CSSDeserializeStream*); |
| 206 |
| 193 DECLARE_TRACE_AFTER_DISPATCH(); | 207 DECLARE_TRACE_AFTER_DISPATCH(); |
| 194 | 208 |
| 195 protected: | 209 protected: |
| 210 StyleRuleGroup(Type type) |
| 211 : StyleRuleBase(type) |
| 212 { |
| 213 } |
| 196 StyleRuleGroup(Type, WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>>& ad
optRule); | 214 StyleRuleGroup(Type, WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>>& ad
optRule); |
| 197 StyleRuleGroup(const StyleRuleGroup&); | 215 StyleRuleGroup(const StyleRuleGroup&); |
| 198 | 216 |
| 199 private: | 217 private: |
| 200 WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>> m_childRules; | 218 WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>> m_childRules; |
| 201 }; | 219 }; |
| 202 | 220 |
| 203 class StyleRuleMedia : public StyleRuleGroup { | 221 class StyleRuleMedia final : public StyleRuleGroup { |
| 204 public: | 222 public: |
| 205 static PassRefPtrWillBeRawPtr<StyleRuleMedia> create(PassRefPtrWillBeRawPtr<
MediaQuerySet> media, WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>>& adopt
Rules) | 223 static PassRefPtrWillBeRawPtr<StyleRuleMedia> create(PassRefPtrWillBeRawPtr<
MediaQuerySet> media, WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>>& adopt
Rules) |
| 206 { | 224 { |
| 207 return adoptRefWillBeNoop(new StyleRuleMedia(media, adoptRules)); | 225 return adoptRefWillBeNoop(new StyleRuleMedia(media, adoptRules)); |
| 208 } | 226 } |
| 227 static PassRefPtrWillBeRawPtr<StyleRuleMedia> deserializeAfterDispatch(CSSDe
serializeStream*); |
| 209 | 228 |
| 210 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); } | 229 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); } |
| 211 | 230 |
| 212 PassRefPtrWillBeRawPtr<StyleRuleMedia> copy() const { return adoptRefWillBeN
oop(new StyleRuleMedia(*this)); } | 231 PassRefPtrWillBeRawPtr<StyleRuleMedia> copy() const { return adoptRefWillBeN
oop(new StyleRuleMedia(*this)); } |
| 213 | 232 |
| 233 void serializeAfterDispatch(CSSSerializeStream*) const; |
| 234 |
| 214 DECLARE_TRACE_AFTER_DISPATCH(); | 235 DECLARE_TRACE_AFTER_DISPATCH(); |
| 215 | 236 |
| 216 private: | 237 private: |
| 217 StyleRuleMedia(PassRefPtrWillBeRawPtr<MediaQuerySet>, WillBeHeapVector<RefPt
rWillBeMember<StyleRuleBase>>& adoptRules); | 238 StyleRuleMedia(PassRefPtrWillBeRawPtr<MediaQuerySet>, WillBeHeapVector<RefPt
rWillBeMember<StyleRuleBase>>& adoptRules); |
| 218 StyleRuleMedia(const StyleRuleMedia&); | 239 StyleRuleMedia(const StyleRuleMedia&); |
| 240 StyleRuleMedia() |
| 241 : StyleRuleGroup(Media) |
| 242 { |
| 243 } |
| 219 | 244 |
| 220 RefPtrWillBeMember<MediaQuerySet> m_mediaQueries; | 245 RefPtrWillBeMember<MediaQuerySet> m_mediaQueries; |
| 221 }; | 246 }; |
| 222 | 247 |
| 223 class StyleRuleSupports : public StyleRuleGroup { | 248 class StyleRuleSupports : public StyleRuleGroup { |
| 224 public: | 249 public: |
| 225 static PassRefPtrWillBeRawPtr<StyleRuleSupports> create(const String& condit
ionText, bool conditionIsSupported, WillBeHeapVector<RefPtrWillBeMember<StyleRul
eBase>>& adoptRules) | 250 static PassRefPtrWillBeRawPtr<StyleRuleSupports> create(const String& condit
ionText, bool conditionIsSupported, WillBeHeapVector<RefPtrWillBeMember<StyleRul
eBase>>& adoptRules) |
| 226 { | 251 { |
| 227 return adoptRefWillBeNoop(new StyleRuleSupports(conditionText, condition
IsSupported, adoptRules)); | 252 return adoptRefWillBeNoop(new StyleRuleSupports(conditionText, condition
IsSupported, adoptRules)); |
| 228 } | 253 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 DEFINE_STYLE_RULE_TYPE_CASTS(FontFace); | 308 DEFINE_STYLE_RULE_TYPE_CASTS(FontFace); |
| 284 DEFINE_STYLE_RULE_TYPE_CASTS(Page); | 309 DEFINE_STYLE_RULE_TYPE_CASTS(Page); |
| 285 DEFINE_STYLE_RULE_TYPE_CASTS(Media); | 310 DEFINE_STYLE_RULE_TYPE_CASTS(Media); |
| 286 DEFINE_STYLE_RULE_TYPE_CASTS(Supports); | 311 DEFINE_STYLE_RULE_TYPE_CASTS(Supports); |
| 287 DEFINE_STYLE_RULE_TYPE_CASTS(Viewport); | 312 DEFINE_STYLE_RULE_TYPE_CASTS(Viewport); |
| 288 DEFINE_STYLE_RULE_TYPE_CASTS(Charset); | 313 DEFINE_STYLE_RULE_TYPE_CASTS(Charset); |
| 289 | 314 |
| 290 } // namespace blink | 315 } // namespace blink |
| 291 | 316 |
| 292 #endif // StyleRule_h | 317 #endif // StyleRule_h |
| OLD | NEW |