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

Unified Diff: dart/site/try/src/decoration.dart

Issue 261413002: Use ShadowRoot to hide non-user content (for example, diagnostics). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address Kasper's comments. Created 6 years, 7 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
« no previous file with comments | « dart/site/try/index.html ('k') | dart/site/try/src/editor.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/site/try/src/decoration.dart
diff --git a/dart/site/try/src/decoration.dart b/dart/site/try/src/decoration.dart
index 381057f13b6e521ba62715932256ad917905574a..930cbcbbee32fb4d0752f91e36b3c52708795b2f 100644
--- a/dart/site/try/src/decoration.dart
+++ b/dart/site/try/src/decoration.dart
@@ -6,6 +6,9 @@ library trydart.decoration;
import 'dart:html';
+import 'shadow_root.dart' show
+ setShadowRoot;
+
class Decoration {
final String color;
final bool bold;
@@ -70,35 +73,23 @@ class DiagnosticDecoration extends Decoration {
}
}
-info(text) {
- if (text is String) {
- text = new Text(text);
+createAlert(text, [String cls]) {
+ var classes = ['alert'];
+ if (cls != null) {
+ classes.add(cls);
}
- return new SpanElement()
- ..classes.addAll(['alert', 'alert-info'])
- ..style.opacity = '0.75'
- ..append(text);
+ SpanElement result = new SpanElement()
+ ..classes.addAll(classes)
+ ..style.opacity = '0.75';
+ setShadowRoot(result, text);
+ return result;
}
-error(text) {
- if (text is String) {
- text = new Text(text);
- }
- return new SpanElement()
- ..classes.addAll(['alert', 'alert-error'])
- ..style.opacity = '0.75'
- ..append(text);
-}
+info(text) => createAlert(text, 'alert-info');
-warning(text) {
- if (text is String) {
- text = new Text(text);
- }
- return new SpanElement()
- ..classes.add('alert')
- ..style.opacity = '0.75'
- ..append(text);
-}
+error(text) => createAlert(text, 'alert-error');
+
+warning(text) => createAlert(text);
class CodeCompletionDecoration extends Decoration {
const CodeCompletionDecoration(
« no previous file with comments | « dart/site/try/index.html ('k') | dart/site/try/src/editor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698