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

Unified Diff: runtime/observatory/lib/src/elements/curly_block.dart

Issue 2310003004: Removed polymer & mirror from Observatory (Closed)
Patch Set: Fixed crash in heap-map page Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/lib/src/elements/curly_block.dart
diff --git a/runtime/observatory/lib/src/elements/curly_block.dart b/runtime/observatory/lib/src/elements/curly_block.dart
index 9eadd76e67e9c8e3312ae55041688a65e47d7cd7..54e0d3f685d9ec94b762bc4dfa8078f1353746d2 100644
--- a/runtime/observatory/lib/src/elements/curly_block.dart
+++ b/runtime/observatory/lib/src/elements/curly_block.dart
@@ -16,20 +16,7 @@ class CurlyBlockToggleEvent {
}
class CurlyBlockElement extends HtmlElement implements Renderable {
- static final StyleElement _style = () {
- var style = new StyleElement();
- style.text = '''span.curly-block {
- color: #0489c3;
- cursor: pointer;
- }
- span.curly-block.disabled {
- color: white;
- cursor: wait;
- }''';
- return style;
- }();
-
- static const tag = const Tag<CurlyBlockElement>('curly-block-wrapped');
+ static const tag = const Tag<CurlyBlockElement>('curly-block');
RenderingScheduler<CurlyBlockElement> _r;
@@ -40,14 +27,21 @@ class CurlyBlockElement extends HtmlElement implements Renderable {
bool _expanded;
bool _disabled;
+ Iterable<Element> _content = const [];
bool get expanded => _expanded;
+ bool get disabled => _disabled;
+ Iterable<Element> get content => _content;
+
set expanded(bool value) {
if (_expanded != value) _onToggle.add(new CurlyBlockToggleEvent(this));
_expanded = _r.checkAndReact(_expanded, value);
}
- bool get disabled => _disabled;
set disabled(bool value) => _disabled = _r.checkAndReact(_disabled, value);
+ set content(Iterable<Element> value) {
+ _content = value.toList();
+ _r.dirty();
+ }
factory CurlyBlockElement({bool expanded: false, bool disabled: false,
RenderingQueue queue}) {
@@ -57,10 +51,11 @@ class CurlyBlockElement extends HtmlElement implements Renderable {
e._r = new RenderingScheduler(e, queue: queue);
e._expanded = expanded;
e._disabled = disabled;
+ e._r.enable();
return e;
}
- CurlyBlockElement.created() : super.created() { createShadowRoot(); }
+ CurlyBlockElement.created() : super.created();
@override
void attached() { super.attached(); _r.enable(); }
@@ -68,7 +63,7 @@ class CurlyBlockElement extends HtmlElement implements Renderable {
@override
void detached() {
super.detached(); _r.disable(notify: true);
- shadowRoot.children = [];
+ children = [];
}
void toggle() {
@@ -80,8 +75,7 @@ class CurlyBlockElement extends HtmlElement implements Renderable {
}
void render() {
- List<Element> children = [
- _style.clone(true),
+ List<Element> content = [
new SpanElement()..text = '{'
];
SpanElement label = new SpanElement()
@@ -89,19 +83,17 @@ class CurlyBlockElement extends HtmlElement implements Renderable {
..innerHtml = expanded ?
'&nbsp;&nbsp;&#8863;&nbsp;&nbsp;' : '&nbsp;&nbsp;&#8862;&nbsp;&nbsp;';
if (disabled) {
- children.add(label);
+ content.add(label);
} else {
- children.add(new AnchorElement()
+ content.add(new AnchorElement()
..onClick.listen((_) { toggle(); })
..children = [label]);
}
if (expanded) {
- children.addAll([
- new BRElement(),
- new ContentElement()
- ]);
+ content.add(new BRElement());
+ content.addAll(_content);
}
- children.add(new SpanElement()..text = '}');
- shadowRoot.children = children;
+ content.add(new SpanElement()..text = '}');
+ children = content;
}
}
« no previous file with comments | « runtime/observatory/lib/src/elements/css/shared.css ('k') | runtime/observatory/lib/src/elements/curly_block_wrapper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698