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 | 7 |
8 // TODO(terry): Add optimizing phase to remove duplicated selectors in the same | 8 // TODO(terry): Add optimizing phase to remove duplicated selectors in the same |
9 // selector group (e.g., .btn, .btn { color: red; }). Also, look | 9 // selector group (e.g., .btn, .btn { color: red; }). Also, look |
10 // at simplifying selectors expressions too (much harder). | 10 // at simplifying selectors expressions too (much harder). |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 * | 168 * |
169 * Nested rules is a terse mechanism to describe CSS inheritance. The analyzer | 169 * Nested rules is a terse mechanism to describe CSS inheritance. The analyzer |
170 * will flatten and expand the nested rules to it's flatten strucure. Using the | 170 * will flatten and expand the nested rules to it's flatten strucure. Using the |
171 * all parent [RuleSets] (selector expressions) and applying each nested | 171 * all parent [RuleSets] (selector expressions) and applying each nested |
172 * [RuleSet] to the list of [Selectors] in a [SelectorGroup]. | 172 * [RuleSet] to the list of [Selectors] in a [SelectorGroup]. |
173 * | 173 * |
174 * Then result is a style sheet where all nested rules have been flatten and | 174 * Then result is a style sheet where all nested rules have been flatten and |
175 * expanded. | 175 * expanded. |
176 */ | 176 */ |
177 class ExpandNestedSelectors extends Visitor { | 177 class ExpandNestedSelectors extends Visitor { |
178 /** Parent [RuleSet] if a nested rule otherwise [null]. */ | 178 /** Parent [RuleSet] if a nested rule otherwise [:null:]. */ |
179 RuleSet _parentRuleSet; | 179 RuleSet _parentRuleSet; |
180 | 180 |
181 /** Top-most rule if nested rules. */ | 181 /** Top-most rule if nested rules. */ |
182 SelectorGroup _topLevelSelectorGroup; | 182 SelectorGroup _topLevelSelectorGroup; |
183 | 183 |
184 /** SelectorGroup at each nesting level. */ | 184 /** SelectorGroup at each nesting level. */ |
185 SelectorGroup _nestedSelectorGroup; | 185 SelectorGroup _nestedSelectorGroup; |
186 | 186 |
187 /** Declaration (sans the nested selectors). */ | 187 /** Declaration (sans the nested selectors). */ |
188 DeclarationGroup _flatDeclarationGroup; | 188 DeclarationGroup _flatDeclarationGroup; |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 isLastNone = false; | 1008 isLastNone = false; |
1009 } | 1009 } |
1010 } else { | 1010 } else { |
1011 isLastNone = simpleSeq.isCombinatorNone; | 1011 isLastNone = simpleSeq.isCombinatorNone; |
1012 } | 1012 } |
1013 } | 1013 } |
1014 } | 1014 } |
1015 super.visitSelectorGroup(node); | 1015 super.visitSelectorGroup(node); |
1016 } | 1016 } |
1017 } | 1017 } |
OLD | NEW |