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

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

Issue 2769843003: DevTools: split text_utils out of common module (Closed)
Patch Set: rebaseline Created 3 years, 9 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 var initialize_SassTest = function() { 1 var initialize_SassTest = function() {
2 2
3 InspectorTest.preloadModule("sass"); 3 InspectorTest.preloadModule("sass");
4 4
5 var sassSourceMapFactory = null; 5 var sassSourceMapFactory = null;
6 InspectorTest.sassSourceMapFactory = function() 6 InspectorTest.sassSourceMapFactory = function()
7 { 7 {
8 if (!sassSourceMapFactory) 8 if (!sassSourceMapFactory)
9 sassSourceMapFactory = new Sass.SASSSourceMapFactory(); 9 sassSourceMapFactory = new Sass.SASSSourceMapFactory();
10 return sassSourceMapFactory; 10 return sassSourceMapFactory;
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 InspectorTest.addResult("\n" + prefix + titleText + suffix + "\n"); 279 InspectorTest.addResult("\n" + prefix + titleText + suffix + "\n");
280 } 280 }
281 281
282 function logSourceEdits(text, edits) 282 function logSourceEdits(text, edits)
283 { 283 {
284 var lines = []; 284 var lines = [];
285 for (var i = 0; i < edits.length; ++i) { 285 for (var i = 0; i < edits.length; ++i) {
286 var edit = edits[i]; 286 var edit = edits[i];
287 var range = edit.oldRange; 287 var range = edit.oldRange;
288 var line = String.sprintf("{%d, %d, %d, %d}", range.startLine, range .startColumn, range.endLine, range.endColumn); 288 var line = String.sprintf("{%d, %d, %d, %d}", range.startLine, range .startColumn, range.endLine, range.endColumn);
289 line += String.sprintf(" '%s' => '%s'", (new Common.Text(text)).extr act(range), edit.newText); 289 line += String.sprintf(" '%s' => '%s'", (new TextUtils.Text(text)).e xtract(range), edit.newText);
290 lines.push(line); 290 lines.push(line);
291 } 291 }
292 lines = indent(lines); 292 lines = indent(lines);
293 lines.unshift("Edits:"); 293 lines.unshift("Edits:");
294 InspectorTest.addResult(lines.join("\n")); 294 InspectorTest.addResult(lines.join("\n"));
295 } 295 }
296 } 296 }
297 297
298 InspectorTest.createEdit = function(source, pattern, newText, matchNumber) 298 InspectorTest.createEdit = function(source, pattern, newText, matchNumber)
299 { 299 {
300 matchNumber = matchNumber || 0; 300 matchNumber = matchNumber || 0;
301 var re = new RegExp(pattern.escapeForRegExp(), "g"); 301 var re = new RegExp(pattern.escapeForRegExp(), "g");
302 var match; 302 var match;
303 while ((match = re.exec(source)) !== null && matchNumber) { 303 while ((match = re.exec(source)) !== null && matchNumber) {
304 --matchNumber; 304 --matchNumber;
305 } 305 }
306 if (!match) 306 if (!match)
307 return null; 307 return null;
308 var sourceRange = new Common.SourceRange(match.index, match[0].length); 308 var sourceRange = new TextUtils.SourceRange(match.index, match[0].length);
309 var textRange = new Common.Text(source).toTextRange(sourceRange); 309 var textRange = new TextUtils.Text(source).toTextRange(sourceRange);
310 return new Common.SourceEdit("", textRange, newText); 310 return new TextUtils.SourceEdit("", textRange, newText);
311 } 311 }
312 312
313 } 313 }
314 314
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698