Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(681)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sass/SASSSupport.js

Issue 1712363002: Revert of DevTools: improve SCSS parser to correctly handle variable expansions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/sass/test-ast-scss-6-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 {!WebInspector.CSSParserService} cssParserService 8 * @param {!WebInspector.CSSParserService} cssParserService
9 * @param {string} url 9 * @param {string} url
10 * @param {string} text 10 * @param {string} text
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 /** @enum {string} */ 64 /** @enum {string} */
65 WebInspector.SASSSupport.SCSSParserStates = { 65 WebInspector.SASSSupport.SCSSParserStates = {
66 Initial: "Initial", 66 Initial: "Initial",
67 PropertyName: "PropertyName", 67 PropertyName: "PropertyName",
68 PropertyValue: "PropertyValue", 68 PropertyValue: "PropertyValue",
69 VariableName: "VariableName", 69 VariableName: "VariableName",
70 VariableValue: "VariableValue", 70 VariableValue: "VariableValue",
71 MixinName: "MixinName", 71 MixinName: "MixinName",
72 MixinValue: "MixinValue", 72 MixinValue: "MixinValue",
73 Media: "Media" 73 Media: "Media",
74 } 74 }
75 75
76 /** 76 /**
77 * @param {!WebInspector.SASSSupport.ASTDocument} document 77 * @param {!WebInspector.SASSSupport.ASTDocument} document
78 * @param {!WebInspector.TokenizerFactory} tokenizerFactory 78 * @param {!WebInspector.TokenizerFactory} tokenizerFactory
79 * @return {!{variables: !Array<!WebInspector.SASSSupport.Property>, properties: !Array<!WebInspector.SASSSupport.Property>, mixins: !Array<!WebInspector.SASSSu pport.Property>}} 79 * @return {!{variables: !Array<!WebInspector.SASSSupport.Property>, properties: !Array<!WebInspector.SASSSupport.Property>, mixins: !Array<!WebInspector.SASSSu pport.Property>}}
80 */ 80 */
81 WebInspector.SASSSupport._innerParseSCSS = function(document, tokenizerFactory) 81 WebInspector.SASSSupport._innerParseSCSS = function(document, tokenizerFactory)
82 { 82 {
83 var lines = document.text.split("\n"); 83 var lines = document.text.split("\n");
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 var value = new WebInspector.SASSSupport.TextNode(document, disabledProperty.value.text, valueRange); 132 var value = new WebInspector.SASSSupport.TextNode(document, disabledProperty.value.text, valueRange);
133 var range = new WebInspector.TextRange(lineNumber, column, l ineNumber, newColumn); 133 var range = new WebInspector.TextRange(lineNumber, column, l ineNumber, newColumn);
134 var property = new WebInspector.SASSSupport.Property(documen t, name, value, range, true); 134 var property = new WebInspector.SASSSupport.Property(documen t, name, value, range, true);
135 properties.push(property); 135 properties.push(property);
136 } 136 }
137 } else if (tokenType["css-def"] && tokenValue === "@media") { 137 } else if (tokenType["css-def"] && tokenValue === "@media") {
138 state = States.Media; 138 state = States.Media;
139 } 139 }
140 break; 140 break;
141 case States.VariableName: 141 case States.VariableName:
142 if (tokenValue === "}" && tokenType === UndefTokenType) { 142 if (tokenValue === ")" && tokenType === UndefTokenType) {
143 state = States.Initial;
144 } else if (tokenValue === ")" && tokenType === UndefTokenType) {
145 state = States.Initial; 143 state = States.Initial;
146 } else if (tokenValue === ":" && tokenType === UndefTokenType) { 144 } else if (tokenValue === ":" && tokenType === UndefTokenType) {
147 state = States.VariableValue; 145 state = States.VariableValue;
148 variableValue = new WebInspector.SASSSupport.TextNode(document, "", WebInspector.TextRange.createFromLocation(lineNumber, newColumn)); 146 variableValue = new WebInspector.SASSSupport.TextNode(document, "", WebInspector.TextRange.createFromLocation(lineNumber, newColumn));
149 } else if (tokenType !== UndefTokenType) { 147 } else if (tokenType !== UndefTokenType) {
150 state = States.Initial; 148 state = States.Initial;
151 } 149 }
152 break; 150 break;
153 case States.VariableValue: 151 case States.VariableValue:
154 if (tokenValue === ";" && tokenType === UndefTokenType) { 152 if (tokenValue === ";" && tokenType === UndefTokenType) {
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 mapping.set(oldProperty.name, newProperty.name); 686 mapping.set(oldProperty.name, newProperty.name);
689 mapping.set(oldProperty.value, newProperty.value); 687 mapping.set(oldProperty.value, newProperty.value);
690 if (oldProperty.name.text.trim() !== newProperty.name.text.trim()) 688 if (oldProperty.name.text.trim() !== newProperty.name.text.trim())
691 addChange(T.NameChanged, oldRule, newRule, oldPropertyIndex, newProp ertyIndex); 689 addChange(T.NameChanged, oldRule, newRule, oldPropertyIndex, newProp ertyIndex);
692 if (oldProperty.value.text.trim() !== newProperty.value.text.trim()) 690 if (oldProperty.value.text.trim() !== newProperty.value.text.trim())
693 addChange(T.ValueChanged, oldRule, newRule, oldPropertyIndex, newPro pertyIndex); 691 addChange(T.ValueChanged, oldRule, newRule, oldPropertyIndex, newPro pertyIndex);
694 if (oldProperty.disabled !== newProperty.disabled) 692 if (oldProperty.disabled !== newProperty.disabled)
695 addChange(T.PropertyToggled, oldRule, newRule, oldPropertyIndex, new PropertyIndex); 693 addChange(T.PropertyToggled, oldRule, newRule, oldPropertyIndex, new PropertyIndex);
696 } 694 }
697 } 695 }
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/sass/test-ast-scss-6-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698