Chromium Code Reviews| OLD | NEW |
|---|---|
| 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.visitor; | 5 part of csslib.visitor; |
| 6 | 6 |
| 7 // TODO(terry): Enable class for debug only; when conditional imports enabled. | 7 // TODO(terry): Enable class for debug only; when conditional imports enabled. |
| 8 | 8 |
| 9 /** Helper function to dump the CSS AST. */ | 9 /** Helper function to dump the CSS AST. */ |
| 10 String treeToDebugString(StyleSheet styleSheet, [bool useSpan = false]) { | 10 String treeToDebugString(StyleSheet styleSheet, [bool useSpan = false]) { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 super.visitKeyFrameBlock(node); | 122 super.visitKeyFrameBlock(node); |
| 123 output.depth--; | 123 output.depth--; |
| 124 } | 124 } |
| 125 | 125 |
| 126 void visitFontFaceDirective(FontFaceDirective node) { | 126 void visitFontFaceDirective(FontFaceDirective node) { |
| 127 // TODO(terry): To Be Implemented | 127 // TODO(terry): To Be Implemented |
| 128 } | 128 } |
| 129 | 129 |
| 130 void visitStyletDirective(StyletDirective node) { | 130 void visitStyletDirective(StyletDirective node) { |
| 131 heading('StyletDirective', node); | 131 heading('StyletDirective', node); |
| 132 output.writeValue('dartClassName', node._dartClassName); | 132 output.writeValue('dartClassName', node.dartClassName); |
| 133 output.depth++; | 133 output.depth++; |
| 134 output.writeNodeList('rulesets', node._rulesets); | 134 output.writeNodeList('rulesets', node.rulesets); |
| 135 output.depth--; | 135 output.depth--; |
| 136 } | 136 } |
| 137 | 137 |
| 138 void visitNamespaceDirective(NamespaceDirective node) { | 138 void visitNamespaceDirective(NamespaceDirective node) { |
| 139 heading('NamespaceDirective', node); | 139 heading('NamespaceDirective', node); |
| 140 output.depth++; | 140 output.depth++; |
| 141 output.writeValue('prefix', node._prefix); | 141 output.writeValue('prefix', node._prefix); |
| 142 output.writeValue('uri', node._uri); | 142 output.writeValue('uri', node._uri); |
| 143 output.depth--; | 143 output.depth--; |
| 144 } | 144 } |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 165 visitDeclarationGroup(node.declarations); | 165 visitDeclarationGroup(node.declarations); |
| 166 output.depth--; | 166 output.depth--; |
| 167 } | 167 } |
| 168 | 168 |
| 169 /** | 169 /** |
| 170 * Added optional newLine for handling @include at top-level vs/ inside of | 170 * Added optional newLine for handling @include at top-level vs/ inside of |
| 171 * a declaration group. | 171 * a declaration group. |
| 172 */ | 172 */ |
| 173 void visitIncludeDirective(IncludeDirective node) { | 173 void visitIncludeDirective(IncludeDirective node) { |
| 174 heading('IncludeDirective ${node.name}', node); | 174 heading('IncludeDirective ${node.name}', node); |
| 175 output.writeNodeList('parameters', node.args); | 175 var flattened = node.args.expand((e) => e).toList(); |
|
terry
2013/11/07 18:17:05
Leave writeNodeList and writeList to take a List m
kevmoo-old
2013/11/07 18:23:19
writeNodeList assumes each element in list hase a
| |
| 176 output.writeNodeList('parameters', flattened); | |
| 176 } | 177 } |
| 177 | 178 |
| 178 void visitIncludeMixinAtDeclaration(IncludeMixinAtDeclaration node) { | 179 void visitIncludeMixinAtDeclaration(IncludeMixinAtDeclaration node) { |
| 179 heading('IncludeMixinAtDeclaration ${node.include.name}', node); | 180 heading('IncludeMixinAtDeclaration ${node.include.name}', node); |
| 180 output.depth++; | 181 output.depth++; |
| 181 visitIncludeDirective(node.include); | 182 visitIncludeDirective(node.include); |
| 182 output.depth--; | 183 output.depth--; |
| 183 } | 184 } |
| 184 | 185 |
| 185 void visitExtendDeclaration(ExtendDeclaration node) { | 186 void visitExtendDeclaration(ExtendDeclaration node) { |
| 186 heading('ExtendDeclaration', node); | 187 heading('ExtendDeclaration', node); |
| 187 output.depth++; | 188 output.depth++; |
| 188 _visitNodeList(node.selectors); | 189 _visitNodeList(node.selectors); |
| 189 output.depth--; | 190 output.depth--; |
| 190 } | 191 } |
| 191 | 192 |
| 192 void visitRuleSet(RuleSet node) { | 193 void visitRuleSet(RuleSet node) { |
| 193 heading('Ruleset', node); | 194 heading('Ruleset', node); |
| 194 output.depth++; | 195 output.depth++; |
| 195 super.visitRuleSet(node); | 196 super.visitRuleSet(node); |
| 196 output.depth--; | 197 output.depth--; |
| 197 } | 198 } |
| 198 | 199 |
| 199 void visitDeclarationGroup(DeclarationGroup node) { | 200 void visitDeclarationGroup(DeclarationGroup node) { |
| 200 heading('DeclarationGroup', node); | 201 heading('DeclarationGroup', node); |
| 201 output.depth++; | 202 output.depth++; |
| 202 output.writeNodeList('declarations', node._declarations); | 203 output.writeNodeList('declarations', node.declarations); |
| 203 output.depth--; | 204 output.depth--; |
| 204 } | 205 } |
| 205 | 206 |
| 206 void visitMarginGroup(MarginGroup node) { | 207 void visitMarginGroup(MarginGroup node) { |
| 207 heading('MarginGroup', node); | 208 heading('MarginGroup', node); |
| 208 output.depth++; | 209 output.depth++; |
| 209 output.writeValue('@directive', node.margin_sym); | 210 output.writeValue('@directive', node.margin_sym); |
| 210 output.writeNodeList('declarations', node._declarations); | 211 output.writeNodeList('declarations', node.declarations); |
| 211 output.depth--; | 212 output.depth--; |
| 212 } | 213 } |
| 213 | 214 |
| 214 void visitDeclaration(Declaration node) { | 215 void visitDeclaration(Declaration node) { |
| 215 heading('Declaration', node); | 216 heading('Declaration', node); |
| 216 output.depth++; | 217 output.depth++; |
| 217 if (node.isIE7) output.write('IE7 property'); | 218 if (node.isIE7) output.write('IE7 property'); |
| 218 output.write('property'); | 219 output.write('property'); |
| 219 super.visitDeclaration(node); | 220 super.visitDeclaration(node); |
| 220 output.writeNode('expression', node._expression); | 221 output.writeNode('expression', node._expression); |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 548 } | 549 } |
| 549 | 550 |
| 550 void visitPaddingExpression(PaddingExpression node) { | 551 void visitPaddingExpression(PaddingExpression node) { |
| 551 heading('Dart Style PaddingExpression', node); | 552 heading('Dart Style PaddingExpression', node); |
| 552 } | 553 } |
| 553 | 554 |
| 554 void visitWidthExpression(WidthExpression node) { | 555 void visitWidthExpression(WidthExpression node) { |
| 555 heading('Dart Style WidthExpression', node); | 556 heading('Dart Style WidthExpression', node); |
| 556 } | 557 } |
| 557 } | 558 } |
| OLD | NEW |