OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 Google Inc. All rights reserved. | 2 * Copyright (c) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef CSSPropertySourceData_h | 31 #ifndef CSSPropertySourceData_h |
32 #define CSSPropertySourceData_h | 32 #define CSSPropertySourceData_h |
33 | 33 |
| 34 #include "core/css/StyleRule.h" |
34 #include "platform/heap/Handle.h" | 35 #include "platform/heap/Handle.h" |
35 #include "wtf/Forward.h" | 36 #include "wtf/Forward.h" |
36 #include "wtf/RefCounted.h" | 37 #include "wtf/RefCounted.h" |
37 #include "wtf/Vector.h" | 38 #include "wtf/Vector.h" |
38 #include "wtf/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
39 | 40 |
40 namespace blink { | 41 namespace blink { |
41 | 42 |
42 struct SourceRange { | 43 struct SourceRange { |
43 ALLOW_ONLY_INLINE_ALLOCATION(); | 44 ALLOW_ONLY_INLINE_ALLOCATION(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 DEFINE_INLINE_TRACE() { visitor->trace(queryData); } | 111 DEFINE_INLINE_TRACE() { visitor->trace(queryData); } |
111 | 112 |
112 WillBeHeapVector<RefPtrWillBeMember<CSSMediaQuerySourceData> > queryData; | 113 WillBeHeapVector<RefPtrWillBeMember<CSSMediaQuerySourceData> > queryData; |
113 }; | 114 }; |
114 | 115 |
115 struct CSSRuleSourceData; | 116 struct CSSRuleSourceData; |
116 typedef WillBeHeapVector<RefPtrWillBeMember<CSSRuleSourceData> > RuleSourceDataL
ist; | 117 typedef WillBeHeapVector<RefPtrWillBeMember<CSSRuleSourceData> > RuleSourceDataL
ist; |
117 typedef WillBeHeapVector<SourceRange> SelectorRangeList; | 118 typedef WillBeHeapVector<SourceRange> SelectorRangeList; |
118 | 119 |
119 struct CSSRuleSourceData : public RefCountedWillBeGarbageCollected<CSSRuleSource
Data> { | 120 struct CSSRuleSourceData : public RefCountedWillBeGarbageCollected<CSSRuleSource
Data> { |
120 enum Type { | 121 static PassRefPtrWillBeRawPtr<CSSRuleSourceData> create(StyleRule::Type type
) |
121 UNKNOWN_RULE, | |
122 STYLE_RULE, | |
123 CHARSET_RULE, | |
124 IMPORT_RULE, | |
125 MEDIA_RULE, | |
126 FONT_FACE_RULE, | |
127 PAGE_RULE, | |
128 KEYFRAMES_RULE, | |
129 VIEWPORT_RULE, | |
130 SUPPORTS_RULE, | |
131 }; | |
132 | |
133 static PassRefPtrWillBeRawPtr<CSSRuleSourceData> create(Type type) | |
134 { | 122 { |
135 return adoptRefWillBeNoop(new CSSRuleSourceData(type)); | 123 return adoptRefWillBeNoop(new CSSRuleSourceData(type)); |
136 } | 124 } |
137 | 125 |
138 static PassRefPtrWillBeRawPtr<CSSRuleSourceData> createUnknown() | 126 CSSRuleSourceData(StyleRule::Type type) |
139 { | |
140 return adoptRefWillBeNoop(new CSSRuleSourceData(UNKNOWN_RULE)); | |
141 } | |
142 | |
143 CSSRuleSourceData(Type type) | |
144 : type(type) | 127 : type(type) |
145 { | 128 { |
146 if (type == STYLE_RULE || type == FONT_FACE_RULE || type == PAGE_RULE) | 129 if (type == StyleRule::Style || type == StyleRule::FontFace || type == S
tyleRule::Page) |
147 styleSourceData = CSSStyleSourceData::create(); | 130 styleSourceData = CSSStyleSourceData::create(); |
148 if (type == MEDIA_RULE || type == IMPORT_RULE) | 131 if (type == StyleRule::Media || type == StyleRule::Import) |
149 mediaSourceData = CSSMediaSourceData::create(); | 132 mediaSourceData = CSSMediaSourceData::create(); |
150 } | 133 } |
151 | 134 |
152 DECLARE_TRACE(); | 135 DECLARE_TRACE(); |
153 | 136 |
154 Type type; | 137 StyleRule::Type type; |
155 | 138 |
156 // Range of the selector list in the enclosing source. | 139 // Range of the selector list in the enclosing source. |
157 SourceRange ruleHeaderRange; | 140 SourceRange ruleHeaderRange; |
158 | 141 |
159 // Range of the rule body (e.g. style text for style rules) in the enclosing
source. | 142 // Range of the rule body (e.g. style text for style rules) in the enclosing
source. |
160 SourceRange ruleBodyRange; | 143 SourceRange ruleBodyRange; |
161 | 144 |
162 // Only for CSSStyleRules. | 145 // Only for CSSStyleRules. |
163 SelectorRangeList selectorRanges; | 146 SelectorRangeList selectorRanges; |
164 | 147 |
165 // Only for CSSStyleRules, CSSFontFaceRules, and CSSPageRules. | 148 // Only for CSSStyleRules, CSSFontFaceRules, and CSSPageRules. |
166 RefPtrWillBeMember<CSSStyleSourceData> styleSourceData; | 149 RefPtrWillBeMember<CSSStyleSourceData> styleSourceData; |
167 | 150 |
168 // Only for CSSMediaRules. | 151 // Only for CSSMediaRules. |
169 RuleSourceDataList childRules; | 152 RuleSourceDataList childRules; |
170 | 153 |
171 // Only for CSSMediaRules and CSSImportRules. | 154 // Only for CSSMediaRules and CSSImportRules. |
172 RefPtrWillBeMember<CSSMediaSourceData> mediaSourceData; | 155 RefPtrWillBeMember<CSSMediaSourceData> mediaSourceData; |
173 }; | 156 }; |
174 | 157 |
175 } // namespace blink | 158 } // namespace blink |
176 | 159 |
177 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::SourceRange); | 160 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::SourceRange); |
178 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::CSSPropertySourceData); | 161 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::CSSPropertySourceData); |
179 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::CSSMediaQueryExpSourceData); | 162 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::CSSMediaQueryExpSourceData); |
180 | 163 |
181 #endif // CSSPropertySourceData_h | 164 #endif // CSSPropertySourceData_h |
OLD | NEW |