OLD | NEW |
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 '../lib/file_system_memory.dart'; | 7 import '../lib/file_system_memory.dart'; |
8 | 8 |
9 void runCss([bool debug = false, bool parseOnly = false]) { | 9 void runCss([bool debug = false, bool parseOnly = false]) { |
10 final Document doc = window.document; | 10 final Document doc = window.document; |
(...skipping 25 matching lines...) Expand all Loading... |
36 templateValid = false; | 36 templateValid = false; |
37 dumpTree = cssException.toString(); | 37 dumpTree = cssException.toString(); |
38 } | 38 } |
39 } else if (parseOnly) { | 39 } else if (parseOnly) { |
40 try { | 40 try { |
41 Parser parser = new Parser(new SourceFile( | 41 Parser parser = new Parser(new SourceFile( |
42 SourceFile.IN_MEMORY_FILE, cssExpr)); | 42 SourceFile.IN_MEMORY_FILE, cssExpr)); |
43 Stylesheet stylesheet = parser.parse(); | 43 Stylesheet stylesheet = parser.parse(); |
44 StringBuffer stylesheetTree = new StringBuffer(); | 44 StringBuffer stylesheetTree = new StringBuffer(); |
45 String prettyStylesheet = stylesheet.toString(); | 45 String prettyStylesheet = stylesheet.toString(); |
46 stylesheetTree.add("${prettyStylesheet}\n"); | 46 stylesheetTree.write("${prettyStylesheet}\n"); |
47 stylesheetTree.add("\n============>Tree Dump<============\n"); | 47 stylesheetTree.write("\n============>Tree Dump<============\n"); |
48 stylesheetTree.add(stylesheet.toDebugString()); | 48 stylesheetTree.write(stylesheet.toDebugString()); |
49 dumpTree = stylesheetTree.toString(); | 49 dumpTree = stylesheetTree.toString(); |
50 } catch (cssParseException) { | 50 } catch (cssParseException) { |
51 templateValid = false; | 51 templateValid = false; |
52 dumpTree = cssParseException.toString(); | 52 dumpTree = cssParseException.toString(); |
53 } | 53 } |
54 } else { | 54 } else { |
55 try { | 55 try { |
56 dumpTree = cssParseAndValidateDebug(cssExpr, cssWorld); | 56 dumpTree = cssParseAndValidateDebug(cssExpr, cssWorld); |
57 } catch (cssException) { | 57 } catch (cssException) { |
58 templateValid = false; | 58 templateValid = false; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 runCss(); | 182 runCss(); |
183 }); | 183 }); |
184 | 184 |
185 ButtonElement debugButton = window.document.query('#debug'); | 185 ButtonElement debugButton = window.document.query('#debug'); |
186 debugButton.on.click.add((MouseEvent e) { | 186 debugButton.on.click.add((MouseEvent e) { |
187 runCss(true); | 187 runCss(true); |
188 }); | 188 }); |
189 | 189 |
190 initCssWorld(false); | 190 initCssWorld(false); |
191 } | 191 } |
OLD | NEW |