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

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

Issue 2779703004: DevTools: carefully cleanup CSS sourcemaps (Closed)
Patch Set: fix tests Created 3 years, 8 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;
11 } 11 }
12 12
13 InspectorTest.parseSCSS = function(url, text) 13 InspectorTest.parseSCSS = function(url, text)
14 { 14 {
15 return Sass.SASSSupport.parseSCSS(url, text); 15 return Sass.SASSSupport.parseSCSS(url, text);
16 } 16 }
17 InspectorTest.parseCSS = InspectorTest.parseSCSS; 17 InspectorTest.parseCSS = InspectorTest.parseSCSS;
18 18
19 InspectorTest.loadASTMapping = function(header, callback) 19 InspectorTest.loadASTMapping = function(header, callback)
20 { 20 {
21 var sourceMapManager = header.cssModel().sourceMapManager(); 21 var sourceMapManager = header.cssModel().sourceMapManager();
22 var sourceMap = sourceMapManager.sourceMapForClient(header); 22 var sourceMap = sourceMapManager.sourceMapForClient(header);
23 if (sourceMap) { 23 if (sourceMap) {
24 callback(sourceMap.editable() ? sourceMap : null); 24 callback(sourceMap.editable() ? sourceMap : null);
25 return; 25 return;
26 } 26 }
27 sourceMapManager.addEventListener(SDK.SourceMapManager.Events.SourceMapAttac hed, onAttached); 27 sourceMapManager.addEventListener(SDK.SourceMapManager.Events.SourceMapAttac hed, onAttached);
28 28
29 function onAttached(event) { 29 function onAttached(event) {
30 if (event.data !== header) 30 if (event.data.client !== header)
31 return; 31 return;
32 sourceMapManager.removeEventListener(SDK.SourceMapManager.Events.SourceM apAttached, onAttached); 32 sourceMapManager.removeEventListener(SDK.SourceMapManager.Events.SourceM apAttached, onAttached);
33 var sourceMap = sourceMapManager.sourceMapForClient(header); 33 var sourceMap = event.data.sourceMap;
34 callback(sourceMap.editable()? sourceMap : null); 34 callback(sourceMap.editable()? sourceMap : null);
35 } 35 }
36 } 36 }
37 37
38 InspectorTest.dumpAST = function(ast) 38 InspectorTest.dumpAST = function(ast)
39 { 39 {
40 var lines = [String.sprintf("=== AST === %s", ast.document.url)]; 40 var lines = [String.sprintf("=== AST === %s", ast.document.url)];
41 for (var i = 0; i < ast.rules.length; ++i) { 41 for (var i = 0; i < ast.rules.length; ++i) {
42 var rule = ast.rules[i]; 42 var rule = ast.rules[i];
43 lines.push(String.sprintf("rule %d", i)); 43 lines.push(String.sprintf("rule %d", i));
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 } 305 }
306 if (!match) 306 if (!match)
307 return null; 307 return null;
308 var sourceRange = new TextUtils.SourceRange(match.index, match[0].length); 308 var sourceRange = new TextUtils.SourceRange(match.index, match[0].length);
309 var textRange = new TextUtils.Text(source).toTextRange(sourceRange); 309 var textRange = new TextUtils.Text(source).toTextRange(sourceRange);
310 return new TextUtils.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