diff options
author | Marc Englund <marc@vaadin.com> | 2012-09-21 11:52:52 +0300 |
---|---|---|
committer | Marc Englund <marc@vaadin.com> | 2012-09-21 11:53:22 +0300 |
commit | 8b28ea439cf09b69574009337c2659dd653d3760 (patch) | |
tree | c7e28e1e29b5608115b84f7b0b0cc334fd312455 /theme-compiler/src/com/vaadin/sass/tree/RuleNode.java | |
parent | 9500a714336d6f08b47f7cba980fc82faf318ef3 (diff) | |
download | vaadin-framework-8b28ea439cf09b69574009337c2659dd653d3760.tar.gz vaadin-framework-8b28ea439cf09b69574009337c2659dd653d3760.zip |
Big SassCompiler change, fixes #9411 #9489 partials for #9354 #9545 #9380 (applied patch)
Diffstat (limited to 'theme-compiler/src/com/vaadin/sass/tree/RuleNode.java')
-rw-r--r-- | theme-compiler/src/com/vaadin/sass/tree/RuleNode.java | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/theme-compiler/src/com/vaadin/sass/tree/RuleNode.java b/theme-compiler/src/com/vaadin/sass/tree/RuleNode.java index fe52844979..ee8d8145f1 100644 --- a/theme-compiler/src/com/vaadin/sass/tree/RuleNode.java +++ b/theme-compiler/src/com/vaadin/sass/tree/RuleNode.java @@ -18,19 +18,17 @@ package com.vaadin.sass.tree; import java.util.ArrayList; -import org.w3c.css.sac.LexicalUnit; - import com.vaadin.sass.parser.LexicalUnitImpl; public class RuleNode extends Node implements IVariableNode { private static final long serialVersionUID = 6653493127869037022L; String variable; - LexicalUnit value; + LexicalUnitImpl value; String comment; private boolean important; - public RuleNode(String variable, LexicalUnit value, boolean important, + public RuleNode(String variable, LexicalUnitImpl value, boolean important, String comment) { this.variable = variable; this.value = value; @@ -46,11 +44,11 @@ public class RuleNode extends Node implements IVariableNode { this.variable = variable; } - public LexicalUnit getValue() { + public LexicalUnitImpl getValue() { return value; } - public void setValue(LexicalUnit value) { + public void setValue(LexicalUnitImpl value) { this.value = value; } @@ -84,25 +82,43 @@ public class RuleNode extends Node implements IVariableNode { @Override public void replaceVariables(ArrayList<VariableNode> variables) { for (final VariableNode node : variables) { - LexicalUnit current = value; - if (current.getLexicalUnitType() == LexicalUnitImpl.SAC_FUNCTION) { - if (current.getParameters().toString().contains(node.getName())) { - LexicalUnit param = value.getParameters(); - if (param != null) { - if (param.toString().contains(node.getName())) { - ((LexicalUnitImpl) param).replaceValue(node - .getExpr()); + if (value.getLexicalUnitType() == LexicalUnitImpl.SAC_FUNCTION) { + if (value.getParameters().toString().contains(node.getName())) { + if (value.getParameters() != null) { + if (value.getParameters().toString() + .contains("$" + node.getName())) { + + LexicalUnitImpl param = value.getParameters(); + while (param != null) { + if (param.getValue().toString() + .contains(node.getName())) { + + LexicalUnitImpl expr = node.getExpr(); + + LexicalUnitImpl prev = param + .getPreviousLexicalUnit(); + LexicalUnitImpl next = param + .getNextLexicalUnit(); + + if (param.getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE) { + param.replaceValue(expr); + param.setPrevLexicalUnit(prev); + param.setNextLexicalUnit(next); + } + } + param = param.getNextLexicalUnit(); + } } } } } else { + LexicalUnitImpl current = value; while (current != null) { if (current.getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE - && current.toString() - .contains("$" + node.getName())) { + && current.getValue().toString() + .equals(node.getName())) { - ((LexicalUnitImpl) current) - .replaceValue(node.getExpr()); + current.replaceValue(node.getExpr()); } current = current.getNextLexicalUnit(); } |