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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/editor/editor-test.js

Issue 2269183003: DevTools: Merge CodeMirrorTextEditor's copyRange into text (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
OLDNEW
1 function initialize_EditorTests() 1 function initialize_EditorTests()
2 { 2 {
3 3
4 InspectorTest.createTestEditor = function(clientHeight, textEditorDelegate) 4 InspectorTest.createTestEditor = function(clientHeight, textEditorDelegate)
5 { 5 {
6 var textEditor = new WebInspector.SourcesTextEditor(textEditorDelegate || ne w WebInspector.SourcesTextEditorDelegate()); 6 var textEditor = new WebInspector.SourcesTextEditor(textEditorDelegate || ne w WebInspector.SourcesTextEditorDelegate());
7 clientHeight = clientHeight || 100; 7 clientHeight = clientHeight || 100;
8 textEditor.element.style.height = clientHeight + "px"; 8 textEditor.element.style.height = clientHeight + "px";
9 textEditor.element.style.flex = "none"; 9 textEditor.element.style.flex = "none";
10 textEditor.show(WebInspector.inspectorView.element); 10 textEditor.show(WebInspector.inspectorView.element);
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 editor._codeMirror.on("inputRead", callbackWrapper); 181 editor._codeMirror.on("inputRead", callbackWrapper);
182 } 182 }
183 183
184 InspectorTest.dumpSelectionStats = function(textEditor) 184 InspectorTest.dumpSelectionStats = function(textEditor)
185 { 185 {
186 var listHashMap = {}; 186 var listHashMap = {};
187 var sortedKeys = []; 187 var sortedKeys = [];
188 var selections = textEditor.selections(); 188 var selections = textEditor.selections();
189 for (var i = 0; i < selections.length; ++i) { 189 for (var i = 0; i < selections.length; ++i) {
190 var selection = selections[i]; 190 var selection = selections[i];
191 var text = textEditor.copyRange(selection); 191 var text = textEditor.text(selection);
192 if (!listHashMap[text]) { 192 if (!listHashMap[text]) {
193 listHashMap[text] = 1; 193 listHashMap[text] = 1;
194 sortedKeys.push(text); 194 sortedKeys.push(text);
195 } else { 195 } else {
196 ++listHashMap[text]; 196 ++listHashMap[text];
197 } 197 }
198 } 198 }
199 for (var i = 0; i < sortedKeys.length; ++i) { 199 for (var i = 0; i < sortedKeys.length; ++i) {
200 var keyName = sortedKeys[i]; 200 var keyName = sortedKeys[i];
201 if (!keyName.length) 201 if (!keyName.length)
202 keyName = "<Empty string>"; 202 keyName = "<Empty string>";
203 else 203 else
204 keyName = "'" + keyName + "'"; 204 keyName = "'" + keyName + "'";
205 InspectorTest.addResult(keyName + ": " + listHashMap[sortedKeys[i]]); 205 InspectorTest.addResult(keyName + ": " + listHashMap[sortedKeys[i]]);
206 } 206 }
207 } 207 }
208 208
209 } 209 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698