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

Side by Side Diff: utils/css/uitest.dart

Issue 9695048: Template parser (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix GIT mixup - ugh Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 #import('dart:html'); 5 #import('dart:html');
6 #import('css.dart'); 6 #import('css.dart');
7 #import('../../frog/lang.dart', prefix:'lang');
8 #import('../../frog/file_system_memory.dart'); 7 #import('../../frog/file_system_memory.dart');
9 8
9 // TODO(terry): Remove use for debug only.
Siggi Cherem (dart-lang) 2012/03/15 01:21:25 agree (and the call in line 50)
terry 2012/03/15 19:02:49 Done.
10 void debugger() {
11 try {
12 throw "DEBUG";
13 } catch (var e) {
14 print("DEBUGBREAK");
15 }
16 }
17
10 void runCss([bool debug = false, bool parseOnly = false]) { 18 void runCss([bool debug = false, bool parseOnly = false]) {
11 final Document doc = window.document; 19 final Document doc = window.document;
12 final TextAreaElement classes = doc.query("#classes"); 20 final TextAreaElement classes = doc.query("#classes");
13 final TextAreaElement expression = doc.query('#expression'); 21 final TextAreaElement expression = doc.query('#expression');
14 final TableCellElement validity = doc.query('#validity'); 22 final TableCellElement validity = doc.query('#validity');
15 final TableCellElement result = doc.query('#result'); 23 final TableCellElement result = doc.query('#result');
16 24
17 List<String> knownWorld = classes.value.split("\n"); 25 List<String> knownWorld = classes.value.split("\n");
18 List<String> knownClasses = []; 26 List<String> knownClasses = [];
19 List<String> knownIds = []; 27 List<String> knownIds = [];
(...skipping 12 matching lines...) Expand all
32 String cssExpr = expression.value; 40 String cssExpr = expression.value;
33 if (!debug) { 41 if (!debug) {
34 try { 42 try {
35 cssParseAndValidate(cssExpr, cssWorld); 43 cssParseAndValidate(cssExpr, cssWorld);
36 } catch (final cssException) { 44 } catch (final cssException) {
37 templateValid = false; 45 templateValid = false;
38 dumpTree = cssException.toString(); 46 dumpTree = cssException.toString();
39 } 47 }
40 } else if (parseOnly) { 48 } else if (parseOnly) {
41 try { 49 try {
42 Parser parser = new Parser(new lang.SourceFile( 50 debugger();
43 lang.SourceFile.IN_MEMORY_FILE, cssExpr)); 51 Parser parser = new Parser(new SourceFile(
52 SourceFile.IN_MEMORY_FILE, cssExpr));
44 Stylesheet stylesheet = parser.parse(); 53 Stylesheet stylesheet = parser.parse();
45 StringBuffer stylesheetTree = new StringBuffer(); 54 StringBuffer stylesheetTree = new StringBuffer();
46 String prettyStylesheet = stylesheet.toString(); 55 String prettyStylesheet = stylesheet.toString();
47 stylesheetTree.add("${prettyStylesheet}\n"); 56 stylesheetTree.add("${prettyStylesheet}\n");
48 stylesheetTree.add("\n============>Tree Dump<============\n"); 57 stylesheetTree.add("\n============>Tree Dump<============\n");
49 stylesheetTree.add(stylesheet.toDebugString()); 58 stylesheetTree.add(stylesheet.toDebugString());
50 dumpTree = stylesheetTree.toString(); 59 dumpTree = stylesheetTree.toString();
51 } catch (final cssParseException) { 60 } catch (final cssParseException) {
52 templateValid = false; 61 templateValid = false;
53 dumpTree = cssParseException.toString(); 62 dumpTree = cssParseException.toString();
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 document.body.style.setProperty("background-color", "lightgray"); 184 document.body.style.setProperty("background-color", "lightgray");
176 document.body.elements.add(element); 185 document.body.elements.add(element);
177 186
178 // TODO(terry): Needed so runCss isn't shakened out. 187 // TODO(terry): Needed so runCss isn't shakened out.
179 if (false) { 188 if (false) {
180 runCss(); 189 runCss();
181 } 190 }
182 191
183 initCssWorld(false); 192 initCssWorld(false);
184 } 193 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698