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

Side by Side Diff: runtime/observatory/lib/src/elements/library_ref_wrapper.dart

Issue 2204973003: Converted Observatory class-ref & library-ref elements (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fixed indentation Created 4 years, 4 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
OLDNEW
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 import 'dart:html'; 5 import 'dart:html';
6 6
7 import 'package:observatory/app.dart'; 7 import 'package:observatory/app.dart';
8 import 'package:observatory/service_html.dart' show Code; 8 import 'package:observatory/service_html.dart' show Library;
9 import 'package:observatory/src/elements/code_ref.dart'; 9 import 'package:observatory/src/elements/library_ref.dart';
10 import 'package:observatory/src/elements/helpers/tag.dart'; 10 import 'package:observatory/src/elements/helpers/tag.dart';
11 import 'package:observatory/src/elements/shims/binding.dart'; 11 import 'package:observatory/src/elements/shims/binding.dart';
12 12
13 @bindable 13 @bindable
14 class CodeRefElementWrapper extends HtmlElement { 14 class LibraryRefElementWrapper extends HtmlElement {
15 15
16 static const binder = const Binder<CodeRefElementWrapper>(const { 16 static const binder = const Binder<LibraryRefElementWrapper>(const {
17 'ref': #ref 17 'ref': #ref
18 }); 18 });
19 19
20 static const tag = const Tag<CodeRefElementWrapper>('code-ref'); 20 static const tag = const Tag<LibraryRefElementWrapper>('library-ref');
21 21
22 Code _code; 22 Library _library;
23 Code get ref => _code; 23 Library get ref => _library;
24 void set ref(Code ref) { _code = ref; render(); } 24 void set ref(Library ref) { _library = ref; render(); }
25 25
26 CodeRefElementWrapper.created() : super.created() { 26 LibraryRefElementWrapper.created() : super.created() {
27 binder.registerCallback(this); 27 binder.registerCallback(this);
28 createShadowRoot(); 28 createShadowRoot();
29 render(); 29 render();
30 } 30 }
31 31
32 @override 32 @override
33 void attached() { 33 void attached() {
34 super.attached(); 34 super.attached();
35 render(); 35 render();
36 } 36 }
37 37
38 void render() { 38 void render() {
39 shadowRoot.children = []; 39 shadowRoot.children = [];
40 if (ref == null) return; 40 if (ref == null) return;
41 41
42 shadowRoot.children = [ 42 shadowRoot.children = [
43 new StyleElement() 43 new StyleElement()
44 ..text = ''' 44 ..text = '''
45 code-ref-wrapped > a[href]:hover { 45 library-ref-wrapped > a[href]:hover {
46 text-decoration: underline; 46 text-decoration: underline;
47 } 47 }
48 code-ref-wrapped > a[href] { 48 library-ref-wrapped > a[href] {
49 color: #0489c3; 49 color: #0489c3;
50 text-decoration: none; 50 text-decoration: none;
51 }''', 51 }''',
52 new CodeRefElement(_code.isolate, _code, 52 new LibraryRefElement(_library.isolate, _library,
53 queue: ObservatoryApplication.app.queue) 53 queue: ObservatoryApplication.app.queue)
54 ]; 54 ];
55 } 55 }
56 } 56 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/library_ref_as_value.html ('k') | runtime/observatory/lib/src/elements/library_view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698