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

Side by Side Diff: lib/src/html_css_fixup.dart

Issue 49223002: fix webui for sdk 0.8.7 (Closed) Base URL: git@github.com:dart-lang/web-ui.git@master
Patch Set: 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
« no previous file with comments | « lib/src/compiler.dart ('k') | lib/src/messages.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 library html_css_fixup; 5 library html_css_fixup;
6 6
7 import 'dart:json' as json; 7 import 'dart:convert';
8 8
9 import 'package:csslib/parser.dart' as css; 9 import 'package:csslib/parser.dart' as css;
10 import 'package:csslib/visitor.dart'; 10 import 'package:csslib/visitor.dart';
11 import 'package:html5lib/dom.dart'; 11 import 'package:html5lib/dom.dart';
12 import 'package:html5lib/dom_parsing.dart'; 12 import 'package:html5lib/dom_parsing.dart';
13 13
14 import 'compiler.dart'; 14 import 'compiler.dart';
15 import 'emitters.dart'; 15 import 'emitters.dart';
16 import 'info.dart'; 16 import 'info.dart';
17 import 'messages.dart'; 17 import 'messages.dart';
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 */ 97 */
98 String createCssSelectorsExpression(ComponentInfo info, bool mangled) { 98 String createCssSelectorsExpression(ComponentInfo info, bool mangled) {
99 var cssVisited = new IdClassVisitor(); 99 var cssVisited = new IdClassVisitor();
100 100
101 // For components only 1 stylesheet allowed. 101 // For components only 1 stylesheet allowed.
102 if (!info.styleSheets.isEmpty && info.styleSheets.length == 1) { 102 if (!info.styleSheets.isEmpty && info.styleSheets.length == 1) {
103 var styleSheet = info.styleSheets[0]; 103 var styleSheet = info.styleSheets[0];
104 cssVisited..visitTree(styleSheet); 104 cssVisited..visitTree(styleSheet);
105 } 105 }
106 106
107 return json.stringify(_createCssSimpleSelectors(cssVisited, info, mangled)); 107 return JSON.encode(_createCssSimpleSelectors(cssVisited, info, mangled));
108 } 108 }
109 109
110 // TODO(terry): Need to handle other selectors than IDs/classes like tag name 110 // TODO(terry): Need to handle other selectors than IDs/classes like tag name
111 // e.g., DIV { color: red; } 111 // e.g., DIV { color: red; }
112 // TODO(terry): Would be nice if we didn't need to mangle names; requires users 112 // TODO(terry): Would be nice if we didn't need to mangle names; requires users
113 // to be careful in their code and makes it more than a "polyfill". 113 // to be careful in their code and makes it more than a "polyfill".
114 // Maybe mechanism that generates CSS class name for scoping. This 114 // Maybe mechanism that generates CSS class name for scoping. This
115 // would solve tag name selectors (see above TODO). 115 // would solve tag name selectors (see above TODO).
116 /** 116 /**
117 * Fix a component's HTML to implement scoped stylesheets. 117 * Fix a component's HTML to implement scoped stylesheets.
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 566
567 // Find all imports return list of @imports in this style tag. 567 // Find all imports return list of @imports in this style tag.
568 var urlInfos = findImportsInStyleSheet(styleSheet, _packageRoot, 568 var urlInfos = findImportsInStyleSheet(styleSheet, _packageRoot,
569 _inputUrl, _messages); 569 _inputUrl, _messages);
570 imports.addAll(urlInfos); 570 imports.addAll(urlInfos);
571 } 571 }
572 } 572 }
573 super.visitElement(node); 573 super.visitElement(node);
574 } 574 }
575 } 575 }
OLDNEW
« no previous file with comments | « lib/src/compiler.dart ('k') | lib/src/messages.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698