blob: 53920b97452473811cacd20af6b64571053ad83e [file] [log] [blame]
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library function_ref_element;
import 'dart:html';
import 'package:polymer/polymer.dart';
import 'package:observatory/service.dart';
import 'service_ref.dart';
@CustomTag('function-ref')
class FunctionRefElement extends ServiceRefElement {
@published bool qualified = true;
FunctionRefElement.created() : super.created();
refChanged(oldValue) {
super.refChanged(oldValue);
_updateShadowDom();
}
ServiceFunction get function => ref;
void _updateShadowDom() {
clearShadowRoot();
if (ref == null) {
return;
}
if (function.isDart) {
if (qualified) {
if (function.dartOwner is ServiceFunction) {
var functionRef = new Element.tag('function-ref');
functionRef.ref = function.dartOwner;
functionRef.qualified = true;
shadowRoot.children.add(functionRef);
insertTextSpanIntoShadowRoot('.');
} else if (function.dartOwner is Class) {
var classRef = new Element.tag('class-ref');
classRef.ref = function.dartOwner;
shadowRoot.children.add(classRef);
insertTextSpanIntoShadowRoot('.');
}
}
insertLinkIntoShadowRoot(name, url, hoverText);
} else {
insertTextSpanIntoShadowRoot(name);
}
}
}