| 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.parser; | 5 part of csslib.parser; |
| 6 | 6 |
| 7 // TODO(terry): Add optimizing phase to remove duplicated selectors in the same | 7 // TODO(terry): Add optimizing phase to remove duplicated selectors in the same |
| 8 // selector group (e.g., .btn, .btn { color: red; }). Also, look | 8 // selector group (e.g., .btn, .btn { color: red; }). Also, look |
| 9 // at simplifying selectors expressions too (much harder). | 9 // at simplifying selectors expressions too (much harder). |
| 10 // TODO(terry): Detect invalid directive usage. All @imports must occur before | 10 // TODO(terry): Detect invalid directive usage. All @imports must occur before |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 static bool replace( | 408 static bool replace( |
| 409 StyleSheet styleSheet, RuleSet ruleSet, List<RuleSet> newRules) { | 409 StyleSheet styleSheet, RuleSet ruleSet, List<RuleSet> newRules) { |
| 410 var visitor = new _MediaRulesReplacer(ruleSet, newRules); | 410 var visitor = new _MediaRulesReplacer(ruleSet, newRules); |
| 411 visitor.visitStyleSheet(styleSheet); | 411 visitor.visitStyleSheet(styleSheet); |
| 412 return visitor._foundAndReplaced; | 412 return visitor._foundAndReplaced; |
| 413 } | 413 } |
| 414 | 414 |
| 415 _MediaRulesReplacer(this._ruleSet, this._newRules); | 415 _MediaRulesReplacer(this._ruleSet, this._newRules); |
| 416 | 416 |
| 417 visitMediaDirective(MediaDirective node) { | 417 visitMediaDirective(MediaDirective node) { |
| 418 var index = node.rulesets.indexOf(_ruleSet); | 418 var index = node.rules.indexOf(_ruleSet); |
| 419 if (index != -1) { | 419 if (index != -1) { |
| 420 node.rulesets.insertAll(index + 1, _newRules); | 420 node.rules.insertAll(index + 1, _newRules); |
| 421 _foundAndReplaced = true; | 421 _foundAndReplaced = true; |
| 422 } | 422 } |
| 423 } | 423 } |
| 424 } | 424 } |
| 425 | 425 |
| 426 /** | 426 /** |
| 427 * Expand all @include at the top-level the ruleset(s) associated with the | 427 * Expand all @include at the top-level the ruleset(s) associated with the |
| 428 * mixin. | 428 * mixin. |
| 429 */ | 429 */ |
| 430 class TopLevelIncludes extends Visitor { | 430 class TopLevelIncludes extends Visitor { |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 isLastNone = false; | 1004 isLastNone = false; |
| 1005 } | 1005 } |
| 1006 } else { | 1006 } else { |
| 1007 isLastNone = simpleSeq.isCombinatorNone; | 1007 isLastNone = simpleSeq.isCombinatorNone; |
| 1008 } | 1008 } |
| 1009 } | 1009 } |
| 1010 } | 1010 } |
| 1011 super.visitSelectorGroup(node); | 1011 super.visitSelectorGroup(node); |
| 1012 } | 1012 } |
| 1013 } | 1013 } |
| OLD | NEW |