| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 83 |
| 84 void visitMediaDirective(MediaDirective node) { | 84 void visitMediaDirective(MediaDirective node) { |
| 85 heading('MediaDirective', node); | 85 heading('MediaDirective', node); |
| 86 output.depth++; | 86 output.depth++; |
| 87 output.writeNodeList('media queries', node.mediaQueries); | 87 output.writeNodeList('media queries', node.mediaQueries); |
| 88 output.writeNodeList('rule sets', node.rulesets); | 88 output.writeNodeList('rule sets', node.rulesets); |
| 89 super.visitMediaDirective(node); | 89 super.visitMediaDirective(node); |
| 90 output.depth--; | 90 output.depth--; |
| 91 } | 91 } |
| 92 | 92 |
| 93 void visitDocumentDirective(DocumentDirective node) { |
| 94 heading('DocumentDirective', node); |
| 95 output.depth++; |
| 96 output.writeNodeList('functions', node.functions); |
| 97 output.writeNodeList('group rule body', node.groupRuleBody); |
| 98 output.depth--; |
| 99 } |
| 100 |
| 101 void visitSupportsDirective(SupportsDirective node) { |
| 102 heading('SupportsDirective', node); |
| 103 output.depth++; |
| 104 output.writeNode('condition', node.condition); |
| 105 output.writeNodeList('group rule body', node.groupRuleBody); |
| 106 output.depth--; |
| 107 } |
| 108 |
| 109 void visitSupportsConditionInParens(SupportsConditionInParens node) { |
| 110 heading('SupportsConditionInParens', node); |
| 111 output.depth++; |
| 112 output.writeNode('condition', node.condition); |
| 113 output.depth--; |
| 114 } |
| 115 |
| 116 void visitSupportsNegation(SupportsNegation node) { |
| 117 heading('SupportsNegation', node); |
| 118 output.depth++; |
| 119 output.writeNode('condition', node.condition); |
| 120 output.depth--; |
| 121 } |
| 122 |
| 123 void visitSupportsConjunction(SupportsConjunction node) { |
| 124 heading('SupportsConjunction', node); |
| 125 output.depth++; |
| 126 output.writeNodeList('conditions', node.conditions); |
| 127 output.depth--; |
| 128 } |
| 129 |
| 130 void visitSupportsDisjunction(SupportsDisjunction node) { |
| 131 heading('SupportsDisjunction', node); |
| 132 output.depth++; |
| 133 output.writeNodeList('conditions', node.conditions); |
| 134 output.depth--; |
| 135 } |
| 136 |
| 137 void visitViewportDirective(ViewportDirective node) { |
| 138 heading('ViewportDirective', node); |
| 139 output.depth++; |
| 140 super.visitViewportDirective(node); |
| 141 output.depth--; |
| 142 } |
| 143 |
| 93 void visitPageDirective(PageDirective node) { | 144 void visitPageDirective(PageDirective node) { |
| 94 heading('PageDirective', node); | 145 heading('PageDirective', node); |
| 95 output.depth++; | 146 output.depth++; |
| 96 output.writeValue('pseudo page', node._pseudoPage); | 147 output.writeValue('pseudo page', node._pseudoPage); |
| 97 super.visitPageDirective(node); | 148 super.visitPageDirective(node); |
| 98 output.depth; | 149 output.depth; |
| 99 } | 150 } |
| 100 | 151 |
| 101 void visitCharsetDirective(CharsetDirective node) { | 152 void visitCharsetDirective(CharsetDirective node) { |
| 102 heading('Charset Directive', node); | 153 heading('Charset Directive', node); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 if (node.isCombinatorNone) { | 315 if (node.isCombinatorNone) { |
| 265 output.writeValue('combinator', "NONE"); | 316 output.writeValue('combinator', "NONE"); |
| 266 } else if (node.isCombinatorDescendant) { | 317 } else if (node.isCombinatorDescendant) { |
| 267 output.writeValue('combinator', "descendant"); | 318 output.writeValue('combinator', "descendant"); |
| 268 } else if (node.isCombinatorPlus) { | 319 } else if (node.isCombinatorPlus) { |
| 269 output.writeValue('combinator', "+"); | 320 output.writeValue('combinator', "+"); |
| 270 } else if (node.isCombinatorGreater) { | 321 } else if (node.isCombinatorGreater) { |
| 271 output.writeValue('combinator', ">"); | 322 output.writeValue('combinator', ">"); |
| 272 } else if (node.isCombinatorTilde) { | 323 } else if (node.isCombinatorTilde) { |
| 273 output.writeValue('combinator', "~"); | 324 output.writeValue('combinator', "~"); |
| 325 } else if (node.isCombinatorShadowPiercingDescendant) { |
| 326 output.writeValue('combinator', '>>>'); |
| 327 } else if (node.isCombinatorDeep) { |
| 328 output.writeValue('combinator', '/deep/'); |
| 274 } else { | 329 } else { |
| 275 output.writeValue('combinator', "ERROR UNKNOWN"); | 330 output.writeValue('combinator', "ERROR UNKNOWN"); |
| 276 } | 331 } |
| 277 | 332 |
| 278 super.visitSimpleSelectorSequence(node); | 333 super.visitSimpleSelectorSequence(node); |
| 279 | 334 |
| 280 output.depth--; | 335 output.depth--; |
| 281 } | 336 } |
| 282 | 337 |
| 283 void visitNamespaceSelector(NamespaceSelector node) { | 338 void visitNamespaceSelector(NamespaceSelector node) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 void visitPseudoElementSelector(PseudoElementSelector node) { | 386 void visitPseudoElementSelector(PseudoElementSelector node) { |
| 332 heading('Pseudo Element Selector', node); | 387 heading('Pseudo Element Selector', node); |
| 333 output.depth++; | 388 output.depth++; |
| 334 super.visitPseudoElementSelector(node); | 389 super.visitPseudoElementSelector(node); |
| 335 output.depth--; | 390 output.depth--; |
| 336 } | 391 } |
| 337 | 392 |
| 338 void visitPseudoClassFunctionSelector(PseudoClassFunctionSelector node) { | 393 void visitPseudoClassFunctionSelector(PseudoClassFunctionSelector node) { |
| 339 heading('Pseudo Class Function Selector', node); | 394 heading('Pseudo Class Function Selector', node); |
| 340 output.depth++; | 395 output.depth++; |
| 341 visitSelectorExpression(node.expression); | 396 node.argument.visit(this); |
| 342 super.visitPseudoClassFunctionSelector(node); | 397 super.visitPseudoClassFunctionSelector(node); |
| 343 output.depth--; | 398 output.depth--; |
| 344 } | 399 } |
| 345 | 400 |
| 346 void visitPseudoElementFunctionSelector(PseudoElementFunctionSelector node) { | 401 void visitPseudoElementFunctionSelector(PseudoElementFunctionSelector node) { |
| 347 heading('Pseudo Element Function Selector', node); | 402 heading('Pseudo Element Function Selector', node); |
| 348 output.depth++; | 403 output.depth++; |
| 349 visitSelectorExpression(node.expression); | 404 visitSelectorExpression(node.expression); |
| 350 super.visitPseudoElementFunctionSelector(node); | 405 super.visitPseudoElementFunctionSelector(node); |
| 351 output.depth--; | 406 output.depth--; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 } | 611 } |
| 557 | 612 |
| 558 void visitPaddingExpression(PaddingExpression node) { | 613 void visitPaddingExpression(PaddingExpression node) { |
| 559 heading('Dart Style PaddingExpression', node); | 614 heading('Dart Style PaddingExpression', node); |
| 560 } | 615 } |
| 561 | 616 |
| 562 void visitWidthExpression(WidthExpression node) { | 617 void visitWidthExpression(WidthExpression node) { |
| 563 heading('Dart Style WidthExpression', node); | 618 heading('Dart Style WidthExpression', node); |
| 564 } | 619 } |
| 565 } | 620 } |
| OLD | NEW |