Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: dart/site/try/src/interaction_manager.dart

Issue 266293002: Make Try Dart tests run on Firefox. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r35787 Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dart/site/try/src/editor.dart ('k') | dart/site/try/src/selection.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 info, 48 info,
49 warning; 49 warning;
50 50
51 import 'html_to_text.dart' show 51 import 'html_to_text.dart' show
52 htmlToText; 52 htmlToText;
53 53
54 import 'compilation_unit.dart' show 54 import 'compilation_unit.dart' show
55 CompilationUnit; 55 CompilationUnit;
56 56
57 import 'selection.dart' show 57 import 'selection.dart' show
58 TrySelection; 58 TrySelection,
59 isCollapsed;
59 60
60 import 'editor.dart' as editor; 61 import 'editor.dart' as editor;
61 62
62 import 'mock.dart' as mock; 63 import 'mock.dart' as mock;
63 64
64 import 'settings.dart' as settings; 65 import 'settings.dart' as settings;
65 66
66 const String TRY_DART_NEW_DEFECT = 67 const String TRY_DART_NEW_DEFECT =
67 'https://code.google.com/p/dart/issues/entry' 68 'https://code.google.com/p/dart/issues/entry'
68 '?template=Try+Dart+Internal+Error'; 69 '?template=Try+Dart+Internal+Error';
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 223 }
223 224
224 void onModifiedKeyUp(KeyboardEvent event) { 225 void onModifiedKeyUp(KeyboardEvent event) {
225 } 226 }
226 227
227 void onUnmodifiedKeyUp(KeyboardEvent event) { 228 void onUnmodifiedKeyUp(KeyboardEvent event) {
228 switch (event.keyCode) { 229 switch (event.keyCode) {
229 case KeyCode.ENTER: { 230 case KeyCode.ENTER: {
230 event.preventDefault(); 231 event.preventDefault();
231 Selection selection = window.getSelection(); 232 Selection selection = window.getSelection();
232 if (selection.isCollapsed && selection.anchorNode is Text) { 233 if (isCollapsed(selection) && selection.anchorNode is Text) {
233 Text text = selection.anchorNode; 234 Text text = selection.anchorNode;
234 int offset = selection.anchorOffset; 235 int offset = selection.anchorOffset;
235 text.insertData(offset, '\n'); 236 text.insertData(offset, '\n');
236 selection.collapse(text, offset + 1); 237 selection.collapse(text, offset + 1);
237 } 238 }
238 break; 239 break;
239 } 240 }
240 } 241 }
241 242
242 // editor.scheduleRemoveCodeCompletion(); 243 // editor.scheduleRemoveCodeCompletion();
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 StringBuffer buffer = new StringBuffer(); 792 StringBuffer buffer = new StringBuffer();
792 int selectionOffset = htmlToText(node, buffer, selection); 793 int selectionOffset = htmlToText(node, buffer, selection);
793 Text newNode = new Text('$buffer'); 794 Text newNode = new Text('$buffer');
794 node.replaceWith(newNode); 795 node.replaceWith(newNode);
795 if (selectionOffset != -1) { 796 if (selectionOffset != -1) {
796 selection.anchorNode = newNode; 797 selection.anchorNode = newNode;
797 selection.anchorOffset = selectionOffset; 798 selection.anchorOffset = selectionOffset;
798 } 799 }
799 } 800 }
800 } 801 }
OLDNEW
« no previous file with comments | « dart/site/try/src/editor.dart ('k') | dart/site/try/src/selection.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698