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

Side by Side Diff: packages/csslib/lib/src/polyfill.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 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 | « packages/csslib/lib/src/options.dart ('k') | packages/csslib/lib/src/property.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of csslib.parser; 5 part of csslib.parser;
6 6
7 /** 7 /**
8 * CSS polyfill emits CSS to be understood by older parsers that which do not 8 * CSS polyfill emits CSS to be understood by older parsers that which do not
9 * understand (var, calc, etc.). 9 * understand (var, calc, etc.).
10 */ 10 */
(...skipping 22 matching lines...) Expand all
33 processVars(styleSheet); 33 processVars(styleSheet);
34 34
35 // Remove all var definitions for this style sheet. 35 // Remove all var definitions for this style sheet.
36 new _RemoveVarDefinitions().visitTree(styleSheet); 36 new _RemoveVarDefinitions().visitTree(styleSheet);
37 } 37 }
38 38
39 /** Process all includes looking for var definitions. */ 39 /** Process all includes looking for var definitions. */
40 void processVarDefinitions(List<StyleSheet> includes) { 40 void processVarDefinitions(List<StyleSheet> includes) {
41 for (var include in includes) { 41 for (var include in includes) {
42 _allVarDefinitions = (new _VarDefinitionsIncludes(_allVarDefinitions) 42 _allVarDefinitions = (new _VarDefinitionsIncludes(_allVarDefinitions)
43 ..visitTree(include)).varDefs; 43 ..visitTree(include))
44 .varDefs;
44 } 45 }
45 } 46 }
46 47
47 void processVars(StyleSheet styleSheet) { 48 void processVars(StyleSheet styleSheet) {
48 // Build list of all var definitions. 49 // Build list of all var definitions.
49 var mainStyleSheetVarDefs = (new _VarDefAndUsage( 50 var mainStyleSheetVarDefs =
50 this._messages, _allVarDefinitions)..visitTree(styleSheet)).varDefs; 51 (new _VarDefAndUsage(this._messages, _allVarDefinitions)
52 ..visitTree(styleSheet))
53 .varDefs;
51 54
52 // Resolve all definitions to a non-VarUsage (terminal expression). 55 // Resolve all definitions to a non-VarUsage (terminal expression).
53 mainStyleSheetVarDefs.forEach((key, value) { 56 mainStyleSheetVarDefs.forEach((key, value) {
54 for (var _ in (value.expression as Expressions).expressions) { 57 for (var _ in (value.expression as Expressions).expressions) {
55 mainStyleSheetVarDefs[key] = 58 mainStyleSheetVarDefs[key] =
56 _findTerminalVarDefinition(_allVarDefinitions, value); 59 _findTerminalVarDefinition(_allVarDefinitions, value);
57 } 60 }
58 }); 61 });
59 } 62 }
60 } 63 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 _messages.warning("Variable is not defined.", node.span); 166 _messages.warning("Variable is not defined.", node.span);
164 } 167 }
165 168
166 var oldExpressions = currentExpressions; 169 var oldExpressions = currentExpressions;
167 currentExpressions = node.defaultValues; 170 currentExpressions = node.defaultValues;
168 super.visitVarUsage(node); 171 super.visitVarUsage(node);
169 currentExpressions = oldExpressions; 172 currentExpressions = oldExpressions;
170 } 173 }
171 174
172 List<Expression> resolveUsageTerminal(VarUsage usage) { 175 List<Expression> resolveUsageTerminal(VarUsage usage) {
173 var result = []; 176 var result = <Expression>[];
174 177
175 var varDef = _knownVarDefs[usage.name]; 178 var varDef = _knownVarDefs[usage.name];
176 var expressions; 179 var expressions;
177 if (varDef == null) { 180 if (varDef == null) {
178 // VarDefinition not found try the defaultValues. 181 // VarDefinition not found try the defaultValues.
179 expressions = usage.defaultValues; 182 expressions = usage.defaultValues;
180 } else { 183 } else {
181 // Use the VarDefinition found. 184 // Use the VarDefinition found.
182 expressions = (varDef.expression as Expressions).expressions; 185 expressions = (varDef.expression as Expressions).expressions;
183 } 186 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 249 }
247 } else { 250 } else {
248 // Return real CSS property. 251 // Return real CSS property.
249 return varDef; 252 return varDef;
250 } 253 }
251 } 254 }
252 255
253 // Didn't point to a var definition that existed. 256 // Didn't point to a var definition that existed.
254 return varDef; 257 return varDef;
255 } 258 }
OLDNEW
« no previous file with comments | « packages/csslib/lib/src/options.dart ('k') | packages/csslib/lib/src/property.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698