| Index: third_party/WebKit/Source/devtools/front_end/sass/SASSSupport.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/sass/SASSSupport.js b/third_party/WebKit/Source/devtools/front_end/sass/SASSSupport.js
|
| index 4c9a9f691ae1182c23a9385a2e2a36d8fbcc84b1..9e4ea5c974d5200668877e101ad08d19c048d2c9 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/sass/SASSSupport.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/sass/SASSSupport.js
|
| @@ -5,14 +5,40 @@
|
| WebInspector.SASSSupport = {}
|
|
|
| /**
|
| - * @constructor
|
| + * @param {!WebInspector.CSSParser} parser
|
| * @param {string} url
|
| * @param {string} text
|
| + * @return {!Promise<!WebInspector.SASSSupport.AST>}
|
| */
|
| -WebInspector.SASSSupport.ASTDocument = function(url, text)
|
| +WebInspector.SASSSupport.parseCSS = function(parser, url, text)
|
| {
|
| - this.url = url;
|
| - this.text = text;
|
| + return parser.parsePromise(text)
|
| + .then(onParsed);
|
| +
|
| + /**
|
| + * @param {!Array.<!WebInspector.CSSParser.Rule>} parsedCSS
|
| + * @return {!WebInspector.SASSSupport.AST}
|
| + */
|
| + function onParsed(parsedCSS)
|
| + {
|
| + var document = new WebInspector.SASSSupport.ASTDocument(url, text);
|
| + var rules = [];
|
| + for (var i = 0; i < parsedCSS.length; ++i) {
|
| + var rule = parsedCSS[i];
|
| + if (!rule.properties)
|
| + continue;
|
| + var properties = [];
|
| + for (var j = 0; j < rule.properties.length; ++j) {
|
| + var cssProperty = rule.properties[j];
|
| + var name = new WebInspector.SASSSupport.TextNode(document, cssProperty.name, WebInspector.TextRange.fromObject(cssProperty.nameRange));
|
| + var value = new WebInspector.SASSSupport.TextNode(document, cssProperty.value, WebInspector.TextRange.fromObject(cssProperty.valueRange));
|
| + var property = new WebInspector.SASSSupport.Property(document, name, value, WebInspector.TextRange.fromObject(cssProperty.range), !!cssProperty.disabled);
|
| + properties.push(property);
|
| + }
|
| + rules.push(new WebInspector.SASSSupport.Rule(document, rule.selectorText, properties));
|
| + }
|
| + return new WebInspector.SASSSupport.AST(document, rules);
|
| + }
|
| }
|
|
|
| /**
|
| @@ -208,6 +234,17 @@ WebInspector.SASSSupport._innerParseSCSS = function(document, tokenizerFactory)
|
|
|
| /**
|
| * @constructor
|
| + * @param {string} url
|
| + * @param {string} text
|
| + */
|
| +WebInspector.SASSSupport.ASTDocument = function(url, text)
|
| +{
|
| + this.url = url;
|
| + this.text = text;
|
| +}
|
| +
|
| +/**
|
| + * @constructor
|
| * @param {!WebInspector.SASSSupport.ASTDocument} document
|
| */
|
| WebInspector.SASSSupport.Node = function(document)
|
|
|