| OLD | NEW |
| 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 trydart.editor; | 5 library trydart.editor; |
| 6 | 6 |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 | 8 |
| 9 import 'package:compiler/implementation/scanner/scannerlib.dart' | 9 import 'package:compiler/implementation/scanner/scannerlib.dart' |
| 10 show | 10 show |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 int type = anchorNode.nodeType; | 113 int type = anchorNode.nodeType; |
| 114 if (type != Node.TEXT_NODE) return null; | 114 if (type != Node.TEXT_NODE) return null; |
| 115 Text text = anchorNode; | 115 Text text = anchorNode; |
| 116 var parent = text.parent; | 116 var parent = text.parent; |
| 117 if (parent is! Element) return null; | 117 if (parent is! Element) return null; |
| 118 if (mainEditorPane == parent) return null; | 118 if (mainEditorPane == parent) return null; |
| 119 return parent; | 119 return parent; |
| 120 } | 120 } |
| 121 | 121 |
| 122 bool isMalformedInput = false; | 122 bool isMalformedInput = false; |
| 123 String currentSource = ""; | |
| 124 | 123 |
| 125 addDiagnostic(String kind, String message, int begin, int end) { | 124 addDiagnostic(String kind, String message, int begin, int end) { |
| 126 observer.disconnect(); | 125 observer.disconnect(); |
| 127 Selection selection = window.getSelection(); | 126 Selection selection = window.getSelection(); |
| 128 int offset = 0; | 127 int offset = 0; |
| 129 int anchorOffset = 0; | 128 int anchorOffset = 0; |
| 130 bool hasSelection = false; | 129 bool hasSelection = false; |
| 131 Node anchorNode = selection.anchorNode; | 130 Node anchorNode = selection.anchorNode; |
| 132 bool foundNode = false; | 131 bool foundNode = false; |
| 133 void walk4(Node node) { | 132 void walk4(Node node) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 | 218 |
| 220 diagnostic(text, tip) { | 219 diagnostic(text, tip) { |
| 221 if (text is String) { | 220 if (text is String) { |
| 222 text = new Text(text); | 221 text = new Text(text); |
| 223 } | 222 } |
| 224 return new AnchorElement() | 223 return new AnchorElement() |
| 225 ..classes.add('diagnostic') | 224 ..classes.add('diagnostic') |
| 226 ..append(text) | 225 ..append(text) |
| 227 ..append(tip); | 226 ..append(tip); |
| 228 } | 227 } |
| OLD | NEW |