| 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 script_inset_element; |     5 library script_inset_element; | 
|     6  |     6  | 
|     7 import 'dart:async'; |     7 import 'dart:async'; | 
|     8 import 'dart:html'; |     8 import 'dart:html'; | 
|     9 import 'observatory_element.dart'; |     9 import 'observatory_element.dart'; | 
|    10 import 'service_ref.dart'; |    10 import 'service_ref.dart'; | 
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   114     element.title = "Current execution"; |   114     element.title = "Current execution"; | 
|   115   } |   115   } | 
|   116 } |   116 } | 
|   117  |   117  | 
|   118 class BreakpointAnnotation extends Annotation { |   118 class BreakpointAnnotation extends Annotation { | 
|   119   Breakpoint bpt; |   119   Breakpoint bpt; | 
|   120   int priority = 1; |   120   int priority = 1; | 
|   121  |   121  | 
|   122   BreakpointAnnotation(this.bpt) { |   122   BreakpointAnnotation(this.bpt) { | 
|   123     var script = bpt.location.script; |   123     var script = bpt.location.script; | 
|   124     var pos = bpt.location.tokenPos; |   124     if (bpt.location.tokenPos != null) { | 
|   125     line = script.tokenToLine(pos); |   125       var pos = bpt.location.tokenPos; | 
|   126     columnStart = script.tokenToCol(pos) - 1;  // tokenToCol is 1-origin. |   126       line = script.tokenToLine(pos); | 
 |   127       columnStart = script.tokenToCol(pos) - 1;  // tokenToCol is 1-origin. | 
 |   128     } else { | 
 |   129       line = bpt.location.line; | 
 |   130       columnStart = bpt.location.column; | 
 |   131       if (columnStart == null) { | 
 |   132         columnStart = 0; | 
 |   133       } | 
 |   134     } | 
|   127     var length = script.guessTokenLength(line, columnStart); |   135     var length = script.guessTokenLength(line, columnStart); | 
|   128     if (length == null) { |   136     if (length == null) { | 
|   129       length = 1; |   137       length = 1; | 
|   130     } |   138     } | 
|   131     columnStop = columnStart + length; |   139     columnStop = columnStart + length; | 
|   132   } |   140   } | 
|   133  |   141  | 
|   134   void applyStyleTo(element) { |   142   void applyStyleTo(element) { | 
|   135     if (element == null) { |   143     if (element == null) { | 
|   136       return;  // TODO(rmacnak): Handling overlapping annotations. |   144       return;  // TODO(rmacnak): Handling overlapping annotations. | 
|   137     } |   145     } | 
|   138     var script = bpt.location.script; |   146     var script = bpt.location.script; | 
|   139     var pos = bpt.location.tokenPos; |   147     var pos = bpt.location.tokenPos; | 
|   140     int line = script.tokenToLine(pos); |   148     int line = script.tokenToLine(pos); | 
|   141     int column = script.tokenToCol(pos); |   149     int column = script.tokenToCol(pos); | 
|   142     element.classes.add("breakAnnotation"); |   150     if (bpt.resolved) { | 
 |   151       element.classes.add("resolvedBreakAnnotation"); | 
 |   152     } else { | 
 |   153       element.classes.add("unresolvedBreakAnnotation"); | 
 |   154     } | 
|   143     element.title = "Breakpoint ${bpt.number} at ${line}:${column}"; |   155     element.title = "Breakpoint ${bpt.number} at ${line}:${column}"; | 
|   144   } |   156   } | 
|   145 } |   157 } | 
|   146  |   158  | 
|   147 class LibraryAnnotation extends Annotation { |   159 class LibraryAnnotation extends Annotation { | 
|   148   Library target; |   160   Library target; | 
|   149   String url; |   161   String url; | 
|   150   int priority = 2; |   162   int priority = 2; | 
|   151  |   163  | 
|   152   LibraryAnnotation(this.target, this.url); |   164   LibraryAnnotation(this.target, this.url); | 
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   441     _updateTask.queue(); |   453     _updateTask.queue(); | 
|   442   } |   454   } | 
|   443  |   455  | 
|   444   void variablesChanged(oldValue) { |   456   void variablesChanged(oldValue) { | 
|   445     _updateTask.queue(); |   457     _updateTask.queue(); | 
|   446   } |   458   } | 
|   447  |   459  | 
|   448   Element a(String text) => new AnchorElement()..text = text; |   460   Element a(String text) => new AnchorElement()..text = text; | 
|   449   Element span(String text) => new SpanElement()..text = text; |   461   Element span(String text) => new SpanElement()..text = text; | 
|   450  |   462  | 
 |   463   Element hitsCurrent(Element element) { | 
 |   464     element.classes.add('hitsCurrent'); | 
 |   465     element.title = ""; | 
 |   466     return element; | 
 |   467   } | 
|   451   Element hitsUnknown(Element element) { |   468   Element hitsUnknown(Element element) { | 
|   452     element.classes.add('hitsNone'); |   469     element.classes.add('hitsNone'); | 
|   453     element.title = ""; |   470     element.title = ""; | 
|   454     return element; |   471     return element; | 
|   455   } |   472   } | 
|   456   Element hitsNotExecuted(Element element) { |   473   Element hitsNotExecuted(Element element) { | 
|   457     element.classes.add('hitsNotExecuted'); |   474     element.classes.add('hitsNotExecuted'); | 
|   458     element.title = "Line did not execute"; |   475     element.title = "Line did not execute"; | 
|   459     return element; |   476     return element; | 
|   460   } |   477   } | 
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   923     }); |   940     }); | 
|   924     update(); |   941     update(); | 
|   925     return e; |   942     return e; | 
|   926   } |   943   } | 
|   927  |   944  | 
|   928   Element lineNumberElement(ScriptLine line) { |   945   Element lineNumberElement(ScriptLine line) { | 
|   929     var lineNumber = line == null ? "..." : line.line; |   946     var lineNumber = line == null ? "..." : line.line; | 
|   930     var e = span("$nbsp$lineNumber$nbsp"); |   947     var e = span("$nbsp$lineNumber$nbsp"); | 
|   931     e.classes.add('noCopy'); |   948     e.classes.add('noCopy'); | 
|   932  |   949  | 
|   933     if ((line == null) || (line.hits == null)) { |   950     if (lineNumber == _currentLine) { | 
 |   951       hitsCurrent(e); | 
 |   952     } else if ((line == null) || (line.hits == null)) { | 
|   934       hitsUnknown(e); |   953       hitsUnknown(e); | 
|   935     } else if (line.hits == 0) { |   954     } else if (line.hits == 0) { | 
|   936       hitsNotExecuted(e); |   955       hitsNotExecuted(e); | 
|   937     } else { |   956     } else { | 
|   938       hitsExecuted(e); |   957       hitsExecuted(e); | 
|   939     } |   958     } | 
|   940  |   959  | 
|   941     return e; |   960     return e; | 
|   942   } |   961   } | 
|   943  |   962  | 
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   994 class SourceInsetElement extends PolymerElement { |  1013 class SourceInsetElement extends PolymerElement { | 
|   995   SourceInsetElement.created() : super.created(); |  1014   SourceInsetElement.created() : super.created(); | 
|   996  |  1015  | 
|   997   @published SourceLocation location; |  1016   @published SourceLocation location; | 
|   998   @published String height = null; |  1017   @published String height = null; | 
|   999   @published int currentPos; |  1018   @published int currentPos; | 
|  1000   @published bool inDebuggerContext = false; |  1019   @published bool inDebuggerContext = false; | 
|  1001   @published ObservableList variables; |  1020   @published ObservableList variables; | 
|  1002 } |  1021 } | 
|  1003  |  1022  | 
| OLD | NEW |