| 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 computeAnnotations(); | 308 computeAnnotations(); |
| 309 | 309 |
| 310 var table = linesTable(); | 310 var table = linesTable(); |
| 311 if (container == null) { | 311 if (container == null) { |
| 312 // Indirect to avoid deleting the style element. | 312 // Indirect to avoid deleting the style element. |
| 313 container = new DivElement(); | 313 container = new DivElement(); |
| 314 shadowRoot.append(container); | 314 shadowRoot.append(container); |
| 315 } | 315 } |
| 316 container.children.clear(); | 316 container.children.clear(); |
| 317 container.children.add(table); | 317 container.children.add(table); |
| 318 makeCssClassUncopyable(table, "noCopy"); |
| 318 } | 319 } |
| 319 | 320 |
| 320 void loadFunctionsOf(Library lib) { | 321 void loadFunctionsOf(Library lib) { |
| 321 lib.load().then((lib) { | 322 lib.load().then((lib) { |
| 322 for (var func in lib.functions) { | 323 for (var func in lib.functions) { |
| 323 func.load(); | 324 func.load(); |
| 324 } | 325 } |
| 325 for (var cls in lib.classes) { | 326 for (var cls in lib.classes) { |
| 326 cls.load().then((cls) { | 327 cls.load().then((cls) { |
| 327 for (var func in cls.functions) { | 328 for (var func in cls.functions) { |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 e.append(lineNumberElement(line)); | 443 e.append(lineNumberElement(line)); |
| 443 e.append(lineSourceElement(line)); | 444 e.append(lineSourceElement(line)); |
| 444 return e; | 445 return e; |
| 445 } | 446 } |
| 446 | 447 |
| 447 Element lineBreakpointElement(ScriptLine line) { | 448 Element lineBreakpointElement(ScriptLine line) { |
| 448 var e = new DivElement(); | 449 var e = new DivElement(); |
| 449 var busy = false; | 450 var busy = false; |
| 450 if (line == null || !line.possibleBpt) { | 451 if (line == null || !line.possibleBpt) { |
| 451 e.classes.add("emptyBreakpoint"); | 452 e.classes.add("emptyBreakpoint"); |
| 453 e.classes.add('noCopy'); |
| 452 e.text = nbsp; | 454 e.text = nbsp; |
| 453 return e; | 455 return e; |
| 454 } | 456 } |
| 455 e.text = 'B'; | 457 e.text = 'B'; |
| 456 update() { | 458 update() { |
| 459 e.classes.clear(); |
| 460 e.classes.add('noCopy'); |
| 461 |
| 457 if (busy) { | 462 if (busy) { |
| 458 e.classes.clear(); | |
| 459 e.classes.add("busyBreakpoint"); | 463 e.classes.add("busyBreakpoint"); |
| 460 } else { | 464 } else { |
| 461 if (line.breakpoints != null) { | 465 if (line.breakpoints != null) { |
| 462 if (line.breakpointResolved) { | 466 if (line.breakpointResolved) { |
| 463 e.classes.clear(); | |
| 464 e.classes.add("resolvedBreakpoint"); | 467 e.classes.add("resolvedBreakpoint"); |
| 465 } else { | 468 } else { |
| 466 e.classes.clear(); | |
| 467 e.classes.add("unresolvedBreakpoint"); | 469 e.classes.add("unresolvedBreakpoint"); |
| 468 } | 470 } |
| 469 } else { | 471 } else { |
| 470 e.classes.clear(); | |
| 471 e.classes.add("possibleBreakpoint"); | 472 e.classes.add("possibleBreakpoint"); |
| 472 } | 473 } |
| 473 } | 474 } |
| 474 } | 475 } |
| 475 line.changes.listen((_) => update()); | 476 line.changes.listen((_) => update()); |
| 476 e.onClick.listen((event) { | 477 e.onClick.listen((event) { |
| 477 if (busy) { | 478 if (busy) { |
| 478 return; | 479 return; |
| 479 } | 480 } |
| 480 busy = true; | 481 busy = true; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 497 } | 498 } |
| 498 update(); | 499 update(); |
| 499 }); | 500 }); |
| 500 update(); | 501 update(); |
| 501 return e; | 502 return e; |
| 502 } | 503 } |
| 503 | 504 |
| 504 Element lineNumberElement(ScriptLine line) { | 505 Element lineNumberElement(ScriptLine line) { |
| 505 var lineNumber = line == null ? "..." : line.line; | 506 var lineNumber = line == null ? "..." : line.line; |
| 506 var e = span("$nbsp$lineNumber$nbsp"); | 507 var e = span("$nbsp$lineNumber$nbsp"); |
| 508 e.classes.add('noCopy'); |
| 507 | 509 |
| 508 if ((line == null) || (line.hits == null)) { | 510 if ((line == null) || (line.hits == null)) { |
| 509 hitsUnknown(e); | 511 hitsUnknown(e); |
| 510 } else if (line.hits == 0) { | 512 } else if (line.hits == 0) { |
| 511 hitsNotExecuted(e); | 513 hitsNotExecuted(e); |
| 512 } else { | 514 } else { |
| 513 hitsExecuted(e); | 515 hitsExecuted(e); |
| 514 } | 516 } |
| 515 | 517 |
| 516 return e; | 518 return e; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 546 | 548 |
| 547 // TODO(rmacnak): Tolerate overlapping annotations. | 549 // TODO(rmacnak): Tolerate overlapping annotations. |
| 548 var annotation; | 550 var annotation; |
| 549 while ((annotation = nextAnnotationOnLine(line.line)) != null) { | 551 while ((annotation = nextAnnotationOnLine(line.line)) != null) { |
| 550 consumeUntil(annotation.columnStart); | 552 consumeUntil(annotation.columnStart); |
| 551 annotation.applyStyleTo(consumeUntil(annotation.columnStop)); | 553 annotation.applyStyleTo(consumeUntil(annotation.columnStop)); |
| 552 } | 554 } |
| 553 consumeUntil(line.text.length); | 555 consumeUntil(line.text.length); |
| 554 } | 556 } |
| 555 | 557 |
| 558 // So blank lines are included when copying script to the clipboard. |
| 559 e.append(span('\n')); |
| 560 |
| 556 return e; | 561 return e; |
| 557 } | 562 } |
| 558 | 563 |
| 559 ScriptInsetElement.created() : super.created(); | 564 ScriptInsetElement.created() : super.created(); |
| 560 } | 565 } |
| OLD | NEW |