| 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 } | 409 } |
| 410 } | 410 } |
| 411 | 411 |
| 412 return table; | 412 return table; |
| 413 } | 413 } |
| 414 | 414 |
| 415 // Assumes annotations are sorted. | 415 // Assumes annotations are sorted. |
| 416 Annotation nextAnnotationOnLine(int line) { | 416 Annotation nextAnnotationOnLine(int line) { |
| 417 if (annotationsCursor >= annotations.length) return null; | 417 if (annotationsCursor >= annotations.length) return null; |
| 418 var annotation = annotations[annotationsCursor]; | 418 var annotation = annotations[annotationsCursor]; |
| 419 |
| 420 // Fast-forward past any annotations before the first line that |
| 421 // we are displaying. |
| 422 while (annotation.line < line) { |
| 423 annotationsCursor++; |
| 424 if (annotationsCursor >= annotations.length) return null; |
| 425 annotation = annotations[annotationsCursor]; |
| 426 } |
| 427 |
| 428 // Next annotation is for a later line, don't advance past it. |
| 419 if (annotation.line != line) return null; | 429 if (annotation.line != line) return null; |
| 420 annotationsCursor++; | 430 annotationsCursor++; |
| 421 return annotation; | 431 return annotation; |
| 422 } | 432 } |
| 423 | 433 |
| 424 Element lineElement(ScriptLine line) { | 434 Element lineElement(ScriptLine line) { |
| 425 var e = new DivElement(); | 435 var e = new DivElement(); |
| 426 e.classes.add("sourceRow"); | 436 e.classes.add("sourceRow"); |
| 427 e.append(lineBreakpointElement(line)); | 437 e.append(lineBreakpointElement(line)); |
| 428 e.append(lineNumberElement(line)); | 438 e.append(lineNumberElement(line)); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 annotation.applyStyleTo(consumeUntil(annotation.columnStop)); | 547 annotation.applyStyleTo(consumeUntil(annotation.columnStop)); |
| 538 } | 548 } |
| 539 consumeUntil(line.text.length); | 549 consumeUntil(line.text.length); |
| 540 } | 550 } |
| 541 | 551 |
| 542 return e; | 552 return e; |
| 543 } | 553 } |
| 544 | 554 |
| 545 ScriptInsetElement.created() : super.created(); | 555 ScriptInsetElement.created() : super.created(); |
| 546 } | 556 } |
| OLD | NEW |