Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 ///////////////////////////////////////////////////////////////////////// | 7 ///////////////////////////////////////////////////////////////////////// |
| 8 // CSS specific types: | 8 // CSS specific types: |
| 9 ///////////////////////////////////////////////////////////////////////// | 9 ///////////////////////////////////////////////////////////////////////// |
| 10 | 10 |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 // :NOT(negation_arg) | 259 // :NOT(negation_arg) |
| 260 class NegationSelector extends SimpleSelector { | 260 class NegationSelector extends SimpleSelector { |
| 261 SimpleSelector negationArg; | 261 SimpleSelector negationArg; |
| 262 | 262 |
| 263 NegationSelector(this.negationArg, Span span) | 263 NegationSelector(this.negationArg, Span span) |
| 264 : super(new Negation(span), span); | 264 : super(new Negation(span), span); |
| 265 | 265 |
| 266 visit(VisitorBase visitor) => visitor.visitNegationSelector(this); | 266 visit(VisitorBase visitor) => visitor.visitNegationSelector(this); |
| 267 } | 267 } |
| 268 | 268 |
| 269 class NoOp extends TreeNode { | |
| 270 NoOp() : super(null); | |
| 271 | |
| 272 visit(VisitorBase visitor) => visitor.visitNoOp(this); | |
| 273 } | |
| 274 | |
| 269 class StyleSheet extends TreeNode { | 275 class StyleSheet extends TreeNode { |
| 270 /** | 276 /** |
| 271 * Contains charset, ruleset, directives (media, page, etc.), and selectors. | 277 * Contains charset, ruleset, directives (media, page, etc.), and selectors. |
| 272 */ | 278 */ |
| 273 final topLevels; | 279 final topLevels; |
| 274 | 280 |
| 275 StyleSheet(this.topLevels, Span span) : super(span) { | 281 StyleSheet(this.topLevels, Span span) : super(span) { |
| 276 for (final node in topLevels) { | 282 for (final node in topLevels) { |
| 277 assert(node is TopLevelProduction || node is Directive); | 283 assert(node is TopLevelProduction || node is Directive); |
| 278 } | 284 } |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 487 | 493 |
| 488 /** To support Less syntax @name: expression */ | 494 /** To support Less syntax @name: expression */ |
| 489 class VarDefinitionDirective extends Directive { | 495 class VarDefinitionDirective extends Directive { |
| 490 final VarDefinition def; | 496 final VarDefinition def; |
| 491 | 497 |
| 492 VarDefinitionDirective(this.def, Span span) : super(span); | 498 VarDefinitionDirective(this.def, Span span) : super(span); |
| 493 | 499 |
| 494 visit(VisitorBase visitor) => visitor.visitVarDefinitionDirective(this); | 500 visit(VisitorBase visitor) => visitor.visitVarDefinitionDirective(this); |
| 495 } | 501 } |
| 496 | 502 |
| 503 class MixinDefinition extends Directive { | |
| 504 final String name; | |
| 505 final List definedArgs; | |
| 506 final bool varArgs; | |
|
nweiz
2013/09/18 22:40:54
As with @content, don't include infrastructure for
terry
2013/10/09 03:40:33
args supported.
On 2013/09/18 22:40:54, nweiz wrot
| |
| 507 | |
| 508 MixinDefinition(this.name, this.definedArgs, this.varArgs, Span span) | |
| 509 : super(span); | |
| 510 | |
| 511 visit(VisitorBase visitor) => visitor.visitMixinDefinition(this); | |
| 512 } | |
| 513 | |
| 514 /** To support defining a SASS @mixin. */ | |
|
nweiz
2013/09/18 22:40:54
Only the first letter of "Sass" is capitalized.
T
terry
2013/10/09 03:40:33
Ok, referenced web site no need to explain the Sas
| |
| 515 class MixinRulesetDirective extends MixinDefinition { | |
| 516 final List<RuleSet> rulesets; | |
| 517 | |
| 518 MixinRulesetDirective(String name, List args, bool varArgs, this.rulesets, | |
| 519 Span span) : super(name, args, varArgs, span); | |
| 520 | |
| 521 visit(VisitorBase visitor) => visitor.visitMixinRulesetDirective(this); | |
| 522 } | |
| 523 | |
| 524 class MixinDeclarationDirective extends MixinDefinition { | |
| 525 final DeclarationGroup declarations; | |
| 526 | |
| 527 MixinDeclarationDirective(String name, List args, bool varArgs, | |
| 528 this.declarations, Span span) : super(name, args, varArgs, span); | |
| 529 | |
| 530 visit(VisitorBase visitor) => visitor.visitMixinDeclarationDirective(this); | |
| 531 } | |
| 532 | |
| 533 /** To support consuming a SASS mixin @include. */ | |
| 534 class IncludeDirective extends Directive { | |
| 535 final String name; | |
| 536 final List args; | |
| 537 | |
| 538 IncludeDirective(this.name, this.args, Span span) : super(span); | |
| 539 | |
| 540 visit(VisitorBase visitor) => visitor.visitIncludeDirective(this); | |
| 541 } | |
| 542 | |
| 543 /** To support SASS @content. */ | |
| 544 class ContentDirective extends Directive { | |
| 545 ContentDirective(Span span) : super(span); | |
| 546 | |
| 547 visit(VisitorBase visitor) => visitor.visitContentDirective(this); | |
| 548 } | |
| 549 | |
| 497 class Declaration extends TreeNode { | 550 class Declaration extends TreeNode { |
| 498 final Identifier _property; | 551 final Identifier _property; |
| 499 final Expression _expression; | 552 final Expression _expression; |
| 500 /** Style exposed to Dart. */ | 553 /** Style exposed to Dart. */ |
| 501 var _dart; | 554 var _dart; |
| 502 final bool important; | 555 final bool important; |
| 503 | 556 |
| 504 /** | 557 /** |
| 505 * IE CSS hacks that can only be read by a particular IE version. | 558 * IE CSS hacks that can only be read by a particular IE version. |
| 506 * 7 implies IE 7 or older property (e.g., *background: blue;) | 559 * 7 implies IE 7 or older property (e.g., *background: blue;) |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 537 VarDefinition(Identifier definedName, Expression expr, Span span) | 590 VarDefinition(Identifier definedName, Expression expr, Span span) |
| 538 : super(definedName, expr, null, span); | 591 : super(definedName, expr, null, span); |
| 539 | 592 |
| 540 String get definedName => _property.name; | 593 String get definedName => _property.name; |
| 541 | 594 |
| 542 set dartStyle(dStyle) { } | 595 set dartStyle(dStyle) { } |
| 543 | 596 |
| 544 visit(VisitorBase visitor) => visitor.visitVarDefinition(this); | 597 visit(VisitorBase visitor) => visitor.visitVarDefinition(this); |
| 545 } | 598 } |
| 546 | 599 |
| 600 /** | |
| 601 * Node for usage of @include mixin[(args,...)] found in a declaration group | |
| 602 * instead of at a ruleset (toplevel) e.g., | |
| 603 * div { | |
| 604 * @include mixin1; | |
| 605 * } | |
| 606 */ | |
| 607 class IncludeMixinAtDeclaration extends Declaration { | |
| 608 final IncludeDirective include; | |
| 609 | |
| 610 IncludeMixinAtDeclaration(this.include, Span span) | |
| 611 : super(null, null, null, span); | |
| 612 | |
| 613 visit(VisitorBase visitor) => visitor.visitIncludeMixinAtDeclaration(this); | |
| 614 } | |
| 615 | |
| 547 class DeclarationGroup extends TreeNode { | 616 class DeclarationGroup extends TreeNode { |
| 548 /** Can be either Declaration or RuleSet (if nested selector). */ | 617 /** Can be either Declaration or RuleSet (if nested selector). */ |
| 549 final List _declarations; | 618 final List _declarations; |
| 550 | 619 |
| 551 DeclarationGroup(this._declarations, Span span) : super(span); | 620 DeclarationGroup(this._declarations, Span span) : super(span); |
| 552 | 621 |
| 553 List get declarations => _declarations; | 622 List get declarations => _declarations; |
| 554 | 623 |
| 555 visit(VisitorBase visitor) => visitor.visitDeclarationGroup(this); | 624 visit(VisitorBase visitor) => visitor.visitDeclarationGroup(this); |
| 556 } | 625 } |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1045 factory PaddingExpression.merge(PaddingExpression x, PaddingExpression y) { | 1114 factory PaddingExpression.merge(PaddingExpression x, PaddingExpression y) { |
| 1046 return new PaddingExpression._merge(x, y, y.span); | 1115 return new PaddingExpression._merge(x, y, y.span); |
| 1047 } | 1116 } |
| 1048 | 1117 |
| 1049 PaddingExpression._merge(PaddingExpression x, PaddingExpression y, Span span) | 1118 PaddingExpression._merge(PaddingExpression x, PaddingExpression y, Span span) |
| 1050 : super(DartStyleExpression.paddingStyle, span, | 1119 : super(DartStyleExpression.paddingStyle, span, |
| 1051 new BoxEdge.merge(x.box, y.box)); | 1120 new BoxEdge.merge(x.box, y.box)); |
| 1052 | 1121 |
| 1053 visit(VisitorBase visitor) => visitor.visitPaddingExpression(this); | 1122 visit(VisitorBase visitor) => visitor.visitPaddingExpression(this); |
| 1054 } | 1123 } |
| OLD | NEW |