| 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 function_ref_element; | 5 library function_ref_element; |
| 6 | 6 |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 import 'package:polymer/polymer.dart'; | 8 import 'package:polymer/polymer.dart'; |
| 9 import 'package:observatory/service.dart'; | 9 import 'package:observatory/service.dart'; |
| 10 import 'service_ref.dart'; | 10 import 'service_ref.dart'; |
| 11 | 11 |
| 12 @CustomTag('function-ref') | 12 @CustomTag('function-ref') |
| 13 class FunctionRefElement extends ServiceRefElement { | 13 class FunctionRefElement extends ServiceRefElement { |
| 14 @published bool qualified = true; | 14 @published bool qualified = true; |
| 15 | 15 |
| 16 FunctionRefElement.created() : super.created(); | 16 FunctionRefElement.created() : super.created(); |
| 17 | 17 |
| 18 refChanged(oldValue) { | 18 refChanged(oldValue) { |
| 19 super.refChanged(oldValue); | 19 super.refChanged(oldValue); |
| 20 _updateShadowDom(); | 20 _updateShadowDom(); |
| 21 } | 21 } |
| 22 | 22 |
| 23 ServiceFunction get function => ref; | 23 ServiceFunction get function => ref; |
| 24 void _updateShadowDom() { | 24 void _updateShadowDom() { |
| 25 clearShadowRoot(); | 25 clearShadowRoot(); |
| 26 if (ref == null) { | 26 if (ref == null) { |
| 27 return; | 27 return; |
| 28 } | 28 } |
| 29 if (function.isDart) { | 29 if (qualified) { |
| 30 if (qualified) { | 30 if (function.dartOwner is ServiceFunction) { |
| 31 if (function.dartOwner is ServiceFunction) { | 31 var functionRef = new Element.tag('function-ref'); |
| 32 var functionRef = new Element.tag('function-ref'); | 32 functionRef.ref = function.dartOwner; |
| 33 functionRef.ref = function.dartOwner; | 33 functionRef.qualified = true; |
| 34 functionRef.qualified = true; | 34 shadowRoot.children.add(functionRef); |
| 35 shadowRoot.children.add(functionRef); | 35 insertTextSpanIntoShadowRoot('.'); |
| 36 insertTextSpanIntoShadowRoot('.'); | 36 } else if (function.dartOwner is Class) { |
| 37 } else if (function.dartOwner is Class) { | 37 var classRef = new Element.tag('class-ref'); |
| 38 var classRef = new Element.tag('class-ref'); | 38 classRef.ref = function.dartOwner; |
| 39 classRef.ref = function.dartOwner; | 39 shadowRoot.children.add(classRef); |
| 40 shadowRoot.children.add(classRef); | 40 insertTextSpanIntoShadowRoot('.'); |
| 41 insertTextSpanIntoShadowRoot('.'); | |
| 42 } | |
| 43 } | 41 } |
| 44 insertLinkIntoShadowRoot(name, url, hoverText); | |
| 45 } else { | |
| 46 insertTextSpanIntoShadowRoot(name); | |
| 47 } | 42 } |
| 43 insertLinkIntoShadowRoot(name, url, hoverText); |
| 48 } | 44 } |
| 49 } | 45 } |
| OLD | NEW |