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

Side by Side Diff: Source/core/css/StyleRule.cpp

Issue 14178009: Remove CSS_REGIONS compile flag from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use RuntimeEnabledFeatures::cssRegionsEnabled all over the places. Guard WEBKIT_REGION_RULE at runt… Created 7 years, 7 months 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
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, 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 *
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 return; 67 return;
68 case Page: 68 case Page:
69 static_cast<const StyleRulePage*>(this)->reportDescendantMemoryUsage(mem oryObjectInfo); 69 static_cast<const StyleRulePage*>(this)->reportDescendantMemoryUsage(mem oryObjectInfo);
70 return; 70 return;
71 case FontFace: 71 case FontFace:
72 static_cast<const StyleRuleFontFace*>(this)->reportDescendantMemoryUsage (memoryObjectInfo); 72 static_cast<const StyleRuleFontFace*>(this)->reportDescendantMemoryUsage (memoryObjectInfo);
73 return; 73 return;
74 case Media: 74 case Media:
75 static_cast<const StyleRuleMedia*>(this)->reportDescendantMemoryUsage(me moryObjectInfo); 75 static_cast<const StyleRuleMedia*>(this)->reportDescendantMemoryUsage(me moryObjectInfo);
76 return; 76 return;
77 #if ENABLE(CSS_REGIONS)
78 case Region: 77 case Region:
79 static_cast<const StyleRuleRegion*>(this)->reportDescendantMemoryUsage(m emoryObjectInfo); 78 static_cast<const StyleRuleRegion*>(this)->reportDescendantMemoryUsage(m emoryObjectInfo);
80 return; 79 return;
81 #endif
82 case Import: 80 case Import:
83 static_cast<const StyleRuleImport*>(this)->reportDescendantMemoryUsage(m emoryObjectInfo); 81 static_cast<const StyleRuleImport*>(this)->reportDescendantMemoryUsage(m emoryObjectInfo);
84 return; 82 return;
85 case Keyframes: 83 case Keyframes:
86 static_cast<const StyleRuleKeyframes*>(this)->reportDescendantMemoryUsag e(memoryObjectInfo); 84 static_cast<const StyleRuleKeyframes*>(this)->reportDescendantMemoryUsag e(memoryObjectInfo);
87 return; 85 return;
88 case Supports: 86 case Supports:
89 case HostInternal: 87 case HostInternal:
90 static_cast<const StyleRuleHost*>(this)->reportDescendantMemoryUsage(mem oryObjectInfo); 88 static_cast<const StyleRuleHost*>(this)->reportDescendantMemoryUsage(mem oryObjectInfo);
91 return; 89 return;
92 #if ENABLE(CSS_DEVICE_ADAPTATION) 90 #if ENABLE(CSS_DEVICE_ADAPTATION)
93 case Viewport: 91 case Viewport:
94 static_cast<const StyleRuleViewport*>(this)->reportDescendantMemoryUsage (memoryObjectInfo); 92 static_cast<const StyleRuleViewport*>(this)->reportDescendantMemoryUsage (memoryObjectInfo);
95 return; 93 return;
96 #endif 94 #endif
97 case Filter: 95 case Filter:
98 static_cast<const StyleRuleFilter*>(this)->reportDescendantMemoryUsage(m emoryObjectInfo); 96 static_cast<const StyleRuleFilter*>(this)->reportDescendantMemoryUsage(m emoryObjectInfo);
99 return; 97 return;
100 case Unknown: 98 case Unknown:
101 case Charset: 99 case Charset:
102 case Keyframe: 100 case Keyframe:
103 #if !ENABLE(CSS_REGIONS)
104 case Region:
105 #endif
106 ASSERT_NOT_REACHED(); 101 ASSERT_NOT_REACHED();
107 return; 102 return;
108 } 103 }
109 ASSERT_NOT_REACHED(); 104 ASSERT_NOT_REACHED();
110 } 105 }
111 106
112 void StyleRuleBase::destroy() 107 void StyleRuleBase::destroy()
113 { 108 {
114 switch (type()) { 109 switch (type()) {
115 case Style: 110 case Style:
116 delete static_cast<StyleRule*>(this); 111 delete static_cast<StyleRule*>(this);
117 return; 112 return;
118 case Page: 113 case Page:
119 delete static_cast<StyleRulePage*>(this); 114 delete static_cast<StyleRulePage*>(this);
120 return; 115 return;
121 case FontFace: 116 case FontFace:
122 delete static_cast<StyleRuleFontFace*>(this); 117 delete static_cast<StyleRuleFontFace*>(this);
123 return; 118 return;
124 case Media: 119 case Media:
125 delete static_cast<StyleRuleMedia*>(this); 120 delete static_cast<StyleRuleMedia*>(this);
126 return; 121 return;
127 case Supports: 122 case Supports:
128 delete static_cast<StyleRuleSupports*>(this); 123 delete static_cast<StyleRuleSupports*>(this);
129 return; 124 return;
130 #if ENABLE(CSS_REGIONS)
131 case Region: 125 case Region:
132 delete static_cast<StyleRuleRegion*>(this); 126 delete static_cast<StyleRuleRegion*>(this);
133 return; 127 return;
134 #endif
135 case Import: 128 case Import:
136 delete static_cast<StyleRuleImport*>(this); 129 delete static_cast<StyleRuleImport*>(this);
137 return; 130 return;
138 case Keyframes: 131 case Keyframes:
139 delete static_cast<StyleRuleKeyframes*>(this); 132 delete static_cast<StyleRuleKeyframes*>(this);
140 return; 133 return;
141 case HostInternal: 134 case HostInternal:
142 delete static_cast<StyleRuleHost*>(this); 135 delete static_cast<StyleRuleHost*>(this);
143 return; 136 return;
144 #if ENABLE(CSS_DEVICE_ADAPTATION) 137 #if ENABLE(CSS_DEVICE_ADAPTATION)
145 case Viewport: 138 case Viewport:
146 delete static_cast<StyleRuleViewport*>(this); 139 delete static_cast<StyleRuleViewport*>(this);
147 return; 140 return;
148 #endif 141 #endif
149 case Filter: 142 case Filter:
150 delete static_cast<StyleRuleFilter*>(this); 143 delete static_cast<StyleRuleFilter*>(this);
151 return; 144 return;
152 case Unknown: 145 case Unknown:
153 case Charset: 146 case Charset:
154 case Keyframe: 147 case Keyframe:
155 #if !ENABLE(CSS_REGIONS)
156 case Region:
157 #endif
158 ASSERT_NOT_REACHED(); 148 ASSERT_NOT_REACHED();
159 return; 149 return;
160 } 150 }
161 ASSERT_NOT_REACHED(); 151 ASSERT_NOT_REACHED();
162 } 152 }
163 153
164 PassRefPtr<StyleRuleBase> StyleRuleBase::copy() const 154 PassRefPtr<StyleRuleBase> StyleRuleBase::copy() const
165 { 155 {
166 switch (type()) { 156 switch (type()) {
167 case Style: 157 case Style:
168 return static_cast<const StyleRule*>(this)->copy(); 158 return static_cast<const StyleRule*>(this)->copy();
169 case Page: 159 case Page:
170 return static_cast<const StyleRulePage*>(this)->copy(); 160 return static_cast<const StyleRulePage*>(this)->copy();
171 case FontFace: 161 case FontFace:
172 return static_cast<const StyleRuleFontFace*>(this)->copy(); 162 return static_cast<const StyleRuleFontFace*>(this)->copy();
173 case Media: 163 case Media:
174 return static_cast<const StyleRuleMedia*>(this)->copy(); 164 return static_cast<const StyleRuleMedia*>(this)->copy();
175 case Supports: 165 case Supports:
176 return static_cast<const StyleRuleSupports*>(this)->copy(); 166 return static_cast<const StyleRuleSupports*>(this)->copy();
177 #if ENABLE(CSS_REGIONS)
178 case Region: 167 case Region:
179 return static_cast<const StyleRuleRegion*>(this)->copy(); 168 return static_cast<const StyleRuleRegion*>(this)->copy();
180 #endif
181 case Import: 169 case Import:
182 // FIXME: Copy import rules. 170 // FIXME: Copy import rules.
183 ASSERT_NOT_REACHED(); 171 ASSERT_NOT_REACHED();
184 return 0; 172 return 0;
185 case Keyframes: 173 case Keyframes:
186 return static_cast<const StyleRuleKeyframes*>(this)->copy(); 174 return static_cast<const StyleRuleKeyframes*>(this)->copy();
187 case HostInternal: 175 case HostInternal:
188 return static_cast<const StyleRuleHost*>(this)->copy(); 176 return static_cast<const StyleRuleHost*>(this)->copy();
189 #if ENABLE(CSS_DEVICE_ADAPTATION) 177 #if ENABLE(CSS_DEVICE_ADAPTATION)
190 case Viewport: 178 case Viewport:
191 return static_cast<const StyleRuleViewport*>(this)->copy(); 179 return static_cast<const StyleRuleViewport*>(this)->copy();
192 #endif 180 #endif
193 case Filter: 181 case Filter:
194 return static_cast<const StyleRuleFilter*>(this)->copy(); 182 return static_cast<const StyleRuleFilter*>(this)->copy();
195 case Unknown: 183 case Unknown:
196 case Charset: 184 case Charset:
197 case Keyframe: 185 case Keyframe:
198 #if !ENABLE(CSS_REGIONS)
199 case Region:
200 #endif
201 ASSERT_NOT_REACHED(); 186 ASSERT_NOT_REACHED();
202 return 0; 187 return 0;
203 } 188 }
204 ASSERT_NOT_REACHED(); 189 ASSERT_NOT_REACHED();
205 return 0; 190 return 0;
206 } 191 }
207 192
208 PassRefPtr<CSSRule> StyleRuleBase::createCSSOMWrapper(CSSStyleSheet* parentSheet , CSSRule* parentRule) const 193 PassRefPtr<CSSRule> StyleRuleBase::createCSSOMWrapper(CSSStyleSheet* parentSheet , CSSRule* parentRule) const
209 { 194 {
210 RefPtr<CSSRule> rule; 195 RefPtr<CSSRule> rule;
211 StyleRuleBase* self = const_cast<StyleRuleBase*>(this); 196 StyleRuleBase* self = const_cast<StyleRuleBase*>(this);
212 switch (type()) { 197 switch (type()) {
213 case Style: 198 case Style:
214 rule = CSSStyleRule::create(static_cast<StyleRule*>(self), parentSheet); 199 rule = CSSStyleRule::create(static_cast<StyleRule*>(self), parentSheet);
215 break; 200 break;
216 case Page: 201 case Page:
217 rule = CSSPageRule::create(static_cast<StyleRulePage*>(self), parentShee t); 202 rule = CSSPageRule::create(static_cast<StyleRulePage*>(self), parentShee t);
218 break; 203 break;
219 case FontFace: 204 case FontFace:
220 rule = CSSFontFaceRule::create(static_cast<StyleRuleFontFace*>(self), pa rentSheet); 205 rule = CSSFontFaceRule::create(static_cast<StyleRuleFontFace*>(self), pa rentSheet);
221 break; 206 break;
222 case Media: 207 case Media:
223 rule = CSSMediaRule::create(static_cast<StyleRuleMedia*>(self), parentSh eet); 208 rule = CSSMediaRule::create(static_cast<StyleRuleMedia*>(self), parentSh eet);
224 break; 209 break;
225 case Supports: 210 case Supports:
226 rule = CSSSupportsRule::create(static_cast<StyleRuleSupports*>(self), pa rentSheet); 211 rule = CSSSupportsRule::create(static_cast<StyleRuleSupports*>(self), pa rentSheet);
227 break; 212 break;
228 #if ENABLE(CSS_REGIONS)
229 case Region: 213 case Region:
230 rule = WebKitCSSRegionRule::create(static_cast<StyleRuleRegion*>(self), parentSheet); 214 rule = WebKitCSSRegionRule::create(static_cast<StyleRuleRegion*>(self), parentSheet);
eseidel 2013/04/30 00:11:09 The constructor for WebKitCSSRegionRule should lik
231 break; 215 break;
232 #endif
233 case Import: 216 case Import:
234 rule = CSSImportRule::create(static_cast<StyleRuleImport*>(self), parent Sheet); 217 rule = CSSImportRule::create(static_cast<StyleRuleImport*>(self), parent Sheet);
235 break; 218 break;
236 case Keyframes: 219 case Keyframes:
237 rule = WebKitCSSKeyframesRule::create(static_cast<StyleRuleKeyframes*>(s elf), parentSheet); 220 rule = WebKitCSSKeyframesRule::create(static_cast<StyleRuleKeyframes*>(s elf), parentSheet);
238 break; 221 break;
239 #if ENABLE(CSS_DEVICE_ADAPTATION) 222 #if ENABLE(CSS_DEVICE_ADAPTATION)
240 case Viewport: 223 case Viewport:
241 rule = WebKitCSSViewportRule::create(static_cast<StyleRuleViewport*>(sel f), parentSheet); 224 rule = WebKitCSSViewportRule::create(static_cast<StyleRuleViewport*>(sel f), parentSheet);
242 break; 225 break;
243 #endif 226 #endif
244 case HostInternal: 227 case HostInternal:
245 rule = CSSHostRule::create(static_cast<StyleRuleHost*>(self), parentShee t); 228 rule = CSSHostRule::create(static_cast<StyleRuleHost*>(self), parentShee t);
246 break; 229 break;
247 case Filter: 230 case Filter:
248 rule = WebKitCSSFilterRule::create(static_cast<StyleRuleFilter*>(self), parentSheet); 231 rule = WebKitCSSFilterRule::create(static_cast<StyleRuleFilter*>(self), parentSheet);
249 break; 232 break;
250 case Unknown: 233 case Unknown:
251 case Charset: 234 case Charset:
252 case Keyframe: 235 case Keyframe:
253 #if !ENABLE(CSS_REGIONS)
254 case Region:
255 #endif
256 ASSERT_NOT_REACHED(); 236 ASSERT_NOT_REACHED();
257 return 0; 237 return 0;
258 } 238 }
259 if (parentRule) 239 if (parentRule)
260 rule->setParentRule(parentRule); 240 rule->setParentRule(parentRule);
261 return rule.release(); 241 return rule.release();
262 } 242 }
263 243
264 unsigned StyleRule::averageSizeInBytes() 244 unsigned StyleRule::averageSizeInBytes()
265 { 245 {
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 } 497 }
518 498
519 void StyleRuleFilter::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObject Info) const 499 void StyleRuleFilter::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObject Info) const
520 { 500 {
521 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); 501 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
522 info.addMember(m_filterName); 502 info.addMember(m_filterName);
523 info.addMember(m_properties); 503 info.addMember(m_properties);
524 } 504 }
525 505
526 } // namespace WebCore 506 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698