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

Unified Diff: lib/src/analyzer.dart

Issue 12474002: Support for parsing all CSS and producing one CSS file (Closed) Base URL: https://github.com/dart-lang/web-ui.git@master
Patch Set: merged Created 7 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/src/compiler.dart » ('j') | lib/src/compiler.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/analyzer.dart
diff --git a/lib/src/analyzer.dart b/lib/src/analyzer.dart
index 19ffc292325230173b7aa37592be0ce21c388b41..e29f08897c6e70feda82819e08b5217c3340a2ec 100644
--- a/lib/src/analyzer.dart
+++ b/lib/src/analyzer.dart
@@ -8,6 +8,7 @@
*/
library analyzer;
+import 'dart:uri';
import 'package:html5lib/dom.dart';
import 'package:html5lib/dom_parsing.dart';
import 'package:source_maps/span.dart';
@@ -119,18 +120,6 @@ class _Analyzer extends TreeVisitor {
info = new ElementInfo(node, parent);
}
- // TODO(terry): How to handle <link rel="stylesheet" href="...">
- // - What if multiple stylesheet links for a component?
- // - What if a stylesheet link for all component and particular
- // stylesheet links for each component?
- // - What if multiple <style> tags for the same component?
- if (node.tagName == 'style' && node.attributes.containsKey("scoped")) {
- // TODO(terry): Faster to parse the CSS tags separately instead of
- // concatenating all styles.
- // Get contents of style tag.
- _currentInfo.cssSource.write(node.nodes.single.value);
- }
-
visitElementInfo(info);
if (_parent == null) {
@@ -738,7 +727,7 @@ class _ElementLoader extends TreeVisitor {
void visitLinkElement(Element node) {
// TODO(jmesserly): deprecate the plural form, it is singular in the spec.
var rel = node.attributes['rel'];
- if (rel != 'component' && rel != 'components') return;
+ if (rel != 'components' && rel != 'stylesheet') return;
Siggi Cherem (dart-lang) 2013/03/07 22:14:20 there seems to be a bad merge here. this should al
terry 2013/03/08 20:11:24 Nice catch yeah it was a bad merge. On 2013/03/07
if (!_inHead) {
_messages.warning('link rel="$rel" only valid in '
@@ -760,7 +749,18 @@ class _ElementLoader extends TreeVisitor {
path = _fileInfo.path.directoryPath.join(new Path(href));
}
- _fileInfo.componentLinks.add(path);
+ switch (rel) {
+ case 'components':
Siggi Cherem (dart-lang) 2013/03/07 22:14:20 given that there are only two options (since you r
terry 2013/03/08 20:11:24 Done.
+ _fileInfo.componentLinks.add(path);
+ break;
+ case 'stylesheet':
+ // Local stylesheets only are handled.
+ var scheme = Uri.parse(href).scheme;
+ if (scheme != 'http' && scheme != 'https') {
+ _fileInfo.styleSheetHref.add(path);
+ }
+ break;
+ }
}
void visitElementElement(Element node) {
« no previous file with comments | « no previous file | lib/src/compiler.dart » ('j') | lib/src/compiler.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698