aboutsummaryrefslogtreecommitdiffstats
path: root/theme-compiler/src/com/vaadin/sass/tree/RuleNode.java
diff options
context:
space:
mode:
authorMarc Englund <marc@vaadin.com>2012-09-11 16:27:05 +0300
committerMarc Englund <marc@vaadin.com>2012-09-11 16:27:28 +0300
commitc9e8218799152dd90bacb6c8b92b648a951aca24 (patch)
tree88838e0fdaf1257258d2e3d5eaffd7cb88819ab6 /theme-compiler/src/com/vaadin/sass/tree/RuleNode.java
parent6ccbb9e40ebb160d2bc1a57c5b5293c4f87d0b27 (diff)
downloadvaadin-framework-c9e8218799152dd90bacb6c8b92b648a951aca24.tar.gz
vaadin-framework-c9e8218799152dd90bacb6c8b92b648a951aca24.zip
Applying patch: remak of variable handling in sass (partial for e.g #9492 and others)
Diffstat (limited to 'theme-compiler/src/com/vaadin/sass/tree/RuleNode.java')
-rw-r--r--theme-compiler/src/com/vaadin/sass/tree/RuleNode.java34
1 files changed, 33 insertions, 1 deletions
diff --git a/theme-compiler/src/com/vaadin/sass/tree/RuleNode.java b/theme-compiler/src/com/vaadin/sass/tree/RuleNode.java
index 3b51468e1d..fe52844979 100644
--- a/theme-compiler/src/com/vaadin/sass/tree/RuleNode.java
+++ b/theme-compiler/src/com/vaadin/sass/tree/RuleNode.java
@@ -16,9 +16,13 @@
package com.vaadin.sass.tree;
+import java.util.ArrayList;
+
import org.w3c.css.sac.LexicalUnit;
-public class RuleNode extends Node {
+import com.vaadin.sass.parser.LexicalUnitImpl;
+
+public class RuleNode extends Node implements IVariableNode {
private static final long serialVersionUID = 6653493127869037022L;
String variable;
@@ -77,4 +81,32 @@ public class RuleNode extends Node {
this.comment = comment;
}
+ @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());
+ }
+ }
+ }
+ } else {
+ while (current != null) {
+ if (current.getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE
+ && current.toString()
+ .contains("$" + node.getName())) {
+
+ ((LexicalUnitImpl) current)
+ .replaceValue(node.getExpr());
+ }
+ current = current.getNextLexicalUnit();
+ }
+ }
+ }
+ }
}