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 'dart:svg'; | 9 import 'dart:svg'; |
10 import 'package:observatory/app.dart'; | 10 import 'package:observatory/app.dart'; |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 ? _loadedScript.tokenToLine(_endPos) | 647 ? _loadedScript.tokenToLine(_endPos) |
648 : script.lines.length + _loadedScript.lineOffset); | 648 : script.lines.length + _loadedScript.lineOffset); |
649 var lineNumPad = endLine.toString().length; | 649 var lineNumPad = endLine.toString().length; |
650 | 650 |
651 _annotationsCursor = 0; | 651 _annotationsCursor = 0; |
652 | 652 |
653 int blankLineCount = 0; | 653 int blankLineCount = 0; |
654 for (int i = _startLine; i <= _endLine; i++) { | 654 for (int i = _startLine; i <= _endLine; i++) { |
655 var line = script.getLine(i); | 655 var line = script.getLine(i); |
656 if (line.isBlank) { | 656 if (line.isBlank) { |
657 // Try to introduce elipses if there are 4 or more contiguous | 657 // Try to introduce ellipses if there are 4 or more contiguous |
658 // blank lines. | 658 // blank lines. |
659 blankLineCount++; | 659 blankLineCount++; |
660 } else { | 660 } else { |
661 if (blankLineCount > 0) { | 661 if (blankLineCount > 0) { |
662 int firstBlank = i - blankLineCount; | 662 int firstBlank = i - blankLineCount; |
663 int lastBlank = i - 1; | 663 int lastBlank = i - 1; |
664 if (blankLineCount < 4) { | 664 if (blankLineCount < 4) { |
665 // Too few blank lines for an elipsis. | 665 // Too few blank lines for an ellipsis. |
666 for (int j = firstBlank; j <= lastBlank; j++) { | 666 for (int j = firstBlank; j <= lastBlank; j++) { |
667 table.append(lineElement(script.getLine(j), lineNumPad)); | 667 table.append(lineElement(script.getLine(j), lineNumPad)); |
668 } | 668 } |
669 } else { | 669 } else { |
670 // Add an elipsis for the skipped region. | 670 // Add an ellipsis for the skipped region. |
671 table.append(lineElement(script.getLine(firstBlank), lineNumPad)); | 671 table.append(lineElement(script.getLine(firstBlank), lineNumPad)); |
672 table.append(lineElement(null, lineNumPad)); | 672 table.append(lineElement(null, lineNumPad)); |
673 table.append(lineElement(script.getLine(lastBlank), lineNumPad)); | 673 table.append(lineElement(script.getLine(lastBlank), lineNumPad)); |
674 } | 674 } |
675 blankLineCount = 0; | 675 blankLineCount = 0; |
676 } | 676 } |
677 table.append(lineElement(line, lineNumPad)); | 677 table.append(lineElement(line, lineNumPad)); |
678 } | 678 } |
679 } | 679 } |
680 | 680 |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 var show = false; | 957 var show = false; |
958 var originalBackground = content.style.backgroundColor; | 958 var originalBackground = content.style.backgroundColor; |
959 buildInfoBox() { | 959 buildInfoBox() { |
960 infoBox = infoBoxGenerator(); | 960 infoBox = infoBoxGenerator(); |
961 infoBox.style.position = 'absolute'; | 961 infoBox.style.position = 'absolute'; |
962 infoBox.style.padding = '1em'; | 962 infoBox.style.padding = '1em'; |
963 infoBox.style.border = 'solid black 2px'; | 963 infoBox.style.border = 'solid black 2px'; |
964 infoBox.style.zIndex = '10'; | 964 infoBox.style.zIndex = '10'; |
965 infoBox.style.backgroundColor = 'white'; | 965 infoBox.style.backgroundColor = 'white'; |
966 infoBox.style.cursor = 'auto'; | 966 infoBox.style.cursor = 'auto'; |
967 // Don't inherit pre formating from the script lines. | 967 // Don't inherit pre formatting from the script lines. |
968 infoBox.style.whiteSpace = 'normal'; | 968 infoBox.style.whiteSpace = 'normal'; |
969 content.append(infoBox); | 969 content.append(infoBox); |
970 } | 970 } |
971 | 971 |
972 content.onClick.listen((event) { | 972 content.onClick.listen((event) { |
973 show = !show; | 973 show = !show; |
974 if (infoBox == null) buildInfoBox(); // Created lazily on the first click. | 974 if (infoBox == null) buildInfoBox(); // Created lazily on the first click. |
975 infoBox.style.display = show ? 'block' : 'none'; | 975 infoBox.style.display = show ? 'block' : 'none'; |
976 content.style.backgroundColor = show ? 'white' : originalBackground; | 976 content.style.backgroundColor = show ? 'white' : originalBackground; |
977 }); | 977 }); |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1387 ..setAttribute( | 1387 ..setAttribute( |
1388 'd', | 1388 'd', |
1389 'M13.5.67s.74 2.65.74 4.8c0 2.06-1.35 3.73-3.41 ' | 1389 'M13.5.67s.74 2.65.74 4.8c0 2.06-1.35 3.73-3.41 ' |
1390 '3.73-2.07 0-3.63-1.67-3.63-3.73l.03-.36C5.21 7.51 ' | 1390 '3.73-2.07 0-3.63-1.67-3.63-3.73l.03-.36C5.21 7.51 ' |
1391 '4 10.62 4 14c0 4.42 3.58 8 8 8s8-3.58 8-8C20 8.61 ' | 1391 '4 10.62 4 14c0 4.42 3.58 8 8 8s8-3.58 8-8C20 8.61 ' |
1392 '17.41 3.8 13.5.67zM11.71 19c-1.78 ' | 1392 '17.41 3.8 13.5.67zM11.71 19c-1.78 ' |
1393 '0-3.22-1.4-3.22-3.14 0-1.62 1.05-2.76 2.81-3.12 ' | 1393 '0-3.22-1.4-3.22-3.14 0-1.62 1.05-2.76 2.81-3.12 ' |
1394 '1.77-.36 3.6-1.21 4.62-2.58.39 1.29.59 2.65.59 ' | 1394 '1.77-.36 3.6-1.21 4.62-2.58.39 1.29.59 2.65.59 ' |
1395 '4.04 0 2.65-2.15 4.8-4.8 4.8z') | 1395 '4.04 0 2.65-2.15 4.8-4.8 4.8z') |
1396 ]; | 1396 ]; |
OLD | NEW |