| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @implements {WebInspector.SourceMapFactory} | 7 * @implements {WebInspector.SourceMapFactory} |
| 8 */ | 8 */ |
| 9 WebInspector.SASSSourceMapFactory = function() | 9 WebInspector.SASSSourceMapFactory = function() |
| 10 { | 10 { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 var models = new Map(); | 33 var models = new Map(); |
| 34 var promises = []; | 34 var promises = []; |
| 35 for (let url of sourceMap.sourceURLs()) { | 35 for (let url of sourceMap.sourceURLs()) { |
| 36 var contentProvider = sourceMap.sourceContentProvider(url, WebInspec
tor.resourceTypes.SourceMapStyleSheet); | 36 var contentProvider = sourceMap.sourceContentProvider(url, WebInspec
tor.resourceTypes.SourceMapStyleSheet); |
| 37 var sassPromise = contentProvider.requestContent() | 37 var sassPromise = contentProvider.requestContent() |
| 38 .then(text => this._astService.parseSCSS(url, text || "")) | 38 .then(text => this._astService.parseSCSS(url, text || "")) |
| 39 .then(ast => models.set(ast.document.url, ast)); | 39 .then(ast => models.set(ast.document.url, ast)); |
| 40 promises.push(sassPromise); | 40 promises.push(sassPromise); |
| 41 } | 41 } |
| 42 var cssURL = sourceMap.compiledURL(); | 42 var cssURL = sourceMap.compiledURL(); |
| 43 var cssPromise = header.requestContent() | 43 var cssPromise = header.originalContentProvider().requestContent() |
| 44 .then(text => this._astService.parseCSS(cssURL, text || "")) | 44 .then(text => this._astService.parseCSS(cssURL, text || "")) |
| 45 .then(ast => models.set(ast.document.url, ast)); | 45 .then(ast => models.set(ast.document.url, ast)); |
| 46 promises.push(cssPromise); | 46 promises.push(cssPromise); |
| 47 | 47 |
| 48 return Promise.all(promises) | 48 return Promise.all(promises) |
| 49 .then(this._onSourcesParsed.bind(this, sourceMap, models)) | 49 .then(this._onSourcesParsed.bind(this, sourceMap, models)) |
| 50 .catchException(/** @type {?WebInspector.SourceMap} */(null)); | 50 .catchException(/** @type {?WebInspector.SourceMap} */(null)); |
| 51 }, | 51 }, |
| 52 | 52 |
| 53 /** | 53 /** |
| (...skipping 25 matching lines...) Expand all Loading... |
| 79 var sassNode = sassAST.findNodeForPosition(entry.sourceLineNumber, e
ntry.sourceColumnNumber); | 79 var sassNode = sassAST.findNodeForPosition(entry.sourceLineNumber, e
ntry.sourceColumnNumber); |
| 80 if (!sassNode) | 80 if (!sassNode) |
| 81 return; | 81 return; |
| 82 if (cssNode.parent && (cssNode.parent instanceof WebInspector.SASSSu
pport.Property) && cssNode === cssNode.parent.name) | 82 if (cssNode.parent && (cssNode.parent instanceof WebInspector.SASSSu
pport.Property) && cssNode === cssNode.parent.name) |
| 83 valid = valid && cssNode.text.trim() === sassNode.text.trim(); | 83 valid = valid && cssNode.text.trim() === sassNode.text.trim(); |
| 84 map.addMapping(cssNode, sassNode); | 84 map.addMapping(cssNode, sassNode); |
| 85 } | 85 } |
| 86 }, | 86 }, |
| 87 } | 87 } |
| 88 | 88 |
| OLD | NEW |