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

Side by Side Diff: runtime/bin/vmservice/client/lib/src/elements/script_inset.dart

Issue 322243002: Upgrade to polymer_expressions 0.11.1 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
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 library script_inset_element; 5 library script_inset_element;
6 6
7 import 'observatory_element.dart'; 7 import 'observatory_element.dart';
8 import 'package:observatory/service.dart'; 8 import 'package:observatory/service.dart';
9 import 'package:polymer/polymer.dart'; 9 import 'package:polymer/polymer.dart';
10 10
11 /// Box with script source code in it. 11 /// Box with script source code in it.
12 @CustomTag('script-inset') 12 @CustomTag('script-inset')
13 class ScriptInsetElement extends ObservatoryElement { 13 class ScriptInsetElement extends ObservatoryElement {
14 @published Script script; 14 @published Script script;
15 @published int pos; 15 @published int pos;
16 @published int endPos; 16 @published int endPos;
17 @published bool coverage = false; 17 @published bool coverage = false;
18 18
19 @observable List<ScriptLine> lines = toObservable([]); 19 @observable List<ScriptLine> lines = toObservable([]);
20 20
21 void scriptChanged(oldValue) { 21 void scriptChanged(oldValue) {
22 _updateProperties(); 22 _updateProperties();
23 notifyPropertyChange(#hitStyle, 0, 1); 23 notifyPropertyChange(#hitStyle, 0, 1);
24 notifyPropertyChange(#lines, 0, 1);
24 } 25 }
25 26
26 void posChanged(oldValue) { 27 void posChanged(oldValue) {
27 _updateProperties(); 28 _updateProperties();
28 } 29 }
29 30
30 coverageChanged(oldValue) { 31 coverageChanged(oldValue) {
32 _updateProperties();
31 notifyPropertyChange(#lines, 0, 1); 33 notifyPropertyChange(#lines, 0, 1);
32 notifyPropertyChange(#hitStyle, 0, 1); 34 notifyPropertyChange(#hitStyle, 0, 1);
33 } 35 }
34 36
35 static const hitStyleNone = 'min-width:32px;'; 37 static const hitStyleNone = 'min-width:32px;';
36 static const hitStyleExecuted = 'min-width:32px;background-color:green'; 38 static const hitStyleExecuted = 'min-width:32px;background-color:green';
37 static const hitStyleNotExecuted = 'min-width:32px;background-color:red'; 39 static const hitStyleNotExecuted = 'min-width:32px;background-color:red';
38 40
39 @observable String hitStyle(ScriptLine line) { 41 @observable String hitStyle(ScriptLine line) {
40 if ((script == null) || !coverage) { 42 if ((script == null) || !coverage) {
(...skipping 17 matching lines...) Expand all
58 if (script.loaded) { 60 if (script.loaded) {
59 _updateProperties(); 61 _updateProperties();
60 } 62 }
61 }); 63 });
62 return; 64 return;
63 } 65 }
64 notifyPropertyChange(#lines, 0, 1); 66 notifyPropertyChange(#lines, 0, 1);
65 lines.clear(); 67 lines.clear();
66 var startLineNumber = script.tokenToLine(pos); 68 var startLineNumber = script.tokenToLine(pos);
67 if (startLineNumber != null) { 69 if (startLineNumber != null) {
68 if (endPos == null) { 70 if (endPos == null) {
69 lines.add(script.lines[startLineNumber - 1]); 71 lines.add(script.lines[startLineNumber - 1]);
70 } else { 72 } else {
71 var endLineNumber = script.tokenToLine(endPos); 73 var endLineNumber = script.tokenToLine(endPos);
72 assert(endLineNumber != null); 74 assert(endLineNumber != null);
73 for (var i = startLineNumber; i <= endLineNumber; i++) { 75 for (var i = startLineNumber; i <= endLineNumber; i++) {
74 lines.add(script.lines[i - 1]); 76 lines.add(script.lines[i - 1]);
75 } 77 }
76 } 78 }
77 } 79 }
78 } 80 }
79 81
80 ScriptInsetElement.created() : super.created(); 82 ScriptInsetElement.created() : super.created();
81 } 83 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698