| 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' show | 9 import 'package:compiler/implementation/scanner/scannerlib.dart' show |
| 10 EOF_TOKEN, | 10 EOF_TOKEN, |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 hasSelection = node == anchorNode; | 154 hasSelection = node == anchorNode; |
| 155 anchorOffset = selection.anchorOffset; | 155 anchorOffset = selection.anchorOffset; |
| 156 var alert; | 156 var alert; |
| 157 if (kind == 'error') { | 157 if (kind == 'error') { |
| 158 alert = error(message); | 158 alert = error(message); |
| 159 } else if (kind == 'warning') { | 159 } else if (kind == 'warning') { |
| 160 alert = warning(message); | 160 alert = warning(message); |
| 161 } else { | 161 } else { |
| 162 alert = info(message); | 162 alert = info(message); |
| 163 } | 163 } |
| 164 Element parent = node.parent; | 164 Element parent = node.parentNode; |
| 165 if (parent.classes.contains("diagnostic") && | 165 if (parent.classes.contains("diagnostic") && |
| 166 !interaction.oldDiagnostics.contains(parent)) { | 166 !interaction.oldDiagnostics.contains(parent)) { |
| 167 Element other = parent.firstChild; | 167 Element other = parent.firstChild; |
| 168 other.remove(); | 168 other.remove(); |
| 169 SpanElement wrapper = new SpanElement(); | 169 SpanElement wrapper = new SpanElement() |
| 170 wrapper.style | 170 ..classes.add('diagnostic') |
| 171 ..fontWeight = 'normal'; | 171 ..style.fontWeight = 'normal'; |
| 172 |
| 172 var root = getShadowRoot(wrapper); | 173 var root = getShadowRoot(wrapper); |
| 173 if (root is ShadowRoot) { | 174 if (root is ShadowRoot) { |
| 174 // When https://code.google.com/p/chromium/issues/detail?id=313458 | 175 // When https://code.google.com/p/chromium/issues/detail?id=313458 |
| 175 // is fixed: | 176 // is fixed: |
| 176 // var link = new LinkElement() | 177 // var link = new LinkElement() |
| 177 // ..rel = "stylesheet" | 178 // ..rel = "stylesheet" |
| 178 // ..type = "text/css" | 179 // ..type = "text/css" |
| 179 // ..href = "dartlang-style.css"; | 180 // ..href = "dartlang-style.css"; |
| 180 // root.append(link); | 181 // root.append(link); |
| 181 root.append( | 182 root.append( |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 content = new Text(content); | 267 content = new Text(content); |
| 267 } | 268 } |
| 268 if (content is! List) { | 269 if (content is! List) { |
| 269 content = [content]; | 270 content = [content]; |
| 270 } | 271 } |
| 271 return new AnchorElement() | 272 return new AnchorElement() |
| 272 ..classes.add('diagnostic') | 273 ..classes.add('diagnostic') |
| 273 ..append(tip) // Should be first for better Firefox editing. | 274 ..append(tip) // Should be first for better Firefox editing. |
| 274 ..nodes.addAll(content); | 275 ..nodes.addAll(content); |
| 275 } | 276 } |
| OLD | NEW |