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 * @param {!WebInspector.ASTService} astService | 7 * @param {!WebInspector.ASTService} astService |
8 * @param {!WebInspector.ASTSourceMap} map | 8 * @param {!WebInspector.ASTSourceMap} map |
9 * @param {!Array<!WebInspector.SASSProcessor.EditOperation>} editOperations | 9 * @param {!Array<!WebInspector.SASSProcessor.EditOperation>} editOperations |
10 */ | 10 */ |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 .then(onCSSParsed); | 115 .then(onCSSParsed); |
116 | 116 |
117 /** | 117 /** |
118 * @param {!WebInspector.SASSSupport.AST} newCSSAST | 118 * @param {!WebInspector.SASSSupport.AST} newCSSAST |
119 * @return {!Promise<?WebInspector.SourceMap.EditResult>} | 119 * @return {!Promise<?WebInspector.SourceMap.EditResult>} |
120 */ | 120 */ |
121 function onCSSParsed(newCSSAST) | 121 function onCSSParsed(newCSSAST) |
122 { | 122 { |
123 if (newCSSAST.rules.length !== map.compiledModel().rules.length) | 123 if (newCSSAST.rules.length !== map.compiledModel().rules.length) |
124 return Promise.resolve(/** @type {?WebInspector.SourceMap.EditResult
} */(null)); | 124 return Promise.resolve(/** @type {?WebInspector.SourceMap.EditResult
} */(null)); |
125 //TODO(lushnikov): only diff changed styles. | 125 // TODO(lushnikov): only diff changed styles. |
126 var cssDiff = WebInspector.SASSSupport.diffModels(map.compiledModel(), n
ewCSSAST); | 126 var cssDiff = WebInspector.SASSSupport.diffModels(map.compiledModel(), n
ewCSSAST); |
127 var edits = WebInspector.SASSProcessor._editsFromCSSDiff(cssDiff, map); | 127 var edits = WebInspector.SASSProcessor._editsFromCSSDiff(cssDiff, map); |
128 | 128 |
129 // Determine AST trees which will change and clone them. | 129 // Determine AST trees which will change and clone them. |
130 var changedURLs = new Set(edits.map(edit => edit.sassURL)); | 130 var changedURLs = new Set(edits.map(edit => edit.sassURL)); |
131 changedURLs.add(map.compiledURL()); | 131 changedURLs.add(map.compiledURL()); |
132 var clonedModels = []; | 132 var clonedModels = []; |
133 for (var url of changedURLs) | 133 for (var url of changedURLs) |
134 clonedModels.push(map.modelForURL(url).clone()); | 134 clonedModels.push(map.modelForURL(url).clone()); |
135 | 135 |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 * @return {!WebInspector.SASSProcessor.InsertPropertiesOperation} | 546 * @return {!WebInspector.SASSProcessor.InsertPropertiesOperation} |
547 */ | 547 */ |
548 rebase: function(newMap, nodeMapping) | 548 rebase: function(newMap, nodeMapping) |
549 { | 549 { |
550 var sassAnchor = /** @type {?WebInspector.SASSSupport.Property} */(nodeM
apping.get(this._sassAnchor)) || this._sassAnchor; | 550 var sassAnchor = /** @type {?WebInspector.SASSSupport.Property} */(nodeM
apping.get(this._sassAnchor)) || this._sassAnchor; |
551 return new WebInspector.SASSProcessor.InsertPropertiesOperation(newMap,
sassAnchor, this._insertBefore, this._nameTexts, this._valueTexts, this._disable
dStates); | 551 return new WebInspector.SASSProcessor.InsertPropertiesOperation(newMap,
sassAnchor, this._insertBefore, this._nameTexts, this._valueTexts, this._disable
dStates); |
552 }, | 552 }, |
553 | 553 |
554 __proto__: WebInspector.SASSProcessor.EditOperation.prototype | 554 __proto__: WebInspector.SASSProcessor.EditOperation.prototype |
555 } | 555 } |
OLD | NEW |