summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2012-08-09 14:53:56 +0300
committerHenri Sara <hesara@vaadin.com>2012-08-09 14:53:56 +0300
commit0a4a462fd1e4edc71682d4b350cd03bb27700b72 (patch)
treedafdf5fc91784a81d54756df12e73dfc8a144002
parentef64d5becc40d85a5a27735775376062fa4ed8ff (diff)
downloadvaadin-framework-0a4a462fd1e4edc71682d4b350cd03bb27700b72.tar.gz
vaadin-framework-0a4a462fd1e4edc71682d4b350cd03bb27700b72.zip
Merge SASS change: Fixed a bug regarding replaceValue in LexicalUnitImpl
-rw-r--r--sass/src/com/vaadin/sass/parser/LexicalUnitImpl.java7
-rw-r--r--sass/src/com/vaadin/sass/parser/Parser.java12
-rw-r--r--sass/src/com/vaadin/sass/parser/Parser.jj12
-rw-r--r--sass/src/com/vaadin/sass/tree/CommentNode.java2
-rw-r--r--sass/src/com/vaadin/sass/util/ColorUtil.java2
-rw-r--r--sass/src/com/vaadin/sass/visitor/VariableVisitor.java18
-rw-r--r--tests/sass/resources/css/comments.css2
-rw-r--r--tests/sass/resources/css/variables.css2
-rw-r--r--tests/sass/resources/scss/variables.scss2
-rw-r--r--tests/sass/src/com/vaadin/sass/testcases/scss/Comments.java2
10 files changed, 39 insertions, 22 deletions
diff --git a/sass/src/com/vaadin/sass/parser/LexicalUnitImpl.java b/sass/src/com/vaadin/sass/parser/LexicalUnitImpl.java
index 2a62c0dcf9..e268da8ed5 100644
--- a/sass/src/com/vaadin/sass/parser/LexicalUnitImpl.java
+++ b/sass/src/com/vaadin/sass/parser/LexicalUnitImpl.java
@@ -572,4 +572,11 @@ public class LexicalUnitImpl implements LexicalUnit, SCSSLexicalUnit,
return new LexicalUnitImpl(SAC_OPERATOR_SLASH, line, column, previous);
}
+ @Override
+ public LexicalUnitImpl clone() {
+ LexicalUnitImpl cloned = new LexicalUnitImpl(type, line, column,
+ (LexicalUnitImpl) prev);
+ cloned.replaceValue(this);
+ return cloned;
+ }
}
diff --git a/sass/src/com/vaadin/sass/parser/Parser.java b/sass/src/com/vaadin/sass/parser/Parser.java
index cc9c39176e..710c7d5be7 100644
--- a/sass/src/com/vaadin/sass/parser/Parser.java
+++ b/sass/src/com/vaadin/sass/parser/Parser.java
@@ -25,7 +25,6 @@ import org.w3c.flute.parser.selectors.SelectorFactoryImpl;
import org.w3c.flute.parser.selectors.ConditionFactoryImpl;
import org.w3c.flute.util.Encoding;
-
import com.vaadin.sass.handler.*;
import com.vaadin.sass.tree.*;
@@ -556,9 +555,14 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants {
label_7:
while (true) {
;
- if(token.specialToken!=null){
- documentHandler.comment(token.specialToken.image);
- }
+ if (token.specialToken != null){
+ Token tmp_t = token.specialToken;
+ while (tmp_t.specialToken != null) tmp_t = tmp_t.specialToken;
+ while (tmp_t != null) {
+ documentHandler.comment(tmp_t.image);
+ tmp_t = tmp_t.next;
+ }
+ }
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case VARIABLE:
variable();
diff --git a/sass/src/com/vaadin/sass/parser/Parser.jj b/sass/src/com/vaadin/sass/parser/Parser.jj
index 2f43be5f6e..62892c8159 100644
--- a/sass/src/com/vaadin/sass/parser/Parser.jj
+++ b/sass/src/com/vaadin/sass/parser/Parser.jj
@@ -43,7 +43,6 @@ import org.w3c.flute.parser.selectors.SelectorFactoryImpl;
import org.w3c.flute.parser.selectors.ConditionFactoryImpl;
import org.w3c.flute.util.Encoding;
-
import com.vaadin.sass.handler.*;
import com.vaadin.sass.tree.*;
@@ -733,9 +732,14 @@ void afterImportDeclaration() :
{
(
{
- if(token.specialToken!=null){
- documentHandler.comment(token.specialToken.image);
- }
+ if (token.specialToken != null){
+ Token tmp_t = token.specialToken;
+ while (tmp_t.specialToken != null) tmp_t = tmp_t.specialToken;
+ while (tmp_t != null) {
+ documentHandler.comment(tmp_t.image);
+ tmp_t = tmp_t.next;
+ }
+ }
}
( variable() | mixinDirective() | includeDirective() | styleRule() | media()| page() | fontFace()
| { l = getLocator(); } ret=skipStatement()
diff --git a/sass/src/com/vaadin/sass/tree/CommentNode.java b/sass/src/com/vaadin/sass/tree/CommentNode.java
index 649d2df581..3bdb563312 100644
--- a/sass/src/com/vaadin/sass/tree/CommentNode.java
+++ b/sass/src/com/vaadin/sass/tree/CommentNode.java
@@ -21,6 +21,6 @@ public class CommentNode extends Node {
@Override
public String toString() {
- return comment.trim();
+ return comment;
}
}
diff --git a/sass/src/com/vaadin/sass/util/ColorUtil.java b/sass/src/com/vaadin/sass/util/ColorUtil.java
index 9abcf57310..fe3f8f6e9b 100644
--- a/sass/src/com/vaadin/sass/util/ColorUtil.java
+++ b/sass/src/com/vaadin/sass/util/ColorUtil.java
@@ -81,7 +81,7 @@ public class ColorUtil {
hslParam = (LexicalUnitImpl) hslParam.getNextLexicalUnit();
i++;
}
- float h = ((hue.getFloatValue() % 360) + 360) % 360 / 360;
+ float h = ((hue.getIntegerValue() % 360) + 360) % 360 / 360f;
float s = saturation.getFloatValue() / 100;
float l = lightness.getFloatValue() / 100;
float m2, m1;
diff --git a/sass/src/com/vaadin/sass/visitor/VariableVisitor.java b/sass/src/com/vaadin/sass/visitor/VariableVisitor.java
index 8a567dacae..bb790a0aee 100644
--- a/sass/src/com/vaadin/sass/visitor/VariableVisitor.java
+++ b/sass/src/com/vaadin/sass/visitor/VariableVisitor.java
@@ -52,16 +52,16 @@ public class VariableVisitor implements Visitor {
if (value == null) {
return;
}
- for (String variable : variables.keySet()) {
- if (value.getLexicalUnitType() == SCSSLexicalUnit.SCSS_VARIABLE) {
- if (value.getStringValue().contains(variable)) {
- LexicalUnitImpl lexVal = (LexicalUnitImpl) value;
- lexVal.replaceValue(variables.get(variable));
- }
- } else if (value.getLexicalUnitType() == SCSSLexicalUnit.SAC_FUNCTION) {
- LexicalUnit params = value.getParameters();
- updateValue(params, variables);
+ if (value.getLexicalUnitType() == SCSSLexicalUnit.SCSS_VARIABLE) {
+ LexicalUnitImpl variableValue = variables.get(
+ value.getStringValue()).clone();
+ if (variableValue != null) {
+ LexicalUnitImpl lexVal = (LexicalUnitImpl) value;
+ lexVal.replaceValue(variableValue);
}
+ } else if (value.getLexicalUnitType() == SCSSLexicalUnit.SAC_FUNCTION) {
+ LexicalUnit params = value.getParameters();
+ updateValue(params, variables);
}
LexicalUnit next = value.getNextLexicalUnit();
updateValue(next, variables);
diff --git a/tests/sass/resources/css/comments.css b/tests/sass/resources/css/comments.css
index 32f348da9e..2a32b49ec2 100644
--- a/tests/sass/resources/css/comments.css
+++ b/tests/sass/resources/css/comments.css
@@ -1,5 +1,7 @@
/** 0sprite: verticals; sprite-image: url(../common/img/vertical-sprites.png); sprite-layout: vertical */
+
/** 1sprite: verticals; sprite-image: url(../common/img/vertical-sprites.png); sprite-layout: vertical */
+
.v-button:focus {
background-image: url(img/left-focus.png);/** sprite-ref: buttons */
outline: none;
diff --git a/tests/sass/resources/css/variables.css b/tests/sass/resources/css/variables.css
index 7c56a24c90..d54ae6cd30 100644
--- a/tests/sass/resources/css/variables.css
+++ b/tests/sass/resources/css/variables.css
@@ -1,7 +1,7 @@
.content-navigation {
border-color: #3bbfce;
color: #0000ff;
- color1: #cc0000;
+ color1: #0000d1;
font-family: Arial, Helvetica, "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
}
diff --git a/tests/sass/resources/scss/variables.scss b/tests/sass/resources/scss/variables.scss
index 3d9dada294..60acc5dd10 100644
--- a/tests/sass/resources/scss/variables.scss
+++ b/tests/sass/resources/scss/variables.scss
@@ -6,7 +6,7 @@ $chameleon-font-family: Arial, Helvetica, "Lucida Grande", "Lucida Sans Unicode"
border-color: $blue;
$blue: #0000ff;
color: $blue;
- color1: darken($blue);
+ color1: darken($blue, 9%);
font-family: $chameleon-font-family;
}
diff --git a/tests/sass/src/com/vaadin/sass/testcases/scss/Comments.java b/tests/sass/src/com/vaadin/sass/testcases/scss/Comments.java
index a799fa9e99..1dcc18e568 100644
--- a/tests/sass/src/com/vaadin/sass/testcases/scss/Comments.java
+++ b/tests/sass/src/com/vaadin/sass/testcases/scss/Comments.java
@@ -21,7 +21,7 @@ import com.vaadin.sass.tree.CommentNode;
public class Comments extends AbstractTestBase {
String scss = "/scss/comments.scss";
- String css = "/scss/comments.css";
+ String css = "/css/comments.css";
@Test
public void testParser() throws CSSException, URISyntaxException,