| OLD | NEW |
| 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 WebInspector.SASSSourceMapFactory(); | 9 sassSourceMapFactory = new WebInspector.SASSSourceMapFactory(); |
| 10 return sassSourceMapFactory; | 10 return sassSourceMapFactory; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 InspectorTest.sassSourceMapFactory().editableSourceMap(header.cssModel()
.target(), sourceMap) | 26 InspectorTest.sassSourceMapFactory().editableSourceMap(header.cssModel()
.target(), sourceMap) |
| 27 .then(map => callback(map)); | 27 .then(map => callback(map)); |
| 28 } | 28 } |
| 29 } | 29 } |
| 30 | 30 |
| 31 InspectorTest.dumpAST = function(ast) | 31 InspectorTest.dumpAST = function(ast) |
| 32 { | 32 { |
| 33 var lines = [String.sprintf("=== AST === %s", ast.document.url)]; | 33 var lines = [String.sprintf("=== AST === %s", ast.document.url)]; |
| 34 for (var i = 0; i < ast.rules.length; ++i) { | 34 for (var i = 0; i < ast.rules.length; ++i) { |
| 35 var rule = ast.rules[i]; | 35 var rule = ast.rules[i]; |
| 36 lines.push(String.sprintf("rule %d: \"%s\"", i, rule.selector)); | 36 lines.push(String.sprintf("rule %d", i)); |
| 37 var ruleLines = dumpRule(rule); | 37 var ruleLines = dumpRule(rule); |
| 38 lines = lines.concat(indent(ruleLines)); | 38 lines = lines.concat(indent(ruleLines)); |
| 39 } | 39 } |
| 40 lines.push("======"); | 40 lines.push("======"); |
| 41 InspectorTest.addResult(lines.join("\n")); | 41 InspectorTest.addResult(lines.join("\n")); |
| 42 return ast; | 42 return ast; |
| 43 | 43 |
| 44 function dumpRule(rule) | 44 function dumpRule(rule) |
| 45 { | 45 { |
| 46 var lines = []; | 46 var lines = []; |
| 47 for (var i = 0; i < rule.selectors.length; ++i) { |
| 48 var selector = rule.selectors[i]; |
| 49 lines.push(`selector ${i}: "${selector.text}"`); |
| 50 var selectorLines = dumpTextNode(selector); |
| 51 lines = lines.concat(indent(selectorLines)); |
| 52 } |
| 47 for (var i = 0; i < rule.properties.length; ++i) { | 53 for (var i = 0; i < rule.properties.length; ++i) { |
| 48 var property = rule.properties[i]; | 54 var property = rule.properties[i]; |
| 49 lines.push("property " + i); | 55 lines.push("property " + i); |
| 50 var propertyLines = dumpProperty(property); | 56 var propertyLines = dumpProperty(property); |
| 51 lines = lines.concat(indent(propertyLines)); | 57 lines = lines.concat(indent(propertyLines)); |
| 52 } | 58 } |
| 53 return lines; | 59 return lines; |
| 54 } | 60 } |
| 55 | 61 |
| 56 function dumpProperty(property) | 62 function dumpProperty(property) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 names[change.oldPropertyIndex] = str(oldProperty.name, "[T] "); | 121 names[change.oldPropertyIndex] = str(oldProperty.name, "[T] "); |
| 116 break; | 122 break; |
| 117 case T.NameChanged: | 123 case T.NameChanged: |
| 118 names[change.oldPropertyIndex] = str(oldProperty.name, "[M] "); | 124 names[change.oldPropertyIndex] = str(oldProperty.name, "[M] "); |
| 119 break; | 125 break; |
| 120 case T.ValueChanged: | 126 case T.ValueChanged: |
| 121 values[change.oldPropertyIndex] = str(oldProperty.value, "[M] ")
; | 127 values[change.oldPropertyIndex] = str(oldProperty.value, "[M] ")
; |
| 122 break; | 128 break; |
| 123 } | 129 } |
| 124 } | 130 } |
| 125 InspectorTest.addResult("Changes for rule: " + rule.selector); | 131 var selectorText = rule.selectors.map(selector => selector.text).join(",
"); |
| 132 InspectorTest.addResult("Changes for rule: " + selectorText); |
| 126 names = indent(names); | 133 names = indent(names); |
| 127 for (var i = 0; i < names.length; ++i) | 134 for (var i = 0; i < names.length; ++i) |
| 128 InspectorTest.addResult(names[i] + ": " + values[i]); | 135 InspectorTest.addResult(names[i] + ": " + values[i]); |
| 129 } | 136 } |
| 130 | 137 |
| 131 function str(node, prefix) | 138 function str(node, prefix) |
| 132 { | 139 { |
| 133 prefix = prefix || ""; | 140 prefix = prefix || ""; |
| 134 return prefix + node.text.trim(); | 141 return prefix + node.text.trim(); |
| 135 } | 142 } |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 } | 298 } |
| 292 if (!match) | 299 if (!match) |
| 293 return null; | 300 return null; |
| 294 var sourceRange = new WebInspector.SourceRange(match.index, match[0].length)
; | 301 var sourceRange = new WebInspector.SourceRange(match.index, match[0].length)
; |
| 295 var textRange = sourceRange.toTextRange(new WebInspector.Text(source)); | 302 var textRange = sourceRange.toTextRange(new WebInspector.Text(source)); |
| 296 return new WebInspector.SourceEdit("", textRange, newText); | 303 return new WebInspector.SourceEdit("", textRange, newText); |
| 297 } | 304 } |
| 298 | 305 |
| 299 } | 306 } |
| 300 | 307 |
| OLD | NEW |