diff options
author | Henri Sara <hesara@vaadin.com> | 2012-08-10 09:10:40 +0300 |
---|---|---|
committer | Henri Sara <hesara@vaadin.com> | 2012-08-10 09:10:40 +0300 |
commit | 239ce71f498fcdf2809c5561bf5028bf216265ca (patch) | |
tree | 01b7abefa7a870902c80848577d554595ea5da82 | |
parent | 0a4a462fd1e4edc71682d4b350cd03bb27700b72 (diff) | |
download | vaadin-framework-239ce71f498fcdf2809c5561bf5028bf216265ca.tar.gz vaadin-framework-239ce71f498fcdf2809c5561bf5028bf216265ca.zip |
Merge SASS fixes keeping comments, remove hack for reindeer (#9223)
8 files changed, 84 insertions, 90 deletions
diff --git a/WebContent/VAADIN/themes/reindeer/a-sprite-definitions/a-sprite-definitions.scss b/WebContent/VAADIN/themes/reindeer/a-sprite-definitions/a-sprite-definitions.scss index 87c598956f..ffa7ca349a 100644 --- a/WebContent/VAADIN/themes/reindeer/a-sprite-definitions/a-sprite-definitions.scss +++ b/WebContent/VAADIN/themes/reindeer/a-sprite-definitions/a-sprite-definitions.scss @@ -1,14 +1,14 @@ /*------------ * General vertical and horizontal sprites * -----------*/ -/** sprite: verticals; sprite-image: url(../common/img/vertical-sprites.png); sprite-layout: vertical */ -/** sprite: horizontals; sprite-image: url(../common/img/horizontal-sprites.png); sprite-layout: horizontal */ +/** sprite: verticals; sprite-image: url(common/img/vertical-sprites.png); sprite-layout: vertical */ +/** sprite: horizontals; sprite-image: url(common/img/horizontal-sprites.png); sprite-layout: horizontal */ -/** sprite: black-verticals; sprite-image: url(../common/img/black-vertical-sprites.png); sprite-layout: vertical; sprite-matte-color: #1e2022 */ -/** sprite: black-horizontals; sprite-image: url(../common/img/black-horizontal-sprites.png); sprite-layout: horizontal; sprite-matte-color: #1e2022 */ +/** sprite: black-verticals; sprite-image: url(common/img/black-vertical-sprites.png); sprite-layout: vertical; sprite-matte-color: #1e2022 */ +/** sprite: black-horizontals; sprite-image: url(common/img/black-horizontal-sprites.png); sprite-layout: horizontal; sprite-matte-color: #1e2022 */ /*------------ * Buttons * -----------*/ -/** sprite: buttons; sprite-image: url(../button/img/button-sprites.png); sprite-layout: vertical */ -/** sprite: black-buttons; sprite-image: url(../button/img/black-button-sprites.png); sprite-layout: vertical */
\ No newline at end of file +/** sprite: buttons; sprite-image: url(button/img/button-sprites.png); sprite-layout: vertical */ +/** sprite: black-buttons; sprite-image: url(button/img/black-button-sprites.png); sprite-layout: vertical */ diff --git a/WebContent/VAADIN/themes/reindeer/reindeer.scss b/WebContent/VAADIN/themes/reindeer/reindeer.scss index 6033466f63..0cd01f7885 100644 --- a/WebContent/VAADIN/themes/reindeer/reindeer.scss +++ b/WebContent/VAADIN/themes/reindeer/reindeer.scss @@ -3,7 +3,6 @@ // common between others for now for backwards compatibility @import "accordion/accordion.scss"; -// TODO this is problematic: comments get stripped out @import "a-sprite-definitions/a-sprite-definitions.scss"; @import "button/button.scss"; diff --git a/build/buildhelpers/com/vaadin/buildhelpers/CompileDefaultTheme.java b/build/buildhelpers/com/vaadin/buildhelpers/CompileDefaultTheme.java index a23e5e912e..45079ac21f 100644 --- a/build/buildhelpers/com/vaadin/buildhelpers/CompileDefaultTheme.java +++ b/build/buildhelpers/com/vaadin/buildhelpers/CompileDefaultTheme.java @@ -79,23 +79,6 @@ public class CompileDefaultTheme { + "\";}\n"); cssHeader.append(".v-theme-version-" + version + " {display: none;}\n"); - // TODO temporary hack for Reindeer - if (useSmartSprites) { - // TODO removed "../" from paths here - cssHeader - .append("/** sprite: verticals; sprite-image: url(common/img/vertical-sprites.png); sprite-layout: vertical */\n"); - cssHeader - .append("/** sprite: horizontals; sprite-image: url(common/img/horizontal-sprites.png); sprite-layout: horizontal */\n"); - cssHeader - .append("/** sprite: black-verticals; sprite-image: url(common/img/black-vertical-sprites.png); sprite-layout: vertical; sprite-matte-color: #1e2022 */\n"); - cssHeader - .append("/** sprite: black-horizontals; sprite-image: url(common/img/black-horizontal-sprites.png); sprite-layout: horizontal; sprite-matte-color: #1e2022 */\n"); - cssHeader - .append("/** sprite: buttons; sprite-image: url(button/img/button-sprites.png); sprite-layout: vertical */\n"); - cssHeader - .append("/** sprite: black-buttons; sprite-image: url(button/img/black-button-sprites.png); sprite-layout: vertical */\n"); - } - String stylesCssDir = THEME_DIR + themeName + "/"; String stylesCssName = stylesCssDir + "styles.css"; diff --git a/sass/src/com/vaadin/sass/parser/Parser.java b/sass/src/com/vaadin/sass/parser/Parser.java index 710c7d5be7..152ae1ddb2 100644 --- a/sass/src/com/vaadin/sass/parser/Parser.java +++ b/sass/src/com/vaadin/sass/parser/Parser.java @@ -25,6 +25,7 @@ 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.*; @@ -449,6 +450,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case S: jj_consume_token(S); + comments(); break; case CDO: case CDC: @@ -555,14 +557,6 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { label_7: while (true) { ; - 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(); @@ -2790,6 +2784,7 @@ LexicalUnit exp; String name; LexicalUnit exp; Token save; + String comment = null; try { name = property(); save = token; @@ -3935,6 +3930,17 @@ LexicalUnit exp; return convertStringIndex(s, 0, s.length()); } + void comments() throws ParseException { + 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; + } + } + } + void rejectToken(Token t) throws ParseException { Token fakeToken = new Token(); t.next = token; @@ -4149,6 +4155,26 @@ LexicalUnit exp; finally { jj_save(3, xla); } } + private boolean jj_3R_129() { + if (jj_scan_token(DIV)) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_scan_token(1)) { jj_scanpos = xsp; break; } + } + return false; + } + + private boolean jj_3R_119() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_129()) { + jj_scanpos = xsp; + if (jj_3R_130()) return true; + } + return false; + } + private boolean jj_3R_168() { if (jj_scan_token(UNICODERANGE)) return true; return false; @@ -4442,24 +4468,6 @@ LexicalUnit exp; return false; } - private boolean jj_3R_124() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_136()) { - jj_scanpos = xsp; - if (jj_3R_137()) { - jj_scanpos = xsp; - if (jj_3R_138()) return true; - } - } - return false; - } - - private boolean jj_3R_136() { - if (jj_scan_token(IDENT)) return true; - return false; - } - private boolean jj_3R_131() { Token xsp; xsp = jj_scanpos; @@ -4523,6 +4531,24 @@ LexicalUnit exp; return false; } + private boolean jj_3R_124() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_136()) { + jj_scanpos = xsp; + if (jj_3R_137()) { + jj_scanpos = xsp; + if (jj_3R_138()) return true; + } + } + return false; + } + + private boolean jj_3R_136() { + if (jj_scan_token(IDENT)) return true; + return false; + } + private boolean jj_3R_108() { if (jj_scan_token(IDENT)) return true; Token xsp; @@ -4533,11 +4559,6 @@ LexicalUnit exp; return false; } - private boolean jj_3R_135() { - if (jj_scan_token(PRECEDES)) return true; - return false; - } - private boolean jj_3R_120() { Token xsp; xsp = jj_scanpos; @@ -4552,6 +4573,11 @@ LexicalUnit exp; return false; } + private boolean jj_3R_135() { + if (jj_scan_token(PRECEDES)) return true; + return false; + } + private boolean jj_3R_107() { Token xsp; xsp = jj_scanpos; @@ -4681,26 +4707,6 @@ LexicalUnit exp; return false; } - private boolean jj_3R_129() { - if (jj_scan_token(DIV)) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_scan_token(1)) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_119() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_129()) { - jj_scanpos = xsp; - if (jj_3R_130()) return true; - } - return false; - } - /** Generated Token Manager. */ public ParserTokenManager token_source; /** Current token. */ diff --git a/sass/src/com/vaadin/sass/parser/Parser.jj b/sass/src/com/vaadin/sass/parser/Parser.jj index 62892c8159..c34dedc596 100644 --- a/sass/src/com/vaadin/sass/parser/Parser.jj +++ b/sass/src/com/vaadin/sass/parser/Parser.jj @@ -43,6 +43,7 @@ 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.*; @@ -700,7 +701,8 @@ void parserUnit() : try { { documentHandler.startDocument(source); } ( charset() )? - ( <S> | ignoreStatement() )* + ( <S> comments() + | ignoreStatement() )* ( importDeclaration() ( ignoreStatement() ( <S> )* )* )* afterImportDeclaration() <EOF> @@ -731,16 +733,6 @@ void afterImportDeclaration() : } { ( - { - 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() { @@ -1583,6 +1575,7 @@ void declarationOrNestedProperties() : String name; LexicalUnit exp; Token save; + String comment = null; } { try { @@ -2355,6 +2348,18 @@ String convertString(String s) { return convertStringIndex(s, 0, s.length()); } +JAVACODE +void comments(){ + 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; + } + } +} + /* * @@HACK * I can't insert a token into the tokens flow. diff --git a/tests/sass/resources/css/comments.css b/tests/sass/resources/css/comments.css index 2a32b49ec2..1c773f7974 100644 --- a/tests/sass/resources/css/comments.css +++ b/tests/sass/resources/css/comments.css @@ -2,6 +2,8 @@ /** 1sprite: verticals; sprite-image: url(../common/img/vertical-sprites.png); sprite-layout: vertical */ +/** 2sprite: 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/scss/comments.scss b/tests/sass/resources/scss/comments.scss index 7e2ccac3b5..de3fbe8e0d 100644 --- a/tests/sass/resources/scss/comments.scss +++ b/tests/sass/resources/scss/comments.scss @@ -1,6 +1,7 @@ /** 0sprite: verticals; sprite-image: url(../common/img/vertical-sprites.png); sprite-layout: vertical */ -$black:#000000; /** 1sprite: verticals; sprite-image: url(../common/img/vertical-sprites.png); sprite-layout: vertical */ +/** 2sprite: verticals; sprite-image: url(../common/img/vertical-sprites.png); sprite-layout: vertical */ +$black:#000000; .v-button:focus { background-image: url(img/left-focus.png);/** sprite-ref: buttons */ outline: none; 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 1dcc18e568..3dbafc9d43 100644 --- a/tests/sass/src/com/vaadin/sass/testcases/scss/Comments.java +++ b/tests/sass/src/com/vaadin/sass/testcases/scss/Comments.java @@ -32,7 +32,7 @@ public class Comments extends AbstractTestBase { parser.parseStyleSheet(getClass().getResource(scss).getPath()); ScssStylesheet root = handler.getStyleSheet(); Assert.assertNotNull(root); - Assert.assertEquals(5, root.getChildren().size()); + Assert.assertEquals(6, root.getChildren().size()); Assert.assertTrue(root.getChildren().get(0) instanceof CommentNode); Assert.assertTrue(root.getChildren().get(2) instanceof CommentNode); } @@ -40,7 +40,5 @@ public class Comments extends AbstractTestBase { @Test public void testCompiler() throws Exception { testCompiler(scss, css); - Assert.assertEquals("Original CSS and parsed CSS doesn't match", - comparisonCss, parsedScss); } } |