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, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved. | 4 * Copyright (C) 2002, 2005, 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 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 */ | 20 */ |
21 | 21 |
22 #include "config.h" | 22 #include "config.h" |
23 #include "core/css/StyleRule.h" | 23 #include "core/css/StyleRule.h" |
24 | 24 |
25 #include "RuntimeEnabledFeatures.h" | |
26 #include "core/css/CSSFilterRule.h" | 25 #include "core/css/CSSFilterRule.h" |
27 #include "core/css/CSSFontFaceRule.h" | 26 #include "core/css/CSSFontFaceRule.h" |
28 #include "core/css/CSSImportRule.h" | 27 #include "core/css/CSSImportRule.h" |
29 #include "core/css/CSSKeyframesRule.h" | 28 #include "core/css/CSSKeyframesRule.h" |
30 #include "core/css/CSSMediaRule.h" | 29 #include "core/css/CSSMediaRule.h" |
31 #include "core/css/CSSPageRule.h" | 30 #include "core/css/CSSPageRule.h" |
32 #include "core/css/CSSRegionRule.h" | |
33 #include "core/css/CSSStyleRule.h" | 31 #include "core/css/CSSStyleRule.h" |
34 #include "core/css/CSSSupportsRule.h" | 32 #include "core/css/CSSSupportsRule.h" |
35 #include "core/css/CSSViewportRule.h" | 33 #include "core/css/CSSViewportRule.h" |
36 #include "core/css/StylePropertySet.h" | 34 #include "core/css/StylePropertySet.h" |
37 #include "core/css/StyleRuleImport.h" | 35 #include "core/css/StyleRuleImport.h" |
38 | 36 |
39 namespace WebCore { | 37 namespace WebCore { |
40 | 38 |
41 struct SameSizeAsStyleRuleBase : public WTF::RefCountedBase { | 39 struct SameSizeAsStyleRuleBase : public WTF::RefCountedBase { |
42 unsigned bitfields; | 40 unsigned bitfields; |
(...skipping 22 matching lines...) Expand all Loading... |
65 return; | 63 return; |
66 case FontFace: | 64 case FontFace: |
67 delete toStyleRuleFontFace(this); | 65 delete toStyleRuleFontFace(this); |
68 return; | 66 return; |
69 case Media: | 67 case Media: |
70 delete toStyleRuleMedia(this); | 68 delete toStyleRuleMedia(this); |
71 return; | 69 return; |
72 case Supports: | 70 case Supports: |
73 delete toStyleRuleSupports(this); | 71 delete toStyleRuleSupports(this); |
74 return; | 72 return; |
75 case Region: | |
76 delete toStyleRuleRegion(this); | |
77 return; | |
78 case Import: | 73 case Import: |
79 delete toStyleRuleImport(this); | 74 delete toStyleRuleImport(this); |
80 return; | 75 return; |
81 case Keyframes: | 76 case Keyframes: |
82 delete toStyleRuleKeyframes(this); | 77 delete toStyleRuleKeyframes(this); |
83 return; | 78 return; |
84 case Viewport: | 79 case Viewport: |
85 delete toStyleRuleViewport(this); | 80 delete toStyleRuleViewport(this); |
86 return; | 81 return; |
87 case Filter: | 82 case Filter: |
(...skipping 14 matching lines...) Expand all Loading... |
102 case Style: | 97 case Style: |
103 return toStyleRule(this)->copy(); | 98 return toStyleRule(this)->copy(); |
104 case Page: | 99 case Page: |
105 return toStyleRulePage(this)->copy(); | 100 return toStyleRulePage(this)->copy(); |
106 case FontFace: | 101 case FontFace: |
107 return toStyleRuleFontFace(this)->copy(); | 102 return toStyleRuleFontFace(this)->copy(); |
108 case Media: | 103 case Media: |
109 return toStyleRuleMedia(this)->copy(); | 104 return toStyleRuleMedia(this)->copy(); |
110 case Supports: | 105 case Supports: |
111 return toStyleRuleSupports(this)->copy(); | 106 return toStyleRuleSupports(this)->copy(); |
112 case Region: | |
113 return toStyleRuleRegion(this)->copy(); | |
114 case Import: | 107 case Import: |
115 // FIXME: Copy import rules. | 108 // FIXME: Copy import rules. |
116 ASSERT_NOT_REACHED(); | 109 ASSERT_NOT_REACHED(); |
117 return 0; | 110 return 0; |
118 case Keyframes: | 111 case Keyframes: |
119 return toStyleRuleKeyframes(this)->copy(); | 112 return toStyleRuleKeyframes(this)->copy(); |
120 case Viewport: | 113 case Viewport: |
121 return toStyleRuleViewport(this)->copy(); | 114 return toStyleRuleViewport(this)->copy(); |
122 case Filter: | 115 case Filter: |
123 return toStyleRuleFilter(this)->copy(); | 116 return toStyleRuleFilter(this)->copy(); |
(...skipping 20 matching lines...) Expand all Loading... |
144 break; | 137 break; |
145 case FontFace: | 138 case FontFace: |
146 rule = CSSFontFaceRule::create(toStyleRuleFontFace(self), parentSheet); | 139 rule = CSSFontFaceRule::create(toStyleRuleFontFace(self), parentSheet); |
147 break; | 140 break; |
148 case Media: | 141 case Media: |
149 rule = CSSMediaRule::create(toStyleRuleMedia(self), parentSheet); | 142 rule = CSSMediaRule::create(toStyleRuleMedia(self), parentSheet); |
150 break; | 143 break; |
151 case Supports: | 144 case Supports: |
152 rule = CSSSupportsRule::create(toStyleRuleSupports(self), parentSheet); | 145 rule = CSSSupportsRule::create(toStyleRuleSupports(self), parentSheet); |
153 break; | 146 break; |
154 case Region: | |
155 rule = CSSRegionRule::create(toStyleRuleRegion(self), parentSheet); | |
156 break; | |
157 case Import: | 147 case Import: |
158 rule = CSSImportRule::create(toStyleRuleImport(self), parentSheet); | 148 rule = CSSImportRule::create(toStyleRuleImport(self), parentSheet); |
159 break; | 149 break; |
160 case Keyframes: | 150 case Keyframes: |
161 rule = CSSKeyframesRule::create(toStyleRuleKeyframes(self), parentSheet)
; | 151 rule = CSSKeyframesRule::create(toStyleRuleKeyframes(self), parentSheet)
; |
162 break; | 152 break; |
163 case Viewport: | 153 case Viewport: |
164 rule = CSSViewportRule::create(toStyleRuleViewport(self), parentSheet); | 154 rule = CSSViewportRule::create(toStyleRuleViewport(self), parentSheet); |
165 break; | 155 break; |
166 case Filter: | 156 case Filter: |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 { | 299 { |
310 } | 300 } |
311 | 301 |
312 StyleRuleSupports::StyleRuleSupports(const StyleRuleSupports& o) | 302 StyleRuleSupports::StyleRuleSupports(const StyleRuleSupports& o) |
313 : StyleRuleGroup(o) | 303 : StyleRuleGroup(o) |
314 , m_conditionText(o.m_conditionText) | 304 , m_conditionText(o.m_conditionText) |
315 , m_conditionIsSupported(o.m_conditionIsSupported) | 305 , m_conditionIsSupported(o.m_conditionIsSupported) |
316 { | 306 { |
317 } | 307 } |
318 | 308 |
319 StyleRuleRegion::StyleRuleRegion(Vector<OwnPtr<CSSParserSelector> >* selectors,
Vector<RefPtr<StyleRuleBase> >& adoptRules) | |
320 : StyleRuleGroup(Region, adoptRules) | |
321 { | |
322 ASSERT(RuntimeEnabledFeatures::cssRegionsEnabled()); | |
323 m_selectorList.adoptSelectorVector(*selectors); | |
324 } | |
325 | |
326 StyleRuleRegion::StyleRuleRegion(const StyleRuleRegion& o) | |
327 : StyleRuleGroup(o) | |
328 , m_selectorList(o.m_selectorList) | |
329 { | |
330 ASSERT(RuntimeEnabledFeatures::cssRegionsEnabled()); | |
331 } | |
332 | |
333 StyleRuleViewport::StyleRuleViewport() | 309 StyleRuleViewport::StyleRuleViewport() |
334 : StyleRuleBase(Viewport) | 310 : StyleRuleBase(Viewport) |
335 { | 311 { |
336 } | 312 } |
337 | 313 |
338 StyleRuleViewport::StyleRuleViewport(const StyleRuleViewport& o) | 314 StyleRuleViewport::StyleRuleViewport(const StyleRuleViewport& o) |
339 : StyleRuleBase(o) | 315 : StyleRuleBase(o) |
340 , m_properties(o.m_properties->mutableCopy()) | 316 , m_properties(o.m_properties->mutableCopy()) |
341 { | 317 { |
342 } | 318 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 m_properties = m_properties->mutableCopy(); | 356 m_properties = m_properties->mutableCopy(); |
381 return toMutableStylePropertySet(m_properties); | 357 return toMutableStylePropertySet(m_properties); |
382 } | 358 } |
383 | 359 |
384 void StyleRuleFilter::setProperties(PassRefPtr<StylePropertySet> properties) | 360 void StyleRuleFilter::setProperties(PassRefPtr<StylePropertySet> properties) |
385 { | 361 { |
386 m_properties = properties; | 362 m_properties = properties; |
387 } | 363 } |
388 | 364 |
389 } // namespace WebCore | 365 } // namespace WebCore |
OLD | NEW |