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

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

Issue 951213004: Make CSSRuleSourceData use the CSSRule Type enum (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use StyleRule::Type Created 5 years, 10 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
« no previous file with comments | « Source/core/css/StyleRule.h ('k') | Source/core/css/StyleSheetContents.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, 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 return; 79 return;
80 case Keyframe: 80 case Keyframe:
81 toStyleRuleKeyframe(this)->traceAfterDispatch(visitor); 81 toStyleRuleKeyframe(this)->traceAfterDispatch(visitor);
82 return; 82 return;
83 case Namespace: 83 case Namespace:
84 toStyleRuleNamespace(this)->traceAfterDispatch(visitor); 84 toStyleRuleNamespace(this)->traceAfterDispatch(visitor);
85 return; 85 return;
86 case Viewport: 86 case Viewport:
87 toStyleRuleViewport(this)->traceAfterDispatch(visitor); 87 toStyleRuleViewport(this)->traceAfterDispatch(visitor);
88 return; 88 return;
89 case Unknown:
90 break;
89 } 91 }
90 ASSERT_NOT_REACHED(); 92 ASSERT_NOT_REACHED();
91 } 93 }
92 94
93 void StyleRuleBase::finalizeGarbageCollectedObject() 95 void StyleRuleBase::finalizeGarbageCollectedObject()
94 { 96 {
95 switch (type()) { 97 switch (type()) {
96 case Style: 98 case Style:
97 toStyleRule(this)->~StyleRule(); 99 toStyleRule(this)->~StyleRule();
98 return; 100 return;
(...skipping 17 matching lines...) Expand all
116 return; 118 return;
117 case Keyframe: 119 case Keyframe:
118 toStyleRuleKeyframe(this)->~StyleRuleKeyframe(); 120 toStyleRuleKeyframe(this)->~StyleRuleKeyframe();
119 return; 121 return;
120 case Namespace: 122 case Namespace:
121 toStyleRuleNamespace(this)->~StyleRuleNamespace(); 123 toStyleRuleNamespace(this)->~StyleRuleNamespace();
122 return; 124 return;
123 case Viewport: 125 case Viewport:
124 toStyleRuleViewport(this)->~StyleRuleViewport(); 126 toStyleRuleViewport(this)->~StyleRuleViewport();
125 return; 127 return;
128 case Unknown:
129 return;
126 } 130 }
127 ASSERT_NOT_REACHED(); 131 ASSERT_NOT_REACHED();
128 } 132 }
129 133
130 void StyleRuleBase::destroy() 134 void StyleRuleBase::destroy()
131 { 135 {
132 switch (type()) { 136 switch (type()) {
133 case Style: 137 case Style:
134 delete toStyleRule(this); 138 delete toStyleRule(this);
135 return; 139 return;
(...skipping 17 matching lines...) Expand all
153 return; 157 return;
154 case Keyframe: 158 case Keyframe:
155 delete toStyleRuleKeyframe(this); 159 delete toStyleRuleKeyframe(this);
156 return; 160 return;
157 case Namespace: 161 case Namespace:
158 delete toStyleRuleNamespace(this); 162 delete toStyleRuleNamespace(this);
159 return; 163 return;
160 case Viewport: 164 case Viewport:
161 delete toStyleRuleViewport(this); 165 delete toStyleRuleViewport(this);
162 return; 166 return;
167 case Unknown:
168 return;
163 } 169 }
164 ASSERT_NOT_REACHED(); 170 ASSERT_NOT_REACHED();
165 } 171 }
166 172
167 PassRefPtrWillBeRawPtr<StyleRuleBase> StyleRuleBase::copy() const 173 PassRefPtrWillBeRawPtr<StyleRuleBase> StyleRuleBase::copy() const
168 { 174 {
169 switch (type()) { 175 switch (type()) {
170 case Style: 176 case Style:
171 return toStyleRule(this)->copy(); 177 return toStyleRule(this)->copy();
172 case Page: 178 case Page:
173 return toStyleRulePage(this)->copy(); 179 return toStyleRulePage(this)->copy();
174 case FontFace: 180 case FontFace:
175 return toStyleRuleFontFace(this)->copy(); 181 return toStyleRuleFontFace(this)->copy();
176 case Media: 182 case Media:
177 return toStyleRuleMedia(this)->copy(); 183 return toStyleRuleMedia(this)->copy();
178 case Supports: 184 case Supports:
179 return toStyleRuleSupports(this)->copy(); 185 return toStyleRuleSupports(this)->copy();
180 case Import: 186 case Import:
181 // FIXME: Copy import rules. 187 // FIXME: Copy import rules.
182 ASSERT_NOT_REACHED(); 188 ASSERT_NOT_REACHED();
183 return nullptr; 189 return nullptr;
184 case Keyframes: 190 case Keyframes:
185 return toStyleRuleKeyframes(this)->copy(); 191 return toStyleRuleKeyframes(this)->copy();
186 case Viewport: 192 case Viewport:
187 return toStyleRuleViewport(this)->copy(); 193 return toStyleRuleViewport(this)->copy();
188 case Keyframe: 194 case Keyframe:
189 case Namespace: 195 case Namespace:
196 case Unknown:
190 ASSERT_NOT_REACHED(); 197 ASSERT_NOT_REACHED();
191 return nullptr; 198 return nullptr;
192 } 199 }
193 ASSERT_NOT_REACHED(); 200 ASSERT_NOT_REACHED();
194 return nullptr; 201 return nullptr;
195 } 202 }
196 203
197 PassRefPtrWillBeRawPtr<CSSRule> StyleRuleBase::createCSSOMWrapper(CSSStyleSheet* parentSheet, CSSRule* parentRule) const 204 PassRefPtrWillBeRawPtr<CSSRule> StyleRuleBase::createCSSOMWrapper(CSSStyleSheet* parentSheet, CSSRule* parentRule) const
198 { 205 {
199 RefPtrWillBeRawPtr<CSSRule> rule = nullptr; 206 RefPtrWillBeRawPtr<CSSRule> rule = nullptr;
(...skipping 18 matching lines...) Expand all
218 rule = CSSImportRule::create(toStyleRuleImport(self), parentSheet); 225 rule = CSSImportRule::create(toStyleRuleImport(self), parentSheet);
219 break; 226 break;
220 case Keyframes: 227 case Keyframes:
221 rule = CSSKeyframesRule::create(toStyleRuleKeyframes(self), parentSheet) ; 228 rule = CSSKeyframesRule::create(toStyleRuleKeyframes(self), parentSheet) ;
222 break; 229 break;
223 case Viewport: 230 case Viewport:
224 rule = CSSViewportRule::create(toStyleRuleViewport(self), parentSheet); 231 rule = CSSViewportRule::create(toStyleRuleViewport(self), parentSheet);
225 break; 232 break;
226 case Keyframe: 233 case Keyframe:
227 case Namespace: 234 case Namespace:
235 case Unknown:
228 ASSERT_NOT_REACHED(); 236 ASSERT_NOT_REACHED();
229 return nullptr; 237 return nullptr;
230 } 238 }
231 if (parentRule) 239 if (parentRule)
232 rule->setParentRule(parentRule); 240 rule->setParentRule(parentRule);
233 return rule.release(); 241 return rule.release();
234 } 242 }
235 243
236 unsigned StyleRule::averageSizeInBytes() 244 unsigned StyleRule::averageSizeInBytes()
237 { 245 {
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 m_properties = properties; 437 m_properties = properties;
430 } 438 }
431 439
432 DEFINE_TRACE_AFTER_DISPATCH(StyleRuleViewport) 440 DEFINE_TRACE_AFTER_DISPATCH(StyleRuleViewport)
433 { 441 {
434 visitor->trace(m_properties); 442 visitor->trace(m_properties);
435 StyleRuleBase::traceAfterDispatch(visitor); 443 StyleRuleBase::traceAfterDispatch(visitor);
436 } 444 }
437 445
438 } // namespace blink 446 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/StyleRule.h ('k') | Source/core/css/StyleSheetContents.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698