OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 WebInspector.SASSSupport = {} | 5 WebInspector.SASSSupport = {}; |
6 | 6 |
7 /** | 7 /** |
8 * @param {string} url | 8 * @param {string} url |
9 * @param {string} content | 9 * @param {string} content |
10 * @return {!Promise<!WebInspector.SASSSupport.AST>} | 10 * @return {!Promise<!WebInspector.SASSSupport.AST>} |
11 */ | 11 */ |
12 WebInspector.SASSSupport.parseSCSS = function(url, content) | 12 WebInspector.SASSSupport.parseSCSS = function(url, content) |
13 { | 13 { |
14 var text = new WebInspector.Text(content); | 14 var text = new WebInspector.Text(content); |
15 var document = new WebInspector.SASSSupport.ASTDocument(url, text); | 15 var document = new WebInspector.SASSSupport.ASTDocument(url, text); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 /** | 50 /** |
51 * @param {!Object} payload | 51 * @param {!Object} payload |
52 */ | 52 */ |
53 function createProperty(payload) | 53 function createProperty(payload) |
54 { | 54 { |
55 var name = createTextNode(payload.name); | 55 var name = createTextNode(payload.name); |
56 var value = createTextNode(payload.value); | 56 var value = createTextNode(payload.value); |
57 return new WebInspector.SASSSupport.Property(document, name, value, WebI
nspector.TextRange.fromObject(payload.range), payload.disabled); | 57 return new WebInspector.SASSSupport.Property(document, name, value, WebI
nspector.TextRange.fromObject(payload.range), payload.disabled); |
58 } | 58 } |
59 } | 59 }; |
60 | 60 |
61 /** | 61 /** |
62 * @constructor | 62 * @constructor |
63 * @param {string} url | 63 * @param {string} url |
64 * @param {!WebInspector.Text} text | 64 * @param {!WebInspector.Text} text |
65 */ | 65 */ |
66 WebInspector.SASSSupport.ASTDocument = function(url, text) | 66 WebInspector.SASSSupport.ASTDocument = function(url, text) |
67 { | 67 { |
68 this.url = url; | 68 this.url = url; |
69 this.text = text; | 69 this.text = text; |
70 this.edits = []; | 70 this.edits = []; |
71 } | 71 }; |
72 | 72 |
73 WebInspector.SASSSupport.ASTDocument.prototype = { | 73 WebInspector.SASSSupport.ASTDocument.prototype = { |
74 /** | 74 /** |
75 * @return {!WebInspector.SASSSupport.ASTDocument} | 75 * @return {!WebInspector.SASSSupport.ASTDocument} |
76 */ | 76 */ |
77 clone: function() | 77 clone: function() |
78 { | 78 { |
79 return new WebInspector.SASSSupport.ASTDocument(this.url, this.text); | 79 return new WebInspector.SASSSupport.ASTDocument(this.url, this.text); |
80 }, | 80 }, |
81 | 81 |
(...skipping 26 matching lines...) Expand all Loading... |
108 */ | 108 */ |
109 function sequentialOrder(edit1, edit2) | 109 function sequentialOrder(edit1, edit2) |
110 { | 110 { |
111 var range1 = edit1.oldRange.collapseToStart(); | 111 var range1 = edit1.oldRange.collapseToStart(); |
112 var range2 = edit2.oldRange.collapseToStart(); | 112 var range2 = edit2.oldRange.collapseToStart(); |
113 if (range1.equal(range2)) | 113 if (range1.equal(range2)) |
114 return 0; | 114 return 0; |
115 return range1.follows(range2) ? 1 : -1; | 115 return range1.follows(range2) ? 1 : -1; |
116 } | 116 } |
117 }, | 117 }, |
118 } | 118 }; |
119 | 119 |
120 /** | 120 /** |
121 * @constructor | 121 * @constructor |
122 * @param {!WebInspector.SASSSupport.ASTDocument} document | 122 * @param {!WebInspector.SASSSupport.ASTDocument} document |
123 */ | 123 */ |
124 WebInspector.SASSSupport.Node = function(document) | 124 WebInspector.SASSSupport.Node = function(document) |
125 { | 125 { |
126 this.document = document; | 126 this.document = document; |
127 } | 127 }; |
128 | 128 |
129 /** | 129 /** |
130 * @constructor | 130 * @constructor |
131 * @extends {WebInspector.SASSSupport.Node} | 131 * @extends {WebInspector.SASSSupport.Node} |
132 * @param {!WebInspector.SASSSupport.ASTDocument} document | 132 * @param {!WebInspector.SASSSupport.ASTDocument} document |
133 * @param {string} text | 133 * @param {string} text |
134 * @param {!WebInspector.TextRange} range | 134 * @param {!WebInspector.TextRange} range |
135 */ | 135 */ |
136 WebInspector.SASSSupport.TextNode = function(document, text, range) | 136 WebInspector.SASSSupport.TextNode = function(document, text, range) |
137 { | 137 { |
138 WebInspector.SASSSupport.Node.call(this, document); | 138 WebInspector.SASSSupport.Node.call(this, document); |
139 this.text = text; | 139 this.text = text; |
140 this.range = range; | 140 this.range = range; |
141 } | 141 }; |
142 | 142 |
143 WebInspector.SASSSupport.TextNode.prototype = { | 143 WebInspector.SASSSupport.TextNode.prototype = { |
144 /** | 144 /** |
145 * @param {string} newText | 145 * @param {string} newText |
146 */ | 146 */ |
147 setText: function(newText) | 147 setText: function(newText) |
148 { | 148 { |
149 if (this.text === newText) | 149 if (this.text === newText) |
150 return; | 150 return; |
151 this.text = newText; | 151 this.text = newText; |
(...skipping 17 matching lines...) Expand all Loading... |
169 match: function(other, outNodeMapping) | 169 match: function(other, outNodeMapping) |
170 { | 170 { |
171 if (this.text.trim() !== other.text.trim()) | 171 if (this.text.trim() !== other.text.trim()) |
172 return false; | 172 return false; |
173 if (outNodeMapping) | 173 if (outNodeMapping) |
174 outNodeMapping.set(this, other); | 174 outNodeMapping.set(this, other); |
175 return true; | 175 return true; |
176 }, | 176 }, |
177 | 177 |
178 __proto__: WebInspector.SASSSupport.Node.prototype | 178 __proto__: WebInspector.SASSSupport.Node.prototype |
179 } | 179 }; |
180 | 180 |
181 /** | 181 /** |
182 * @constructor | 182 * @constructor |
183 * @extends {WebInspector.SASSSupport.Node} | 183 * @extends {WebInspector.SASSSupport.Node} |
184 * @param {!WebInspector.SASSSupport.ASTDocument} document | 184 * @param {!WebInspector.SASSSupport.ASTDocument} document |
185 * @param {!WebInspector.SASSSupport.TextNode} name | 185 * @param {!WebInspector.SASSSupport.TextNode} name |
186 * @param {!WebInspector.SASSSupport.TextNode} value | 186 * @param {!WebInspector.SASSSupport.TextNode} value |
187 * @param {!WebInspector.TextRange} range | 187 * @param {!WebInspector.TextRange} range |
188 * @param {boolean} disabled | 188 * @param {boolean} disabled |
189 */ | 189 */ |
190 WebInspector.SASSSupport.Property = function(document, name, value, range, disab
led) | 190 WebInspector.SASSSupport.Property = function(document, name, value, range, disab
led) |
191 { | 191 { |
192 WebInspector.SASSSupport.Node.call(this, document); | 192 WebInspector.SASSSupport.Node.call(this, document); |
193 this.name = name; | 193 this.name = name; |
194 this.value = value; | 194 this.value = value; |
195 this.range = range; | 195 this.range = range; |
196 this.name.parent = this; | 196 this.name.parent = this; |
197 this.value.parent = this; | 197 this.value.parent = this; |
198 this.disabled = disabled; | 198 this.disabled = disabled; |
199 } | 199 }; |
200 | 200 |
201 WebInspector.SASSSupport.Property.prototype = { | 201 WebInspector.SASSSupport.Property.prototype = { |
202 /** | 202 /** |
203 * @param {!WebInspector.SASSSupport.ASTDocument} document | 203 * @param {!WebInspector.SASSSupport.ASTDocument} document |
204 * @return {!WebInspector.SASSSupport.Property} | 204 * @return {!WebInspector.SASSSupport.Property} |
205 */ | 205 */ |
206 clone: function(document) | 206 clone: function(document) |
207 { | 207 { |
208 return new WebInspector.SASSSupport.Property(document, this.name.clone(d
ocument), this.value.clone(document), this.range.clone(), this.disabled); | 208 return new WebInspector.SASSSupport.Property(document, this.name.clone(d
ocument), this.value.clone(document), this.range.clone(), this.disabled); |
209 }, | 209 }, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 var lineRange = new WebInspector.TextRange(this.range.startLine, 0, this
.range.endLine + 1, 0); | 269 var lineRange = new WebInspector.TextRange(this.range.startLine, 0, this
.range.endLine + 1, 0); |
270 var oldRange; | 270 var oldRange; |
271 if (this.document.text.extract(lineRange).trim() === this.document.text.
extract(this.range).trim()) | 271 if (this.document.text.extract(lineRange).trim() === this.document.text.
extract(this.range).trim()) |
272 oldRange = lineRange; | 272 oldRange = lineRange; |
273 else | 273 else |
274 oldRange = this.range; | 274 oldRange = this.range; |
275 this.document.edits.push(new WebInspector.SourceEdit(this.document.url,
oldRange, "")); | 275 this.document.edits.push(new WebInspector.SourceEdit(this.document.url,
oldRange, "")); |
276 }, | 276 }, |
277 | 277 |
278 __proto__: WebInspector.SASSSupport.Node.prototype | 278 __proto__: WebInspector.SASSSupport.Node.prototype |
279 } | 279 }; |
280 | 280 |
281 /** | 281 /** |
282 * @constructor | 282 * @constructor |
283 * @extends {WebInspector.SASSSupport.Node} | 283 * @extends {WebInspector.SASSSupport.Node} |
284 * @param {!WebInspector.SASSSupport.ASTDocument} document | 284 * @param {!WebInspector.SASSSupport.ASTDocument} document |
285 * @param {!Array<!WebInspector.SASSSupport.TextNode>} selectors | 285 * @param {!Array<!WebInspector.SASSSupport.TextNode>} selectors |
286 * @param {!WebInspector.TextRange} styleRange | 286 * @param {!WebInspector.TextRange} styleRange |
287 * @param {!Array<!WebInspector.SASSSupport.Property>} properties | 287 * @param {!Array<!WebInspector.SASSSupport.Property>} properties |
288 */ | 288 */ |
289 WebInspector.SASSSupport.Rule = function(document, selectors, styleRange, proper
ties) | 289 WebInspector.SASSSupport.Rule = function(document, selectors, styleRange, proper
ties) |
290 { | 290 { |
291 WebInspector.SASSSupport.Node.call(this, document); | 291 WebInspector.SASSSupport.Node.call(this, document); |
292 this.selectors = selectors; | 292 this.selectors = selectors; |
293 this.properties = properties; | 293 this.properties = properties; |
294 this.styleRange = styleRange; | 294 this.styleRange = styleRange; |
295 | 295 |
296 var blockStartRange = styleRange.collapseToStart(); | 296 var blockStartRange = styleRange.collapseToStart(); |
297 blockStartRange.startColumn -= 1; | 297 blockStartRange.startColumn -= 1; |
298 this.blockStart = new WebInspector.SASSSupport.TextNode(document, this.docum
ent.text.extract(blockStartRange), blockStartRange); | 298 this.blockStart = new WebInspector.SASSSupport.TextNode(document, this.docum
ent.text.extract(blockStartRange), blockStartRange); |
299 this.blockStart.parent = this; | 299 this.blockStart.parent = this; |
300 | 300 |
301 for (var i = 0; i < this.properties.length; ++i) | 301 for (var i = 0; i < this.properties.length; ++i) |
302 this.properties[i].parent = this; | 302 this.properties[i].parent = this; |
303 | 303 |
304 this._hasTrailingSemicolon = !this.properties.length || this.document.text.e
xtract(this.properties.peekLast().range).endsWith(";"); | 304 this._hasTrailingSemicolon = !this.properties.length || this.document.text.e
xtract(this.properties.peekLast().range).endsWith(";"); |
305 } | 305 }; |
306 | 306 |
307 WebInspector.SASSSupport.Rule.prototype = { | 307 WebInspector.SASSSupport.Rule.prototype = { |
308 /** | 308 /** |
309 * @param {!WebInspector.SASSSupport.ASTDocument} document | 309 * @param {!WebInspector.SASSSupport.ASTDocument} document |
310 * @return {!WebInspector.SASSSupport.Rule} | 310 * @return {!WebInspector.SASSSupport.Rule} |
311 */ | 311 */ |
312 clone: function(document) | 312 clone: function(document) |
313 { | 313 { |
314 var properties = []; | 314 var properties = []; |
315 for (var i = 0; i < this.properties.length; ++i) | 315 for (var i = 0; i < this.properties.length; ++i) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 for (var i = 0; result && i < this.properties.length; ++i) | 352 for (var i = 0; result && i < this.properties.length; ++i) |
353 result = result && this.properties[i].match(other.properties[i], out
NodeMapping); | 353 result = result && this.properties[i].match(other.properties[i], out
NodeMapping); |
354 return result; | 354 return result; |
355 }, | 355 }, |
356 | 356 |
357 _addTrailingSemicolon: function() | 357 _addTrailingSemicolon: function() |
358 { | 358 { |
359 if (this._hasTrailingSemicolon || !this.properties) | 359 if (this._hasTrailingSemicolon || !this.properties) |
360 return; | 360 return; |
361 this._hasTrailingSemicolon = true; | 361 this._hasTrailingSemicolon = true; |
362 this.document.edits.push(new WebInspector.SourceEdit(this.document.url,
this.properties.peekLast().range.collapseToEnd(), ";")) | 362 this.document.edits.push(new WebInspector.SourceEdit(this.document.url,
this.properties.peekLast().range.collapseToEnd(), ";")); |
363 }, | 363 }, |
364 | 364 |
365 /** | 365 /** |
366 * @param {?WebInspector.SASSSupport.Property} anchorProperty | 366 * @param {?WebInspector.SASSSupport.Property} anchorProperty |
367 * @param {!Array<string>} nameTexts | 367 * @param {!Array<string>} nameTexts |
368 * @param {!Array<string>} valueTexts | 368 * @param {!Array<string>} valueTexts |
369 * @param {!Array<boolean>} disabledStates | 369 * @param {!Array<boolean>} disabledStates |
370 * @return {!Array<!WebInspector.SASSSupport.Property>} | 370 * @return {!Array<!WebInspector.SASSSupport.Property>} |
371 */ | 371 */ |
372 insertProperties: function(anchorProperty, nameTexts, valueTexts, disabledSt
ates) | 372 insertProperties: function(anchorProperty, nameTexts, valueTexts, disabledSt
ates) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 } else { | 422 } else { |
423 var lineNumber = this.blockStart.range.startLine; | 423 var lineNumber = this.blockStart.range.startLine; |
424 var columnNumber = this.blockStart.range.startColumn; | 424 var columnNumber = this.blockStart.range.startColumn; |
425 var baseLine = this.document.text.extract(new WebInspector.TextRange
(lineNumber, 0, lineNumber, columnNumber)); | 425 var baseLine = this.document.text.extract(new WebInspector.TextRange
(lineNumber, 0, lineNumber, columnNumber)); |
426 result = WebInspector.TextUtils.lineIndent(baseLine) + WebInspector.
moduleSetting("textEditorIndent").get(); | 426 result = WebInspector.TextUtils.lineIndent(baseLine) + WebInspector.
moduleSetting("textEditorIndent").get(); |
427 } | 427 } |
428 return result.isWhitespace() ? result : ""; | 428 return result.isWhitespace() ? result : ""; |
429 }, | 429 }, |
430 | 430 |
431 __proto__: WebInspector.SASSSupport.Node.prototype | 431 __proto__: WebInspector.SASSSupport.Node.prototype |
432 } | 432 }; |
433 | 433 |
434 /** | 434 /** |
435 * @constructor | 435 * @constructor |
436 * @extends {WebInspector.SASSSupport.Node} | 436 * @extends {WebInspector.SASSSupport.Node} |
437 * @param {!WebInspector.SASSSupport.ASTDocument} document | 437 * @param {!WebInspector.SASSSupport.ASTDocument} document |
438 * @param {!Array<!WebInspector.SASSSupport.Rule>} rules | 438 * @param {!Array<!WebInspector.SASSSupport.Rule>} rules |
439 */ | 439 */ |
440 WebInspector.SASSSupport.AST = function(document, rules) | 440 WebInspector.SASSSupport.AST = function(document, rules) |
441 { | 441 { |
442 WebInspector.SASSSupport.Node.call(this, document); | 442 WebInspector.SASSSupport.Node.call(this, document); |
443 this.rules = rules; | 443 this.rules = rules; |
444 for (var i = 0; i < rules.length; ++i) | 444 for (var i = 0; i < rules.length; ++i) |
445 rules[i].parent = this; | 445 rules[i].parent = this; |
446 } | 446 }; |
447 | 447 |
448 WebInspector.SASSSupport.AST.prototype = { | 448 WebInspector.SASSSupport.AST.prototype = { |
449 /** | 449 /** |
450 * @return {!WebInspector.SASSSupport.AST} | 450 * @return {!WebInspector.SASSSupport.AST} |
451 */ | 451 */ |
452 clone: function() | 452 clone: function() |
453 { | 453 { |
454 var document = this.document.clone(); | 454 var document = this.document.clone(); |
455 var rules = []; | 455 var rules = []; |
456 for (var i = 0; i < this.rules.length; ++i) | 456 for (var i = 0; i < this.rules.length; ++i) |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 * @param {!WebInspector.SASSSupport.TextNode} text2 | 536 * @param {!WebInspector.SASSSupport.TextNode} text2 |
537 * @return {number} | 537 * @return {number} |
538 */ | 538 */ |
539 function nodeComparator(text1, text2) | 539 function nodeComparator(text1, text2) |
540 { | 540 { |
541 return WebInspector.TextRange.comparator(text1.range, text2.range); | 541 return WebInspector.TextRange.comparator(text1.range, text2.range); |
542 } | 542 } |
543 }, | 543 }, |
544 | 544 |
545 __proto__: WebInspector.SASSSupport.Node.prototype | 545 __proto__: WebInspector.SASSSupport.Node.prototype |
546 } | 546 }; |
547 | 547 |
548 /** @enum {string} */ | 548 /** @enum {string} */ |
549 WebInspector.SASSSupport.PropertyChangeType = { | 549 WebInspector.SASSSupport.PropertyChangeType = { |
550 PropertyAdded: "PropertyAdded", | 550 PropertyAdded: "PropertyAdded", |
551 PropertyRemoved: "PropertyRemoved", | 551 PropertyRemoved: "PropertyRemoved", |
552 PropertyToggled: "PropertyToggled", | 552 PropertyToggled: "PropertyToggled", |
553 ValueChanged: "ValueChanged", | 553 ValueChanged: "ValueChanged", |
554 NameChanged: "NameChanged" | 554 NameChanged: "NameChanged" |
555 } | 555 }; |
556 | 556 |
557 /** | 557 /** |
558 * @constructor | 558 * @constructor |
559 * @param {!WebInspector.SASSSupport.PropertyChangeType} type | 559 * @param {!WebInspector.SASSSupport.PropertyChangeType} type |
560 * @param {!WebInspector.SASSSupport.Rule} oldRule | 560 * @param {!WebInspector.SASSSupport.Rule} oldRule |
561 * @param {!WebInspector.SASSSupport.Rule} newRule | 561 * @param {!WebInspector.SASSSupport.Rule} newRule |
562 * @param {number} oldPropertyIndex | 562 * @param {number} oldPropertyIndex |
563 * @param {number} newPropertyIndex | 563 * @param {number} newPropertyIndex |
564 */ | 564 */ |
565 WebInspector.SASSSupport.PropertyChange = function(type, oldRule, newRule, oldPr
opertyIndex, newPropertyIndex) | 565 WebInspector.SASSSupport.PropertyChange = function(type, oldRule, newRule, oldPr
opertyIndex, newPropertyIndex) |
566 { | 566 { |
567 this.type = type; | 567 this.type = type; |
568 this.oldRule = oldRule; | 568 this.oldRule = oldRule; |
569 this.newRule = newRule; | 569 this.newRule = newRule; |
570 this.oldPropertyIndex = oldPropertyIndex; | 570 this.oldPropertyIndex = oldPropertyIndex; |
571 this.newPropertyIndex = newPropertyIndex; | 571 this.newPropertyIndex = newPropertyIndex; |
572 } | 572 }; |
573 | 573 |
574 WebInspector.SASSSupport.PropertyChange.prototype = { | 574 WebInspector.SASSSupport.PropertyChange.prototype = { |
575 /** | 575 /** |
576 * @return {?WebInspector.SASSSupport.Property} | 576 * @return {?WebInspector.SASSSupport.Property} |
577 */ | 577 */ |
578 oldProperty: function() | 578 oldProperty: function() |
579 { | 579 { |
580 return this.oldRule.properties[this.oldPropertyIndex] || null; | 580 return this.oldRule.properties[this.oldPropertyIndex] || null; |
581 }, | 581 }, |
582 | 582 |
583 /** | 583 /** |
584 * @return {?WebInspector.SASSSupport.Property} | 584 * @return {?WebInspector.SASSSupport.Property} |
585 */ | 585 */ |
586 newProperty: function() | 586 newProperty: function() |
587 { | 587 { |
588 return this.newRule.properties[this.newPropertyIndex] || null; | 588 return this.newRule.properties[this.newPropertyIndex] || null; |
589 } | 589 } |
590 } | 590 }; |
591 | 591 |
592 /** | 592 /** |
593 * @constructor | 593 * @constructor |
594 * @param {string} url | 594 * @param {string} url |
595 * @param {!WebInspector.SASSSupport.AST} oldAST | 595 * @param {!WebInspector.SASSSupport.AST} oldAST |
596 * @param {!WebInspector.SASSSupport.AST} newAST | 596 * @param {!WebInspector.SASSSupport.AST} newAST |
597 * @param {!Map<!WebInspector.SASSSupport.TextNode, !WebInspector.SASSSupport.Te
xtNode>} mapping | 597 * @param {!Map<!WebInspector.SASSSupport.TextNode, !WebInspector.SASSSupport.Te
xtNode>} mapping |
598 * @param {!Array<!WebInspector.SASSSupport.PropertyChange>} changes | 598 * @param {!Array<!WebInspector.SASSSupport.PropertyChange>} changes |
599 */ | 599 */ |
600 WebInspector.SASSSupport.ASTDiff = function(url, oldAST, newAST, mapping, change
s) | 600 WebInspector.SASSSupport.ASTDiff = function(url, oldAST, newAST, mapping, change
s) |
601 { | 601 { |
602 this.url = url; | 602 this.url = url; |
603 this.mapping = mapping; | 603 this.mapping = mapping; |
604 this.changes = changes; | 604 this.changes = changes; |
605 this.oldAST = oldAST; | 605 this.oldAST = oldAST; |
606 this.newAST = newAST; | 606 this.newAST = newAST; |
607 } | 607 }; |
608 | 608 |
609 /** | 609 /** |
610 * @param {!WebInspector.SASSSupport.AST} oldAST | 610 * @param {!WebInspector.SASSSupport.AST} oldAST |
611 * @param {!WebInspector.SASSSupport.AST} newAST | 611 * @param {!WebInspector.SASSSupport.AST} newAST |
612 * @return {!WebInspector.SASSSupport.ASTDiff} | 612 * @return {!WebInspector.SASSSupport.ASTDiff} |
613 */ | 613 */ |
614 WebInspector.SASSSupport.diffModels = function(oldAST, newAST) | 614 WebInspector.SASSSupport.diffModels = function(oldAST, newAST) |
615 { | 615 { |
616 console.assert(oldAST.rules.length === newAST.rules.length, "Not implemented
for rule diff."); | 616 console.assert(oldAST.rules.length === newAST.rules.length, "Not implemented
for rule diff."); |
617 console.assert(oldAST.document.url === newAST.document.url, "Diff makes sens
e for models with the same url."); | 617 console.assert(oldAST.document.url === newAST.document.url, "Diff makes sens
e for models with the same url."); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 var newProperty = newRule.properties[newPropertyIndex]; | 683 var newProperty = newRule.properties[newPropertyIndex]; |
684 mapping.set(oldProperty.name, newProperty.name); | 684 mapping.set(oldProperty.name, newProperty.name); |
685 mapping.set(oldProperty.value, newProperty.value); | 685 mapping.set(oldProperty.value, newProperty.value); |
686 if (oldProperty.name.text.trim() !== newProperty.name.text.trim()) | 686 if (oldProperty.name.text.trim() !== newProperty.name.text.trim()) |
687 addChange(T.NameChanged, oldRule, newRule, oldPropertyIndex, newProp
ertyIndex); | 687 addChange(T.NameChanged, oldRule, newRule, oldPropertyIndex, newProp
ertyIndex); |
688 if (oldProperty.value.text.trim() !== newProperty.value.text.trim()) | 688 if (oldProperty.value.text.trim() !== newProperty.value.text.trim()) |
689 addChange(T.ValueChanged, oldRule, newRule, oldPropertyIndex, newPro
pertyIndex); | 689 addChange(T.ValueChanged, oldRule, newRule, oldPropertyIndex, newPro
pertyIndex); |
690 if (oldProperty.disabled !== newProperty.disabled) | 690 if (oldProperty.disabled !== newProperty.disabled) |
691 addChange(T.PropertyToggled, oldRule, newRule, oldPropertyIndex, new
PropertyIndex); | 691 addChange(T.PropertyToggled, oldRule, newRule, oldPropertyIndex, new
PropertyIndex); |
692 } | 692 } |
693 } | 693 }; |
OLD | NEW |