| 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, [bool useSpan = false]) { | 10 String treeToDebugString(styleSheet, [bool useSpan = false]) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 void visitImportDirective(ImportDirective node) { | 97 void visitImportDirective(ImportDirective node) { |
| 98 heading('ImportDirective', node); | 98 heading('ImportDirective', node); |
| 99 output.depth++; | 99 output.depth++; |
| 100 output.writeValue('import', node.import); | 100 output.writeValue('import', node.import); |
| 101 super.visitImportDirective(node); | 101 super.visitImportDirective(node); |
| 102 output.writeNodeList('media', node.mediaQueries); | 102 output.writeNodeList('media', node.mediaQueries); |
| 103 output.depth--; | 103 output.depth--; |
| 104 } | 104 } |
| 105 | 105 |
| 106 void visitContentDirective(ContentDirective node) { |
| 107 print("ContentDirective not implemented"); |
| 108 } |
| 109 |
| 106 void visitKeyFrameDirective(KeyFrameDirective node) { | 110 void visitKeyFrameDirective(KeyFrameDirective node) { |
| 107 heading('KeyFrameDirective', node); | 111 heading('KeyFrameDirective', node); |
| 108 output.depth++; | 112 output.depth++; |
| 109 output.writeValue('keyframe', node.keyFrameName); | 113 output.writeValue('keyframe', node.keyFrameName); |
| 110 output.writeValue('name', node._name); | 114 output.writeValue('name', node._name); |
| 111 output.writeNodeList('blocks', node._blocks); | 115 output.writeNodeList('blocks', node._blocks); |
| 112 output.depth--; | 116 output.depth--; |
| 113 } | 117 } |
| 114 | 118 |
| 115 void visitKeyFrameBlock(KeyFrameBlock node) { | 119 void visitKeyFrameBlock(KeyFrameBlock node) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 134 void visitNamespaceDirective(NamespaceDirective node) { | 138 void visitNamespaceDirective(NamespaceDirective node) { |
| 135 heading('NamespaceDirective', node); | 139 heading('NamespaceDirective', node); |
| 136 output.depth++; | 140 output.depth++; |
| 137 output.writeValue('prefix', node._prefix); | 141 output.writeValue('prefix', node._prefix); |
| 138 output.writeValue('uri', node._uri); | 142 output.writeValue('uri', node._uri); |
| 139 output.depth--; | 143 output.depth--; |
| 140 } | 144 } |
| 141 | 145 |
| 142 void visitVarDefinitionDirective(VarDefinitionDirective node) { | 146 void visitVarDefinitionDirective(VarDefinitionDirective node) { |
| 143 heading('Less variable definition', node); | 147 heading('Less variable definition', node); |
| 148 output.depth++; |
| 144 visitVarDefinition(node.def); | 149 visitVarDefinition(node.def); |
| 150 output.depth--; |
| 151 } |
| 152 |
| 153 void visitMixinRulesetDirective(MixinRulesetDirective node) { |
| 154 heading('Mixin top-level ${node.name}', node); |
| 155 output.writeNodeList('parameters', node.definedArgs); |
| 156 output.depth++; |
| 157 _visitNodeList(node.rulesets); |
| 158 output.depth--; |
| 159 } |
| 160 |
| 161 void visitMixinDeclarationDirective(MixinDeclarationDirective node) { |
| 162 heading('Mixin declaration ${node.name}', node); |
| 163 output.writeNodeList('parameters', node.definedArgs); |
| 164 output.depth++; |
| 165 visitDeclarationGroup(node.declarations); |
| 166 output.depth--; |
| 167 } |
| 168 |
| 169 /** |
| 170 * Added optional newLine for handling @include at top-level vs/ inside of |
| 171 * a declaration group. |
| 172 */ |
| 173 void visitIncludeDirective(IncludeDirective node) { |
| 174 heading('IncludeDirective ${node.name}', node); |
| 175 output.writeNodeList('parameters', node.args); |
| 176 } |
| 177 |
| 178 void visitIncludeMixinAtDeclaration(IncludeMixinAtDeclaration node) { |
| 179 heading('IncludeMixinAtDeclaration ${node.include.name}', node); |
| 180 output.depth++; |
| 181 visitIncludeDirective(node.include); |
| 182 output.depth--; |
| 183 } |
| 184 |
| 185 void visitExtendDeclaration(ExtendDeclaration node) { |
| 186 heading('ExtendDeclaration', node); |
| 187 output.depth++; |
| 188 _visitNodeList(node.selectors); |
| 189 output.depth--; |
| 145 } | 190 } |
| 146 | 191 |
| 147 void visitRuleSet(RuleSet node) { | 192 void visitRuleSet(RuleSet node) { |
| 148 heading('Ruleset', node); | 193 heading('Ruleset', node); |
| 149 output.depth++; | 194 output.depth++; |
| 150 super.visitRuleSet(node); | 195 super.visitRuleSet(node); |
| 151 output.depth--; | 196 output.depth--; |
| 152 } | 197 } |
| 153 | 198 |
| 154 void visitDeclarationGroup(DeclarationGroup node) { | 199 void visitDeclarationGroup(DeclarationGroup node) { |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 } | 548 } |
| 504 | 549 |
| 505 void visitPaddingExpression(PaddingExpression node) { | 550 void visitPaddingExpression(PaddingExpression node) { |
| 506 heading('Dart Style PaddingExpression', node); | 551 heading('Dart Style PaddingExpression', node); |
| 507 } | 552 } |
| 508 | 553 |
| 509 void visitWidthExpression(WidthExpression node) { | 554 void visitWidthExpression(WidthExpression node) { |
| 510 heading('Dart Style WidthExpression', node); | 555 heading('Dart Style WidthExpression', node); |
| 511 } | 556 } |
| 512 } | 557 } |
| OLD | NEW |