diff options
author | Leif Åstrand <leif@vaadin.com> | 2013-06-07 14:12:41 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2013-06-07 14:12:41 +0300 |
commit | 808b65581554dad8b670538b1830a8f90b3db5db (patch) | |
tree | f2323317e420e7c76b17994660cdbbd0f78145b4 /theme-compiler | |
parent | fe8d330c3c9f2ae2c0ace28fa5c34e5b2b131112 (diff) | |
parent | b0574f7b33c4d3d437c8c11cd53389e5522f6999 (diff) | |
download | vaadin-framework-808b65581554dad8b670538b1830a8f90b3db5db.tar.gz vaadin-framework-808b65581554dad8b670538b1830a8f90b3db5db.zip |
Merge changes from origin/7.1
2772641 OSGi support for vaadin-push (#11691)
42c4b20 Use "\0" instead of "|" as a push message delimiter (#11692)
778de06 Derive current servlet/portlet from the current service (#11779)
f8fb8b7 Upgrade to Atmosphere 1.0.13 (#11861)
fea4c5e Don't build and publish sources for package without source files
6a7683b Disable Atmosphere version number check (#11890)
ebb92e6 Improve error message if vaadinPush.js failed to load (#11673)
70131cd Extracted common code for number conveters to abstract super class (#11900)
0b63506 Fixed order of parameters in javadoc (#11158)
6bf83a4 Modified the logic in setPropertyDatasource which determines if a new converter is needed (#11863)
53a9c11 Fix TestingPushConnection.init signature (#11673)
05ef43f Updated client-compiler to depend on client-compiler-deps 1.0.2 #11879
9686323 Added isInitialStateChange to StateChangeEvent (#10477)
7cced5e Fixed test which had never passed
ada3311 Avoid creating an instance of every view while searching for the correct view (#11722)
5b35dd9 Added text file encoding and line delimiter info (#11907)
f8c4f99 Prevent spurious "Could not determine ApplicationConnection" error when using the debug window
8a42394 Fixed locators in test (aria div conflict)
6de01ac Fix text / javascript mismatch issue in Chrome (#11275)
f7f1e3e Added Java Date to Sql Date converter to better support sql dates (#11224)
2882cf9 Added Serializable where missing and ignore classes which do not need Serializable
4d7f190 Make access() enqueue the runnable if the session is locked (#11897)
4c2b86d Stop using PlaceHolder widgets in VTabsheet (#11026)
87018cd Add missing license header
cb1f63b Send window mode changes to the server immediately (#11737)
e52df7c Added ComponentConnector.isAttached (#11928)
2b5ba96 Define how CurrentInstance works with access() (#11897)
d345838 Remove ThreadLocal references from CurrentInstance (#11914)
bb7b404 Remove outdated testing (#11897)
f64d944 Merge "event not reported as target when context clicking in month view" to Vaadin 7.1 (#10217)
51c9fb5 Fix debug window SEVERE style, add styles for FINE, FINER and FINEST (#11891)
3b888fe Support nested SASS imports (#11909)
b2137f5 Ensure calendar panel is updated when range changes (#11940)
f8319eb Avoid deadlock checking in runPendingAccessTasks() (#11897)
51a98a3 Moved enums to avoid running them as tests
7c613d1 Exclude parsers from checkstyle as they are generated
35f3532 Fixes current text being overwritten in server update on RTA #11741
a744d21 Remove UI.runSafely and VaadinSession.runSafely (#11901)
84edd19 Make test independent of browser language (#11940)
a3ad62d Updated to custom build of Smartsprites 0.2.10 which includes a fix for SMARTSPRITES-36 (#9959)
a9afca6 Moved Locale data handling to LocaleService (#11378)
5e548ae Fixed javadoc compilation error
91182e2 Extract ProgressBar and deprecate ProgressIndicator (#11925)
a5b8209 Add primary style name support for ProgressBar/Indicator (#9913)
86b3689 Make ProgressInidcatorConnector use VProgressIndicator (#11925)
29fcadc Flush the output writer in case of SSE transport as well (#11955)
5e26b0b Fix streaming issue with iOS6 (#11934)
1b274c4 Limit sub window minimum size (#11510)
46cc08b Remove workarounds for broken Timer.cancel in IE (#11872)
d850db6 Add XML formatting instructions (#11956)
9a3dc4e Formatted XML files using defined rules (#11956)
57b7335 Fixed spelling mistake in API #11741
587e10b Fix stale info in javadoc for accessSynchronously (#11897)
36fd94a Remove IE6/IE7 permutation (#11954)
cccff37 Do not log legacy warnings in JUnit tests (#11963)
0f9b689 Throw exception if VaadinService has not been initialized (#11961)
1ed0980 Move ApplicationConnection.setOverlayContainerLabel to VOverlay (#11965)
0014563 Extracted dialog style to a separate block (#11734)
b82e60b Add missing dialog maximize/restore icons for Runo (#11734)
0d046d6 Add a separate debug window section for profiler output (#11950)
03830ae Ignore style resource that has already been added (#11667)
84bf5a7 Enabled drag & drop to Calendar #11048
6c36784 Merge commit '34e6c60a5a746c0306c3a84ae8d6c21dfd84d878' into 7.1
a82d57e Merge changes from origin/7.0
666dbb5 Use window.console instead of just console in vaadinPush to appease IE (#11980)
93751c1 Use correct day names when formatting dates (#6207)
19d0082 Fixed javadoc references
e6e752d Correctly decode summaries containing quotes (#11769)
54ed269 Log stack trace using fine when logging toString warnings
8d655f6 Move VaadinSession.runPendingAccessTasks to VaadinService (#11964)
b1ab27a Update broadcaster tutorial code
e63edcc Update deprecation javadoc for VaadinSession.getBrowser()
132eee5 Add @VaadinServletConfiguration (#11970)
aa99259 Send connector debug (highlight) using RPC (#11536)
6d4582e Change analyze layouts to use RPC (#11536)
6f912b1 Rename tests so they are run during build (Abstract* is ignored)
ebd4a5c Added missing rpc interface (#11536)
edca409 Allow customizing client-side push config on server side (#11867)
b0574f7 Add transport parameter to @Push (#11966)
Change-Id: I4670c783fec829f81890e2d645d93dd40860b909
Diffstat (limited to 'theme-compiler')
9 files changed, 114 insertions, 110 deletions
diff --git a/theme-compiler/build.xml b/theme-compiler/build.xml index 277929d160..b28eca8cf7 100644 --- a/theme-compiler/build.xml +++ b/theme-compiler/build.xml @@ -1,58 +1,64 @@ <?xml version="1.0"?> -<project name="vaadin-theme-compiler" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant"> - <description> - Compiles build helpers used when building other modules. - </description> - <include file="../common.xml" as="common" /> - <include file="../build.xml" as="vaadin" /> - <include file="../gwt-files.xml" as="gwtfiles" /> - - <!-- global properties --> - <property name="module.name" value="vaadin-theme-compiler" /> - <property name="module.symbolic" value="com.vaadin.theme-compiler" /> - <property name="result.dir" value="result" /> - <property name="sass.parser.jj" location="src/com/vaadin/sass/internal/parser/Parser.jj" /> - <path id="classpath.compile.custom"> - </path> - <path id="classpath.test.custom" /> - - <!--<property name="classes.exclude" value="com/vaadin/buildhelpers/**" />--> - - <target name="parser"> - <!-- Copy javacc-5.0.jar to ${result.dir}/javacc/javacc.jar as the javacc task requires the jar to be named javacc.jar --> - <property name="javacc.home" location="${result.dir}/javacc" /> - <ivy:retrieve organisation="net.java.dev.javacc" module="javacc" revision="5.0" inline="true" type="jar" pattern="${javacc.home}/[artifact].[ext]" /> - <javacc target="${sass.parser.jj}" javacchome="${javacc.home}"> - </javacc> - </target> - - <target name="jar" depends="parser"> - <antcall target="common.jar"> - <reference torefid="extra.jar.includes" refid="empty.reference" /> - </antcall> - </target> - <target name="publish-local" depends="jar"> - <antcall target="common.sources.jar"> - <reference torefid="extra.jar.includes" refid="empty.reference" /> - </antcall> - <antcall target="common.javadoc.jar" /> - - <antcall target="common.publish-local" /> - </target> - - <target name="clean"> - <antcall target="common.clean" /> - </target> - - <target name="checkstyle"> - <antcall target="common.checkstyle"> - <param name="cs.src" location="src" /> - </antcall> - </target> - - <target name="test" depends="checkstyle"> - <antcall target="common.test.run" /> - </target> +<project name="vaadin-theme-compiler" basedir="." default="publish-local" + xmlns:ivy="antlib:org.apache.ivy.ant"> + <description> + Compiles build helpers used when building other modules. + </description> + <include file="../common.xml" as="common" /> + <include file="../build.xml" as="vaadin" /> + <include file="../gwt-files.xml" as="gwtfiles" /> + + <!-- global properties --> + <property name="module.name" value="vaadin-theme-compiler" /> + <property name="module.symbolic" value="com.vaadin.theme-compiler" /> + <property name="result.dir" value="result" /> + <property name="sass.parser.jj" + location="src/com/vaadin/sass/internal/parser/Parser.jj" /> + <path id="classpath.compile.custom"> + </path> + <path id="classpath.test.custom" /> + + <!--<property name="classes.exclude" value="com/vaadin/buildhelpers/**" + /> --> + + <target name="parser"> + <!-- Copy javacc-5.0.jar to ${result.dir}/javacc/javacc.jar as the + javacc task requires the jar to be named javacc.jar --> + <property name="javacc.home" location="${result.dir}/javacc" /> + <ivy:retrieve organisation="net.java.dev.javacc" + module="javacc" revision="5.0" inline="true" type="jar" + pattern="${javacc.home}/[artifact].[ext]" /> + <javacc target="${sass.parser.jj}" javacchome="${javacc.home}"> + </javacc> + </target> + + <target name="jar" depends="parser"> + <antcall target="common.jar"> + <reference torefid="extra.jar.includes" refid="empty.reference" /> + </antcall> + </target> + <target name="publish-local" depends="jar"> + <antcall target="common.sources.jar"> + <reference torefid="extra.jar.includes" refid="empty.reference" /> + </antcall> + <antcall target="common.javadoc.jar" /> + + <antcall target="common.publish-local" /> + </target> + + <target name="clean"> + <antcall target="common.clean" /> + </target> + + <target name="checkstyle"> + <antcall target="common.checkstyle"> + <param name="cs.src" location="src" /> + </antcall> + </target> + + <target name="test" depends="checkstyle"> + <antcall target="common.test.run" /> + </target> </project>
\ No newline at end of file diff --git a/theme-compiler/ivy.xml b/theme-compiler/ivy.xml index f0646c04e6..97ecfa4416 100644 --- a/theme-compiler/ivy.xml +++ b/theme-compiler/ivy.xml @@ -45,11 +45,9 @@ <!-- Internally used, for now --> <dependency org="com.carrotsearch" name="smartsprites" - rev="0.2.3-itmill" /> - <!-- Use 1.1.1 even though smartsprites indirectly depends on an - older version --> - <override org="commons-logging" module="commons-logging" - rev="1.1.1"/> + rev="0.2.10-vaadin" /> + <!-- Use the same commons-io as the rest of the project --> + <override org="commons-io" module="commons-io" rev="2.2" /> </dependencies> </ivy-module> diff --git a/theme-compiler/ivymodule/smartsprites-ivy-0.2.3-itmill.xml b/theme-compiler/ivymodule/smartsprites-ivy-0.2.3-itmill.xml deleted file mode 100644 index 29dc2d3474..0000000000 --- a/theme-compiler/ivymodule/smartsprites-ivy-0.2.3-itmill.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven"> - <info organisation="com.carrotsearch" - module="smartsprites" - revision="0.2.3-itmill" - status="release" - publication="20111130000000"> - <license name="BSD license" url="http://csssprites.org/smartsprites.LICENSE" /> - <description homepage="http://csssprites.org"> - CSS Sprites Generator Done Right. SmartSprites maintains CSS sprites in your designs, - fully automatically. No tedious copying and pasting to your CSS when adding or changing - sprited images. - </description> - </info> - <configurations> - <conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/> - <conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/> - <conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."/> - <conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive."/> - <conf name="runtime" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="compile"/> - <conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases." extends="runtime"/> - <conf name="system" visibility="public" description="this scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository."/> - <conf name="sources" visibility="public" description="this configuration contains the source artifact of this module, if any."/> - <conf name="javadoc" visibility="public" description="this configuration contains the javadoc artifact of this module, if any."/> - <conf name="optional" visibility="public" description="contains all optional dependencies"/> - </configurations> - <publications> - <artifact name="smartsprites" type="jar" ext="jar" conf="master"/> - </publications> - <dependencies> - <dependency org="com.google.collections" name="google-collections" rev="0.9" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/> - <dependency org="args4j" name="args4j" rev="2.0.9" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/> - <dependency org="commons-math" name="commons-math" rev="1.1" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/> - <dependency org="commons-io" name="commons-io" rev="2.2" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/> - <dependency org="commons-lang" name="commons-lang" rev="2.6" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/> - <dependency org="junit" name="junit" rev="4.4" force="true" conf="test->runtime(*),master(*)"/> - </dependencies> -</ivy-module> diff --git a/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java b/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java index d938dfefe8..382e8e6711 100644 --- a/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java +++ b/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.java @@ -136,6 +136,7 @@ public class Parser implements org.w3c.css.sac.Parser, ParserConstants { * @exception IOException the source can't be parsed. * @exception CSSException the source is not CSS valid. */ + // TODO required by original parser but not used by Vaadin? public void parseRule(InputSource source) throws CSSException, IOException { this.source = source; @@ -1870,6 +1871,7 @@ char connector = ' '; case IDENT: case VARIABLE: case HASH: + case IMPORT_SYM: case MEDIA_SYM: case KEY_FRAME_SYM: ; @@ -1907,6 +1909,9 @@ char connector = ' '; case MICROSOFT_RULE: microsoftExtension(); break; + case IMPORT_SYM: + importDeclaration(); + break; default: jj_la1[69] = jj_gen; jj_consume_token(-1); @@ -6080,6 +6085,7 @@ LexicalUnitImpl result = null; * The following functions are useful for a DOM CSS implementation only and are * not part of the general CSS2 parser. */ +// TODO required by original parser but not used by Vaadin? final public void _parseRule() throws ParseException { String ret = null; label_168: @@ -7364,13 +7370,13 @@ LexicalUnitImpl result = null; return false; } - private boolean jj_3R_261() { - if (jj_scan_token(INTERPOLATION)) return true; + private boolean jj_3_9() { + if (jj_3R_184()) return true; return false; } - private boolean jj_3_9() { - if (jj_3R_184()) return true; + private boolean jj_3R_261() { + if (jj_scan_token(INTERPOLATION)) return true; return false; } @@ -7529,7 +7535,7 @@ LexicalUnitImpl result = null; jj_la1_2 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x401,0x4000,0x0,0x0,0x0,0x0,0x2200,0x0,0x0,0x0,0x400,0x400,0x0,0x0,0x8000,0x0,0x8000,0x0,0x0,0x4465,0x4465,0x0,0x0,0x0,0xae00,0xae00,0x0,0x0,0x0,0x400,0x0,0x0,0x400,0x0,0x0,0x400,0x0,0x0,0x0,0x0,0x400,0x0,0x0,0x400,0x0,0xaa00,0x0,0x0,0x0,0x0,0x0,0xe00,0xe00,0x0,0x400,0x400,0x0,0x0,0x0,0x0,0x4465,0x4465,0x0,0x0,0x0,0x400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400,0x400,0x400,0x400,0x400,0x400,0x0,0x0,0x0,0x0,0x600,0x0,0x0,0x0,0x0,0x400,0x0,0x100,0x0,0x0,0x1,0x424,0x4000,0x4c00,0x0,0x4424,0x0,0x2,0x0,0x4c00,0x80,0x0,0x4424,0x0,0x4c00,0x0,0x0,0x0,0x4400,0x0,0x4424,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400,0x0,0x4425,0x4425,0x0,0x0,0x0,0x0,0x0,0x0,0x4000,0x4000,0xffffee00,0x0,0x0,0x0,0x0,0xffffee00,0x0,0x0,0x0,0x4400,0x0,0x0,0x0,0x400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x400,0x0,0x0,0x400,0x0,0x0,0x400,0x0,0x0,0x0,0x400,0x0,0x0,0x400,0x0,0xffffee00,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xffffee00,0x0,0xffff8800,0x0,0x400,0x2600,0xffffae00,0x0,0x0,0xffffee00,0x0,0x400,0x0,0x0,0x0,0x400,0x0,0x0,0x400,0x0,}; } private static void jj_la1_init_3() { - jj_la1_3 = new int[] {0x20,0x200,0x200,0x8,0x200,0x0,0x0,0x0,0x1d4,0x0,0x200,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x114,0x114,0x0,0x0,0x0,0x31006fc,0x31006fc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x31006f8,0x0,0x0,0x0,0x0,0x0,0x1000000,0x1000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x114,0x114,0x0,0x0,0x0,0x4,0x0,0x4,0x4,0x0,0x0,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x0,0x0,0x0,0x0,0x114,0x0,0x800000,0x0,0x114,0x0,0x0,0x0,0x800000,0x0,0x0,0x114,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x114,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x1d4,0x1d4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1100007,0x0,0x0,0x0,0x0,0x1100007,0x0,0x0,0x0,0x1000000,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0xe00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x400,0x0,0x0,0x0,0x0,0x0,0x0,0x1100007,0x0,0x400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1100007,0x0,0x1000003,0x0,0x0,0x100004,0x1100007,0x0,0x0,0x1100007,0x0,0xdc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; + jj_la1_3 = new int[] {0x20,0x200,0x200,0x8,0x200,0x0,0x0,0x0,0x1d4,0x0,0x200,0x0,0x200,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x114,0x114,0x0,0x0,0x0,0x31006fc,0x31006fc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x31006f8,0x0,0x0,0x0,0x0,0x0,0x1000000,0x1000000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x11c,0x11c,0x0,0x0,0x0,0x4,0x0,0x4,0x4,0x0,0x0,0x4,0x4,0x4,0x4,0x4,0x4,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x0,0x0,0x0,0x0,0x114,0x0,0x800000,0x0,0x114,0x0,0x0,0x0,0x800000,0x0,0x0,0x114,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x114,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1000000,0x0,0x1d4,0x1d4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1100007,0x0,0x0,0x0,0x0,0x1100007,0x0,0x0,0x0,0x1000000,0x0,0x0,0x0,0x4,0x0,0x0,0x0,0x0,0xe00000,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x0,0x400,0x0,0x0,0x0,0x0,0x0,0x0,0x1100007,0x0,0x400,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1100007,0x0,0x1000003,0x0,0x0,0x100004,0x1100007,0x0,0x0,0x1100007,0x0,0xdc,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,}; } final private JJCalls[] jj_2_rtns = new JJCalls[9]; private boolean jj_rescan = false; diff --git a/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj b/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj index 7f86527015..daf20423d6 100644 --- a/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj +++ b/theme-compiler/src/com/vaadin/sass/internal/parser/Parser.jj @@ -169,6 +169,7 @@ public class Parser implements org.w3c.css.sac.Parser { * @exception IOException the source can't be parsed. * @exception CSSException the source is not CSS valid. */ + // TODO required by original parser but not used by Vaadin? public void parseRule(InputSource source) throws CSSException, IOException { this.source = source; @@ -1188,7 +1189,8 @@ void styleRule() : start = true; documentHandler.startSelector(l); } - ( ifContentStatement() | controlDirective() | microsoftExtension() )* + // a CSS import here will not work + ( ifContentStatement() | controlDirective() | microsoftExtension() | importDeclaration() )* <RBRACE> (<S>)* } catch (ThrowedParseException e) { if (errorHandler != null) { @@ -2947,7 +2949,7 @@ String skipAfterExpression() { * The following functions are useful for a DOM CSS implementation only and are * not part of the general CSS2 parser. */ - +// TODO required by original parser but not used by Vaadin? void _parseRule() : {String ret = null; } diff --git a/theme-compiler/src/com/vaadin/sass/internal/tree/ImportNode.java b/theme-compiler/src/com/vaadin/sass/internal/tree/ImportNode.java index f7d664d54d..6dc95db5c2 100644 --- a/theme-compiler/src/com/vaadin/sass/internal/tree/ImportNode.java +++ b/theme-compiler/src/com/vaadin/sass/internal/tree/ImportNode.java @@ -18,7 +18,6 @@ package com.vaadin.sass.internal.tree; import org.w3c.css.sac.SACMediaList; -import com.vaadin.sass.internal.ScssStylesheet; import com.vaadin.sass.internal.visitor.ImportNodeHandler; public class ImportNode extends Node { @@ -74,7 +73,7 @@ public class ImportNode extends Node { @Override public void traverse() { - // TODO shouldn't be reached with current setup, try anyway? - ImportNodeHandler.traverse((ScssStylesheet) getParentNode()); + // nested imports + ImportNodeHandler.traverse(getParentNode()); } } diff --git a/theme-compiler/src/com/vaadin/sass/internal/visitor/ImportNodeHandler.java b/theme-compiler/src/com/vaadin/sass/internal/visitor/ImportNodeHandler.java index e356ed3525..cb9896967a 100644 --- a/theme-compiler/src/com/vaadin/sass/internal/visitor/ImportNodeHandler.java +++ b/theme-compiler/src/com/vaadin/sass/internal/visitor/ImportNodeHandler.java @@ -26,6 +26,7 @@ import org.w3c.css.sac.LexicalUnit; import com.vaadin.sass.internal.ScssStylesheet; import com.vaadin.sass.internal.parser.LexicalUnitImpl; +import com.vaadin.sass.internal.parser.ParseException; import com.vaadin.sass.internal.tree.ImportNode; import com.vaadin.sass.internal.tree.Node; import com.vaadin.sass.internal.tree.RuleNode; @@ -33,7 +34,23 @@ import com.vaadin.sass.internal.util.StringUtil; public class ImportNodeHandler { - public static void traverse(ScssStylesheet node) { + public static void traverse(Node node) { + ScssStylesheet styleSheet = null; + if (node instanceof ScssStylesheet) { + styleSheet = (ScssStylesheet) node; + } else { + // iterate to parents of node, find ScssStylesheet + Node parent = node.getParentNode(); + while (parent != null && !(parent instanceof ScssStylesheet)) { + parent = parent.getParentNode(); + } + if (parent instanceof ScssStylesheet) { + styleSheet = (ScssStylesheet) parent; + } + } + if (styleSheet == null) { + throw new ParseException("Nested import in an invalid context"); + } ArrayList<Node> c = new ArrayList<Node>(node.getChildren()); for (Node n : c) { if (n instanceof ImportNode) { @@ -41,7 +58,7 @@ public class ImportNodeHandler { if (!importNode.isPureCssImport()) { try { StringBuilder filePathBuilder = new StringBuilder( - node.getFileName()); + styleSheet.getFileName()); filePathBuilder.append(File.separatorChar).append( importNode.getUri()); if (!filePathBuilder.toString().endsWith(".scss")) { @@ -50,7 +67,8 @@ public class ImportNodeHandler { // set parent's charset to imported node. ScssStylesheet imported = ScssStylesheet.get( - filePathBuilder.toString(), node.getCharset()); + filePathBuilder.toString(), + styleSheet.getCharset()); if (imported == null) { imported = ScssStylesheet.get(importNode.getUri()); } @@ -76,6 +94,11 @@ public class ImportNodeHandler { } catch (IOException e) { e.printStackTrace(); } + } else { + if (styleSheet != node) { + throw new ParseException( + "CSS imports can only be used at the top level, not as nested imports. Within style rules, use SCSS imports."); + } } } } diff --git a/theme-compiler/tests/resources/automatic/css/nested-import.css b/theme-compiler/tests/resources/automatic/css/nested-import.css new file mode 100644 index 0000000000..7c6793f9ed --- /dev/null +++ b/theme-compiler/tests/resources/automatic/css/nested-import.css @@ -0,0 +1,5 @@ +.foo .bar { + background: url(foo/lorem.png); + background: url(foo/lorem.png); + background: url(foo/lorem.png); +}
\ No newline at end of file diff --git a/theme-compiler/tests/resources/automatic/scss/nested-import.scss b/theme-compiler/tests/resources/automatic/scss/nested-import.scss new file mode 100644 index 0000000000..605d64a13a --- /dev/null +++ b/theme-compiler/tests/resources/automatic/scss/nested-import.scss @@ -0,0 +1,3 @@ +.foo { + @import "foo/bar.scss"; +}
\ No newline at end of file |