Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 trydart.interaction_manager; | 5 library trydart.interaction_manager; |
| 6 | 6 |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 | 8 |
| 9 import 'dart:convert' show | 9 import 'dart:convert' show |
| 10 JSON; | 10 JSON; |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 659 case 'scrollHeight': | 659 case 'scrollHeight': |
| 660 return onScrollHeightMessage(message[1]); | 660 return onScrollHeightMessage(message[1]); |
| 661 } | 661 } |
| 662 } | 662 } |
| 663 return onBadMessage(event); | 663 return onBadMessage(event); |
| 664 } else { | 664 } else { |
| 665 return consolePrintLine(event.data); | 665 return consolePrintLine(event.data); |
| 666 } | 666 } |
| 667 } | 667 } |
| 668 | 668 |
| 669 /// Called when an exception occurs in an iframe. | |
| 670 void onErrorMessage(ErrorMessage message) { | |
| 671 outputDiv.appendText('$message\n'); | |
|
ahe
2014/07/03 14:44:50
Bad merge, was renamed to onIframeError.
| |
| 672 } | |
| 673 | |
| 674 /// Called when an iframe is modified. | 669 /// Called when an iframe is modified. |
| 675 void onScrollHeightMessage(int scrollHeight) { | 670 void onScrollHeightMessage(int scrollHeight) { |
| 676 window.console.log('scrollHeight = $scrollHeight'); | 671 window.console.log('scrollHeight = $scrollHeight'); |
| 677 if (scrollHeight > 8) { | 672 if (scrollHeight > 8) { |
| 678 outputFrame.style | 673 outputFrame.style |
| 679 ..height = '${scrollHeight}px' | 674 ..height = '${scrollHeight}px' |
| 680 ..visibility = '' | 675 ..visibility = '' |
| 681 ..position = ''; | 676 ..position = ''; |
| 682 while (outputFrame.nextNode is IFrameElement) { | 677 while (outputFrame.nextNode is IFrameElement) { |
| 683 outputFrame.nextNode.remove(); | 678 outputFrame.nextNode.remove(); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 702 // Test support. | 697 // Test support. |
| 703 // TODO(ahe): Use '/' instead of '*' when Firefox is upgraded to version | 698 // TODO(ahe): Use '/' instead of '*' when Firefox is upgraded to version |
| 704 // 30 across build bots. Support for '/' was added in version 29, and we | 699 // 30 across build bots. Support for '/' was added in version 29, and we |
| 705 // support the two most recent versions. | 700 // support the two most recent versions. |
| 706 window.parent.postMessage('$line\n', '*'); | 701 window.parent.postMessage('$line\n', '*'); |
| 707 } | 702 } |
| 708 outputDiv.appendText('$line\n'); | 703 outputDiv.appendText('$line\n'); |
| 709 } | 704 } |
| 710 | 705 |
| 711 void onCompilationFailed() { | 706 void onCompilationFailed() { |
| 707 consolePrintLine('Compilation failed.'); | |
| 712 } | 708 } |
| 713 | 709 |
| 714 void onCompilationDone() { | 710 void onCompilationDone() { |
| 715 context.isFirstCompile = false; | 711 context.isFirstCompile = false; |
| 716 context.elapsedCompilationTime.stop(); | 712 context.elapsedCompilationTime.stop(); |
| 717 Duration compilationDuration = context.elapsedCompilationTime.elapsed; | 713 Duration compilationDuration = context.elapsedCompilationTime.elapsed; |
| 718 context.elapsedCompilationTime.reset(); | 714 context.elapsedCompilationTime.reset(); |
| 719 print('Compilation took $compilationDuration.'); | 715 print('Compilation took $compilationDuration.'); |
| 720 if (context.compilerConsole.parent != null) { | 716 if (context.compilerConsole.parent != null) { |
| 721 context.compilerConsole.remove(); | 717 context.compilerConsole.remove(); |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1197 Text newNode = new Text('$buffer'); | 1193 Text newNode = new Text('$buffer'); |
| 1198 node.replaceWith(newNode); | 1194 node.replaceWith(newNode); |
| 1199 if (selectionOffset != -1) { | 1195 if (selectionOffset != -1) { |
| 1200 selection.anchorNode = newNode; | 1196 selection.anchorNode = newNode; |
| 1201 selection.anchorOffset = selectionOffset; | 1197 selection.anchorOffset = selectionOffset; |
| 1202 } | 1198 } |
| 1203 } | 1199 } |
| 1204 if (!record.removedNodes.isEmpty) { | 1200 if (!record.removedNodes.isEmpty) { |
| 1205 var first = record.removedNodes.first; | 1201 var first = record.removedNodes.first; |
| 1206 var line = findLine(record.target); | 1202 var line = findLine(record.target); |
| 1207 | 1203 |
| 1208 if (first is Text && first.data=="\n" && line.nextNode != null) { | 1204 if (first is Text && first.data=="\n" && line.nextNode != null) { |
| 1209 normalizedNodes.add(line.nextNode); | 1205 normalizedNodes.add(line.nextNode); |
| 1210 } | 1206 } |
| 1211 normalizedNodes.add(line); | 1207 normalizedNodes.add(line); |
| 1212 } | 1208 } |
| 1213 if (record.type == "characterData") { | 1209 if (record.type == "characterData") { |
| 1214 normalizedNodes.add(findLine(record.target)); | 1210 normalizedNodes.add(findLine(record.target)); |
| 1215 } | 1211 } |
| 1216 } | 1212 } |
| 1217 | 1213 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1256 bool isCompilerStageMarker(String message) { | 1252 bool isCompilerStageMarker(String message) { |
| 1257 return | 1253 return |
| 1258 message.startsWith('Package root is ') || | 1254 message.startsWith('Package root is ') || |
| 1259 message.startsWith('Compiling ') || | 1255 message.startsWith('Compiling ') || |
| 1260 message == "Resolving..." || | 1256 message == "Resolving..." || |
| 1261 message.startsWith('Resolved ') || | 1257 message.startsWith('Resolved ') || |
| 1262 message == "Inferring types..." || | 1258 message == "Inferring types..." || |
| 1263 message == "Compiling..." || | 1259 message == "Compiling..." || |
| 1264 message.startsWith('Compiled '); | 1260 message.startsWith('Compiled '); |
| 1265 } | 1261 } |
| OLD | NEW |