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

Side by Side Diff: dart/site/try/src/editor.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/cache.dart ('k') | dart/site/try/src/interaction_manager.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) 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 trydart.editor; 5 library trydart.editor;
6 6
7 import 'dart:html'; 7 import 'dart:html';
8 8
9 import 'package:compiler/implementation/scanner/scannerlib.dart' show 9 import 'package:compiler/implementation/scanner/scannerlib.dart' show
10 EOF_TOKEN, 10 EOF_TOKEN,
11 ErrorToken, 11 ErrorToken,
12 StringScanner, 12 StringScanner,
13 Token; 13 Token;
14 14
15 import 'ui.dart' show 15 import 'ui.dart' show
16 currentTheme, 16 currentTheme,
17 hackDiv, 17 hackDiv,
18 mainEditorPane, 18 mainEditorPane,
19 observer, 19 observer,
20 outputDiv; 20 outputDiv;
21 21
22 import 'decoration.dart' show 22 import 'decoration.dart' show
23 CodeCompletionDecoration, 23 CodeCompletionDecoration,
24 Decoration, 24 Decoration,
25 DiagnosticDecoration, 25 DiagnosticDecoration,
26 error, 26 error,
27 info, 27 info,
28 warning; 28 warning;
29 29
30 import 'selection.dart' show
31 isCollapsed;
32
30 const String INDENT = '\u{a0}\u{a0}'; 33 const String INDENT = '\u{a0}\u{a0}';
31 34
32 Set<String> seenIdentifiers; 35 Set<String> seenIdentifiers;
33 36
34 Element moveActive(int distance) { 37 Element moveActive(int distance) {
35 List<Element> entries = document.querySelectorAll('.dart-static>.dart-entry'); 38 List<Element> entries = document.querySelectorAll('.dart-static>.dart-entry');
36 int activeIndex = -1; 39 int activeIndex = -1;
37 for (var i = 0; i < entries.length; i++) { 40 for (var i = 0; i < entries.length; i++) {
38 if (entries[i].classes.contains('activeEntry')) { 41 if (entries[i].classes.contains('activeEntry')) {
39 activeIndex = i; 42 activeIndex = i;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 return hidden; 102 return hidden;
100 } 103 }
101 104
102 var activeCompletion; 105 var activeCompletion;
103 num minSuggestionWidth = 0; 106 num minSuggestionWidth = 0;
104 107
105 /// Returns the [Element] which encloses the current collapsed selection, if it 108 /// Returns the [Element] which encloses the current collapsed selection, if it
106 /// exists. 109 /// exists.
107 Element getElementAtSelection() { 110 Element getElementAtSelection() {
108 Selection selection = window.getSelection(); 111 Selection selection = window.getSelection();
109 if (!selection.isCollapsed) return null; 112 if (!isCollapsed(selection)) return null;
110 var anchorNode = selection.anchorNode; 113 var anchorNode = selection.anchorNode;
111 if (!mainEditorPane.contains(anchorNode)) return null; 114 if (!mainEditorPane.contains(anchorNode)) return null;
112 if (mainEditorPane == anchorNode) return null; 115 if (mainEditorPane == anchorNode) return null;
113 int type = anchorNode.nodeType; 116 int type = anchorNode.nodeType;
114 if (type != Node.TEXT_NODE) return null; 117 if (type != Node.TEXT_NODE) return null;
115 Text text = anchorNode; 118 Text text = anchorNode;
116 var parent = text.parent; 119 var parent = text.parent;
117 if (parent is! Element) return null; 120 if (parent is! Element) return null;
118 if (mainEditorPane == parent) return null; 121 if (mainEditorPane == parent) return null;
119 return parent; 122 return parent;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 225
223 diagnostic(text, tip) { 226 diagnostic(text, tip) {
224 if (text is String) { 227 if (text is String) {
225 text = new Text(text); 228 text = new Text(text);
226 } 229 }
227 return new AnchorElement() 230 return new AnchorElement()
228 ..classes.add('diagnostic') 231 ..classes.add('diagnostic')
229 ..append(text) 232 ..append(text)
230 ..append(tip); 233 ..append(tip);
231 } 234 }
OLDNEW
« no previous file with comments | « dart/site/try/src/cache.dart ('k') | dart/site/try/src/interaction_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698