Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: pkg/csslib/lib/src/css_printer.dart

Issue 64373003: pkg/csslib: types, fixes, cleanup (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: more Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/csslib/bin/css.dart ('k') | pkg/csslib/lib/src/tree.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /** 7 /**
8 * Visitor that produces a formatted string representation of the CSS tree. 8 * Visitor that produces a formatted string representation of the CSS tree.
9 */ 9 */
10 class CssPrinter extends Visitor { 10 class CssPrinter extends Visitor {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // url(...) isn't needed only a URI can follow an @import directive; emit 130 // url(...) isn't needed only a URI can follow an @import directive; emit
131 // url as a string. 131 // url as a string.
132 emit(' @import "${node.import}"'); 132 emit(' @import "${node.import}"');
133 } 133 }
134 emitMediaQueries(node.mediaQueries); 134 emitMediaQueries(node.mediaQueries);
135 emit(';'); 135 emit(';');
136 } 136 }
137 137
138 void visitKeyFrameDirective(KeyFrameDirective node) { 138 void visitKeyFrameDirective(KeyFrameDirective node) {
139 emit('$_newLine${node.keyFrameName} '); 139 emit('$_newLine${node.keyFrameName} ');
140 node._name.visit(this); 140 node.name.visit(this);
141 emit('$_sp{$_newLine'); 141 emit('$_sp{$_newLine');
142 for (final block in node._blocks) { 142 for (final block in node._blocks) {
143 block.visit(this); 143 block.visit(this);
144 } 144 }
145 emit('}'); 145 emit('}');
146 } 146 }
147 147
148 void visitFontFaceDirective(FontFaceDirective node) { 148 void visitFontFaceDirective(FontFaceDirective node) {
149 emit('$_newLine@font-face '); 149 emit('$_newLine@font-face ');
150 emit('$_sp{$_newLine'); 150 emit('$_sp{$_newLine');
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 267
268 void visitExtendDeclaration(ExtendDeclaration node) { 268 void visitExtendDeclaration(ExtendDeclaration node) {
269 emit("@extend "); 269 emit("@extend ");
270 for (var selector in node.selectors) { 270 for (var selector in node.selectors) {
271 selector.visit(this); 271 selector.visit(this);
272 } 272 }
273 } 273 }
274 274
275 275
276 void visitSelectorGroup(SelectorGroup node) { 276 void visitSelectorGroup(SelectorGroup node) {
277 var selectors = node._selectors; 277 var selectors = node.selectors;
278 var selectorsLength = selectors.length; 278 var selectorsLength = selectors.length;
279 for (var i = 0; i < selectorsLength; i++) { 279 for (var i = 0; i < selectorsLength; i++) {
280 if (i > 0) emit(',$_sp'); 280 if (i > 0) emit(',$_sp');
281 selectors[i].visit(this); 281 selectors[i].visit(this);
282 } 282 }
283 } 283 }
284 284
285 void visitSimpleSelectorSequence(SimpleSelectorSequence node) { 285 void visitSimpleSelectorSequence(SimpleSelectorSequence node) {
286 emit('${node._combinatorToString}'); 286 emit('${node._combinatorToString}');
287 node._selector.visit(this); 287 node.simpleSelector.visit(this);
288 } 288 }
289 289
290 void visitSimpleSelector(SimpleSelector node) { 290 void visitSimpleSelector(SimpleSelector node) {
291 emit(node.name); 291 emit(node.name);
292 } 292 }
293 293
294 void visitNamespaceSelector(NamespaceSelector node) { 294 void visitNamespaceSelector(NamespaceSelector node) {
295 emit(node.toString()); 295 emit(node.toString());
296 } 296 }
297 297
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 508
509 void visitWildcard(Wildcard node) { 509 void visitWildcard(Wildcard node) {
510 emit('*'); 510 emit('*');
511 } 511 }
512 512
513 void visitDartStyleExpression(DartStyleExpression node) { 513 void visitDartStyleExpression(DartStyleExpression node) {
514 // TODO(terry): TBD 514 // TODO(terry): TBD
515 throw UnimplementedError; 515 throw UnimplementedError;
516 } 516 }
517 } 517 }
OLDNEW
« no previous file with comments | « pkg/csslib/bin/css.dart ('k') | pkg/csslib/lib/src/tree.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698