| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 map.compiledModel().visit(onNode); | 63 map.compiledModel().visit(onNode); |
| 64 return valid ? map : null; | 64 return valid ? map : null; |
| 65 | 65 |
| 66 /** | 66 /** |
| 67 * @param {!WebInspector.SASSSupport.Node} cssNode | 67 * @param {!WebInspector.SASSSupport.Node} cssNode |
| 68 */ | 68 */ |
| 69 function onNode(cssNode) | 69 function onNode(cssNode) |
| 70 { | 70 { |
| 71 if (!(cssNode instanceof WebInspector.SASSSupport.TextNode)) | 71 if (!(cssNode instanceof WebInspector.SASSSupport.TextNode)) |
| 72 return; | 72 return; |
| 73 var entry = sourceMap.findEntry(cssNode.range.endLine, cssNode.range
.endColumn); | 73 var entry = sourceMap.findEntry(cssNode.range.startLine, cssNode.ran
ge.startColumn); |
| 74 if (!entry || !entry.sourceURL || typeof entry.sourceLineNumber ===
"undefined" || typeof entry.sourceColumnNumber === "undefined") | 74 if (!entry || !entry.sourceURL || typeof entry.sourceLineNumber ===
"undefined" || typeof entry.sourceColumnNumber === "undefined") |
| 75 return; | 75 return; |
| 76 var sassAST = models.get(entry.sourceURL); | 76 var sassAST = models.get(entry.sourceURL); |
| 77 if (!sassAST) | 77 if (!sassAST) |
| 78 return; | 78 return; |
| 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 |