Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: sky/engine/core/css/StyleRule.h

Issue 807703003: Remove @media rules. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/core/css/RuleSet.cpp ('k') | sky/engine/core/css/StyleRule.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 *
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 #ifndef SKY_ENGINE_CORE_CSS_STYLERULE_H_ 22 #ifndef SKY_ENGINE_CORE_CSS_STYLERULE_H_
23 #define SKY_ENGINE_CORE_CSS_STYLERULE_H_ 23 #define SKY_ENGINE_CORE_CSS_STYLERULE_H_
24 24
25 #include "sky/engine/core/css/CSSSelectorList.h" 25 #include "sky/engine/core/css/CSSSelectorList.h"
26 #include "sky/engine/core/css/MediaList.h"
27 #include "sky/engine/wtf/Noncopyable.h" 26 #include "sky/engine/wtf/Noncopyable.h"
28 #include "sky/engine/wtf/RefPtr.h" 27 #include "sky/engine/wtf/RefPtr.h"
29 28
30 namespace blink { 29 namespace blink {
31 30
32 class StylePropertySet; 31 class StylePropertySet;
33 32
34 class StyleRuleBase : public RefCounted<StyleRuleBase> { 33 class StyleRuleBase : public RefCounted<StyleRuleBase> {
35 WTF_MAKE_FAST_ALLOCATED; 34 WTF_MAKE_FAST_ALLOCATED;
36 public: 35 public:
37 enum Type { 36 enum Type {
38 Unknown, // Not used. 37 Unknown, // Not used.
39 Style, 38 Style,
40 Media,
41 FontFace = 4, 39 FontFace = 4,
42 Keyframes = 5, 40 Keyframes = 5,
43 Keyframe, // Not used. These are internally non-rule StyleKeyframe objec ts.
44 Supports = 12, 41 Supports = 12,
45 }; 42 };
46 43
47 Type type() const { return static_cast<Type>(m_type); } 44 Type type() const { return static_cast<Type>(m_type); }
48 45
49 bool isFontFaceRule() const { return type() == FontFace; } 46 bool isFontFaceRule() const { return type() == FontFace; }
50 bool isKeyframesRule() const { return type() == Keyframes; } 47 bool isKeyframesRule() const { return type() == Keyframes; }
51 bool isMediaRule() const { return type() == Media; }
52 bool isStyleRule() const { return type() == Style; } 48 bool isStyleRule() const { return type() == Style; }
53 bool isSupportsRule() const { return type() == Supports; } 49 bool isSupportsRule() const { return type() == Supports; }
54 50
55 void deref() 51 void deref()
56 { 52 {
57 if (derefBase()) 53 if (derefBase())
58 destroy(); 54 destroy();
59 } 55 }
60 56
61 protected: 57 protected:
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 public: 110 public:
115 const Vector<RefPtr<StyleRuleBase> >& childRules() const { return m_childRul es; } 111 const Vector<RefPtr<StyleRuleBase> >& childRules() const { return m_childRul es; }
116 112
117 protected: 113 protected:
118 StyleRuleGroup(Type, Vector<RefPtr<StyleRuleBase> >& adoptRule); 114 StyleRuleGroup(Type, Vector<RefPtr<StyleRuleBase> >& adoptRule);
119 115
120 private: 116 private:
121 Vector<RefPtr<StyleRuleBase> > m_childRules; 117 Vector<RefPtr<StyleRuleBase> > m_childRules;
122 }; 118 };
123 119
124 class StyleRuleMedia final : public StyleRuleGroup {
125 WTF_MAKE_NONCOPYABLE(StyleRuleMedia);
126 public:
127 static PassRefPtr<StyleRuleMedia> create(PassRefPtr<MediaQuerySet> media, Ve ctor<RefPtr<StyleRuleBase> >& adoptRules)
128 {
129 return adoptRef(new StyleRuleMedia(media, adoptRules));
130 }
131
132 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); }
133
134 private:
135 StyleRuleMedia(PassRefPtr<MediaQuerySet>, Vector<RefPtr<StyleRuleBase> >& ad optRules);
136
137 RefPtr<MediaQuerySet> m_mediaQueries;
138 };
139
140 class StyleRuleSupports final : public StyleRuleGroup { 120 class StyleRuleSupports final : public StyleRuleGroup {
141 WTF_MAKE_NONCOPYABLE(StyleRuleSupports); 121 WTF_MAKE_NONCOPYABLE(StyleRuleSupports);
142 public: 122 public:
143 static PassRefPtr<StyleRuleSupports> create(const String& conditionText, boo l conditionIsSupported, Vector<RefPtr<StyleRuleBase> >& adoptRules) 123 static PassRefPtr<StyleRuleSupports> create(const String& conditionText, boo l conditionIsSupported, Vector<RefPtr<StyleRuleBase> >& adoptRules)
144 { 124 {
145 return adoptRef(new StyleRuleSupports(conditionText, conditionIsSupporte d, adoptRules)); 125 return adoptRef(new StyleRuleSupports(conditionText, conditionIsSupporte d, adoptRules));
146 } 126 }
147 127
148 String conditionText() const { return m_conditionText; } 128 String conditionText() const { return m_conditionText; }
149 bool conditionIsSupported() const { return m_conditionIsSupported; } 129 bool conditionIsSupported() const { return m_conditionIsSupported; }
150 130
151 private: 131 private:
152 StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Ve ctor<RefPtr<StyleRuleBase> >& adoptRules); 132 StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Ve ctor<RefPtr<StyleRuleBase> >& adoptRules);
153 133
154 String m_conditionText; 134 String m_conditionText;
155 bool m_conditionIsSupported; 135 bool m_conditionIsSupported;
156 }; 136 };
157 137
158 #define DEFINE_STYLE_RULE_TYPE_CASTS(Type) \ 138 #define DEFINE_STYLE_RULE_TYPE_CASTS(Type) \
159 DEFINE_TYPE_CASTS(StyleRule##Type, StyleRuleBase, rule, rule->is##Type##Rule (), rule.is##Type##Rule()) 139 DEFINE_TYPE_CASTS(StyleRule##Type, StyleRuleBase, rule, rule->is##Type##Rule (), rule.is##Type##Rule())
160 140
161 DEFINE_TYPE_CASTS(StyleRule, StyleRuleBase, rule, rule->isStyleRule(), rule.isSt yleRule()); 141 DEFINE_TYPE_CASTS(StyleRule, StyleRuleBase, rule, rule->isStyleRule(), rule.isSt yleRule());
162 DEFINE_STYLE_RULE_TYPE_CASTS(FontFace); 142 DEFINE_STYLE_RULE_TYPE_CASTS(FontFace);
163 DEFINE_STYLE_RULE_TYPE_CASTS(Media);
164 DEFINE_STYLE_RULE_TYPE_CASTS(Supports); 143 DEFINE_STYLE_RULE_TYPE_CASTS(Supports);
165 144
166 } // namespace blink 145 } // namespace blink
167 146
168 #endif // SKY_ENGINE_CORE_CSS_STYLERULE_H_ 147 #endif // SKY_ENGINE_CORE_CSS_STYLERULE_H_
OLDNEW
« no previous file with comments | « sky/engine/core/css/RuleSet.cpp ('k') | sky/engine/core/css/StyleRule.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698