OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 source_link_element; | 5 library source_link_element; |
6 | 6 |
7 import 'dart:html'; | 7 import 'dart:html'; |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'package:observatory/models.dart' | 9 import 'package:observatory/models.dart' |
10 show IsolateRef, SourceLocation, Script, ScriptRepository; | 10 show IsolateRef, SourceLocation, Script, ScriptRepository; |
11 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 11 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
12 import 'package:observatory/src/elements/helpers/tag.dart'; | 12 import 'package:observatory/src/elements/helpers/tag.dart'; |
13 import 'package:observatory/src/elements/helpers/uris.dart'; | 13 import 'package:observatory/src/elements/helpers/uris.dart'; |
14 | 14 |
15 class SourceLinkElement extends HtmlElement implements Renderable { | 15 class SourceLinkElement extends HtmlElement implements Renderable { |
16 static const tag = const Tag<SourceLinkElement>('source-link'); | 16 static const tag = const Tag<SourceLinkElement>('source-link'); |
17 | 17 |
18 RenderingScheduler _r; | 18 RenderingScheduler _r; |
19 | 19 |
20 Stream<RenderedEvent<SourceLinkElement>> get onRendered => _r.onRendered; | 20 Stream<RenderedEvent<SourceLinkElement>> get onRendered => _r.onRendered; |
21 | 21 |
22 IsolateRef _isolate; | 22 IsolateRef _isolate; |
23 SourceLocation _location; | 23 SourceLocation _location; |
24 Script _script; | 24 Script _script; |
25 ScriptRepository _repository; | 25 ScriptRepository _repository; |
26 | 26 |
27 IsolateRef get isolate => _isolate; | 27 IsolateRef get isolate => _isolate; |
28 SourceLocation get location => _location; | 28 SourceLocation get location => _location; |
29 | 29 |
30 factory SourceLinkElement(IsolateRef isolate, SourceLocation location, | 30 factory SourceLinkElement( |
31 ScriptRepository repository, {RenderingQueue queue}) { | 31 IsolateRef isolate, SourceLocation location, ScriptRepository repository, |
| 32 {RenderingQueue queue}) { |
32 assert(isolate != null); | 33 assert(isolate != null); |
33 assert(location != null); | 34 assert(location != null); |
34 SourceLinkElement e = document.createElement(tag.name); | 35 SourceLinkElement e = document.createElement(tag.name); |
35 e._r = new RenderingScheduler(e, queue: queue); | 36 e._r = new RenderingScheduler(e, queue: queue); |
36 e._isolate = isolate; | 37 e._isolate = isolate; |
37 e._location = location; | 38 e._location = location; |
38 e._repository = repository; | 39 e._repository = repository; |
39 return e; | 40 return e; |
40 } | 41 } |
41 | 42 |
(...skipping 26 matching lines...) Expand all Loading... |
68 int column = _script.tokenToCol(token); | 69 int column = _script.tokenToCol(token); |
69 children = [ | 70 children = [ |
70 new AnchorElement( | 71 new AnchorElement( |
71 href: Uris.inspect(isolate, object: _script, pos: token)) | 72 href: Uris.inspect(isolate, object: _script, pos: token)) |
72 ..title = _script.uri | 73 ..title = _script.uri |
73 ..text = '${label}:${line}:${column}' | 74 ..text = '${label}:${line}:${column}' |
74 ]; | 75 ]; |
75 } | 76 } |
76 } | 77 } |
77 } | 78 } |
OLD | NEW |