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

Unified Diff: utils/css/generate.dart

Issue 137013002: Removed obsolete code (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed libraries not used Created 6 years, 11 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 | « utils/css/cssworld.dart ('k') | utils/css/parser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/css/generate.dart
diff --git a/utils/css/generate.dart b/utils/css/generate.dart
deleted file mode 100644
index 2d248451ac2c07ca950962fa0ac457de29aaac26..0000000000000000000000000000000000000000
--- a/utils/css/generate.dart
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-class Generate {
-
- // Build up list of all known class selectors in all CSS files.
- static List<String> computeClassSelectors(RuleSet ruleset, classes) {
- for (final selector in ruleset.selectorGroup.selectors) {
- var selSeqs = selector.simpleSelectorSequences;
- for (final selSeq in selSeqs) {
- var simpleSelector = selSeq.simpleSelector;
- if (simpleSelector is ClassSelector) {
- String className = simpleSelector.name;
- if (classes.indexOf(className) == -1) { // Class name already known?
- // No, expose it.
- classes.add(className);
- }
- }
- }
- }
-
- return classes;
- }
-
- static dartClass(var files, String outPath, Stylesheet stylesheet,
- String filename) {
-
- List<String> knownClasses = [];
-
- StringBuffer buff = new StringBuffer(
- '// File generated by Dart CSS from source file ${filename}\n' +
- '// Do not edit.\n\n');
-
- // Emit class for any @stylet directive.
- for (final production in stylesheet._topLevels) {
- if (production is Directive) {
- if (production is StyletDirective) {
- // TODO(terry): Need safer mechanism for stylets in different files
- // and stylets with colliding names.
- buff.write('class ${production.dartClassName} {\n');
- buff.write(' // selector, properties<propertyName, value>\n');
- buff.write(' static const selectors = const {\n');
-
- for (final ruleset in production.rulesets) {
- for (final selector in ruleset.selectorGroup.selectors) {
- var selSeq = selector.simpleSelectorSquences;
- if (selSeq.length == 1) {
- buff.write(' \'${selSeq.toString()}\' : const {\n');
- }
- }
-
- for (final decl in ruleset.declarationGroup.declarations) {
- buff.write(' \'${decl.property}\' : ' +
- '\'${decl.expression.toString()}\',\n');
- }
- buff.write(' },\n'); // End of declarations for stylet class.
- }
- buff.write(' };\n'); // End of static selectors constant.
- buff.write('}\n\n'); // End of stylet class
- } else if (production is IncludeDirective) {
- for (final topLevel in production.styleSheet._topLevels) {
- if (topLevel is RuleSet) {
- knownClasses = computeClassSelectors(topLevel, knownClasses);
- }
- }
- }
- } else if (production is RuleSet) {
- knownClasses = computeClassSelectors(production, knownClasses);
- }
- }
-
- // Generate all known classes encountered in all processed CSS files.
- StringBuffer classSelectors = new StringBuffer(
- 'class CSS {\n' +
- ' // CSS class selectors:\n');
- for (final className in knownClasses) {
- String classAsDart = className.replaceAll('-', '_').toUpperCase();
- classSelectors.write(' static const String ${classAsDart} = ' +
- '\'${className}\';\n');
- }
- classSelectors.write('}\n'); // End of class selectors.
- buff.write(classSelectors.toString());
-
- // Write Dart file.
- String outFile = '${outPath}CSS.dart';
- files.writeString(outFile, buff.toString());
-
- return outFile;
- }
-}
-
« no previous file with comments | « utils/css/cssworld.dart ('k') | utils/css/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698