You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2014/12/09 06:17:05 UTC

[08/10] git commit: [flex-falcon] [refs/heads/develop] - redo how we save CSS in FalconJX

redo how we save CSS in FalconJX


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/db870b15
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/db870b15
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/db870b15

Branch: refs/heads/develop
Commit: db870b15cc4ab92e838054c9439404f296bd5715
Parents: 2ee0958
Author: Alex Harui <ah...@apache.org>
Authored: Tue Dec 2 23:25:20 2014 -0800
Committer: Alex Harui <ah...@apache.org>
Committed: Mon Dec 8 17:25:02 2014 -0800

----------------------------------------------------------------------
 .../internal/codegen/mxml/MXMLBlockWalker.java  | 10 +----
 .../mxml/flexjs/MXMLFlexJSBlockWalker.java      | 30 +------------
 .../codegen/mxml/flexjs/MXMLFlexJSEmitter.java  | 44 --------------------
 .../mxml/flexjs/MXMLFlexJSPublisher.java        |  7 +++-
 .../codegen/mxml/vf2js/MXMLVF2JSEmitter.java    | 44 --------------------
 .../codegen/mxml/vf2js/MXMLVF2JSPublisher.java  |  7 +++-
 .../js/flexjs/JSCSSCompilationSession.java      | 34 +++++++++++----
 .../internal/projects/FlexJSProject.java        | 21 ++++++++--
 .../compiler/internal/targets/FlexJSTarget.java | 12 +-----
 9 files changed, 57 insertions(+), 152 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db870b15/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLBlockWalker.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLBlockWalker.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLBlockWalker.java
index bed0187..bfc9ce5 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLBlockWalker.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/MXMLBlockWalker.java
@@ -270,15 +270,7 @@ public class MXMLBlockWalker implements IMXMLBlockVisitor, IMXMLBlockWalker
     @Override
     public void visitStyleBlock(IMXMLStyleNode node)
     {
-        ICSSDocument css = node.getCSSDocument(errors);
-        StringBuilder sb = new StringBuilder();
-        ImmutableList<ICSSRule> rules = css.getRules();
-        for (ICSSRule rule : rules)
-        {
-            sb.append(rule.toString());
-            sb.append("\n\n");
-        }
-        ((FlexJSProject)project).cssDocument += sb.toString();
+    	// don't do anything.  subclasses should.
     }
     
     @Override

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db870b15/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSBlockWalker.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSBlockWalker.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSBlockWalker.java
index d4a613e..8007166 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSBlockWalker.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSBlockWalker.java
@@ -19,30 +19,21 @@
 
 package org.apache.flex.compiler.internal.codegen.mxml.flexjs;
 
-import java.util.Collection;
-import java.util.HashSet;
 import java.util.List;
 
 import org.apache.flex.compiler.codegen.as.IASEmitter;
 import org.apache.flex.compiler.codegen.mxml.IMXMLEmitter;
 import org.apache.flex.compiler.codegen.mxml.flexjs.IMXMLFlexJSEmitter;
 import org.apache.flex.compiler.css.ICSSDocument;
-import org.apache.flex.compiler.css.ICSSRule;
-import org.apache.flex.compiler.internal.caches.CSSDocumentCache;
 import org.apache.flex.compiler.internal.codegen.mxml.MXMLBlockWalker;
 import org.apache.flex.compiler.internal.css.codegen.CSSCompilationSession;
-import org.apache.flex.compiler.internal.driver.js.flexjs.JSCSSCompilationSession;
-import org.apache.flex.compiler.internal.projects.FlexJSProject;
 import org.apache.flex.compiler.problems.ICompilerProblem;
 import org.apache.flex.compiler.projects.IASProject;
-import org.apache.flex.compiler.projects.IFlexProject;
 import org.apache.flex.compiler.tree.mxml.IMXMLDocumentNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLFileNode;
 import org.apache.flex.compiler.tree.mxml.IMXMLStyleNode;
 import org.apache.flex.compiler.visitor.IBlockWalker;
 
-import com.google.common.collect.ImmutableList;
-
 /**
  * @author Michael Schmalle
  * @author Erik de Bruin
@@ -61,8 +52,6 @@ public class MXMLFlexJSBlockWalker extends MXMLBlockWalker
         this.mxmlEmitter = mxmlEmitter;
     }
 
-    public String encodedCSS = "";
-    
     //--------------------------------------------------------------------------
 
     @Override
@@ -85,28 +74,11 @@ public class MXMLFlexJSBlockWalker extends MXMLBlockWalker
     public void visitStyleBlock(IMXMLStyleNode node)
     {
         ICSSDocument css = node.getCSSDocument(errors);
-        StringBuilder sb = new StringBuilder();
-        ImmutableList<ICSSRule> rules = css.getRules();
-        for (ICSSRule rule : rules)
-        {
-            sb.append(rule.toString());
-            sb.append("\n\n");
-        }
-        ((FlexJSProject)project).cssDocument += sb.toString();
-        
-        // Ignore semanticProblems. They should have been collected during the semantic analysis phase already.
-        final Collection<ICompilerProblem> problems = new HashSet<ICompilerProblem>();
-        if (css == CSSDocumentCache.EMPTY_CSS_DOCUMENT)
-            return;
-        
-        final IFlexProject flexProject = (IFlexProject)getProject();
-
+                
         final CSSCompilationSession session = node.getFileNode().getCSSCompilationSession();
         if (session == null)
             return;
         
-        session.setKeepAllTypeSelectors(true);
-        encodedCSS = ((JSCSSCompilationSession)session).getEncodedCSS(flexProject, problems);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db870b15/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
index 40f145f..218621f 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSEmitter.java
@@ -212,8 +212,6 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
 
         emitBindingData(cname, cdef);
 
-        emitEncodedCSS(cname);
-        
     }
 
     public void emitSubDocument(IMXMLComponentNode node)
@@ -289,8 +287,6 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
 
         emitBindingData(cname, cdef);
 
-        emitEncodedCSS(cname);
-
         descriptorTree = oldDescriptorTree;
         propertiesTree = oldPropertiesTree;
         events = oldEvents;
@@ -1665,35 +1661,6 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
     //--------------------------------------------------------------------------
     //    JS output
     //--------------------------------------------------------------------------
-
-    private void emitEncodedCSS(String cname)
-    {
-        String s = ((MXMLFlexJSBlockWalker)getMXMLWalker()).encodedCSS;
-        if (!s.isEmpty())
-        {
-            int reqidx = s.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
-            if (reqidx != -1)
-                s = s.substring(0, reqidx - 1);
-
-            writeNewline();
-            writeNewline("/**");
-            writeNewline(" * @expose");
-            writeNewline(" */");
-            StringBuilder sb = new StringBuilder();
-            sb.append(cname);
-            sb.append(ASEmitterTokens.MEMBER_ACCESS.getToken());
-            sb.append(JSEmitterTokens.PROTOTYPE.getToken());
-            sb.append(ASEmitterTokens.MEMBER_ACCESS.getToken());
-            sb.append("cssData");
-            sb.append(ASEmitterTokens.SPACE.getToken() +
-                        ASEmitterTokens.EQUAL.getToken() +
-                        ASEmitterTokens.SPACE.getToken() +
-                        ASEmitterTokens.SQUARE_OPEN.getToken());
-            sb.append(s);
-            write(sb.toString());
-            writeNewline();
-        }
-    }
     
     private void emitHeader(IMXMLDocumentNode node)
     {
@@ -1773,17 +1740,6 @@ public class MXMLFlexJSEmitter extends MXMLEmitter implements
             }
         }
 
-        String s = ((MXMLFlexJSBlockWalker)getMXMLWalker()).encodedCSS;
-        if (!s.isEmpty())
-        {
-            int reqidx = s.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
-            if (reqidx != -1)
-            {
-                String reqs = s.substring(reqidx);
-                writeNewline(reqs);
-            }
-        }
-
         // erikdebruin: Add missing language feature support, like the 'is' and 
         //              'as' operators. We don't need to worry about requiring
         //              this in every project: ADVANCED_OPTIMISATIONS will NOT

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db870b15/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
index 4c426bd..573fcbc 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java
@@ -45,6 +45,7 @@ import org.apache.flex.compiler.config.Configuration;
 import org.apache.flex.compiler.internal.codegen.js.JSSharedData;
 import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
 import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogPublisher;
+import org.apache.flex.compiler.internal.driver.js.flexjs.JSCSSCompilationSession;
 import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
 import org.apache.flex.compiler.internal.graph.GoogDepsWriter;
 import org.apache.flex.compiler.internal.projects.FlexJSProject;
@@ -476,7 +477,8 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements
         appendString.append("\n\n");
         appendString.append(projectName);
         appendString.append(".prototype.cssData = [");
-        String s = project.cssEncoding;
+        JSCSSCompilationSession cssSession = (JSCSSCompilationSession) project.getCSSCompilationSession();
+        String s = cssSession.getEncodedCSS();
         int reqidx = s.indexOf(JSGoogEmitterTokens.GOOG_REQUIRE.getToken());
         if (reqidx != -1)
         {
@@ -571,7 +573,8 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements
     private void writeCSS(String projectName, String dirPath)
             throws IOException
     {
+        JSCSSCompilationSession cssSession = (JSCSSCompilationSession) project.getCSSCompilationSession();
         writeFile(dirPath + File.separator + projectName + ".css",
-                project.cssDocument, false);
+                cssSession.emitCSS(), false);
     }
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db870b15/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/MXMLVF2JSEmitter.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/MXMLVF2JSEmitter.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/MXMLVF2JSEmitter.java
index 04fb87d..b893f12 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/MXMLVF2JSEmitter.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/MXMLVF2JSEmitter.java
@@ -180,8 +180,6 @@ public class MXMLVF2JSEmitter extends MXMLEmitter implements
 
         emitBindingData(cname, cdef);
 
-        emitEncodedCSS(cname);
-        
     }
 
     public void emitSubDocument(IMXMLComponentNode node)
@@ -254,8 +252,6 @@ public class MXMLVF2JSEmitter extends MXMLEmitter implements
 
         emitBindingData(cname, cdef);
 
-        emitEncodedCSS(cname);
-
         descriptorTree = oldDescriptorTree;
         propertiesTree = oldPropertiesTree;
         events = oldEvents;
@@ -1412,35 +1408,6 @@ public class MXMLVF2JSEmitter extends MXMLEmitter implements
     //--------------------------------------------------------------------------
     //    JS output
     //--------------------------------------------------------------------------
-
-    private void emitEncodedCSS(String cname)
-    {
-        String s = ((MXMLFlexJSBlockWalker)getMXMLWalker()).encodedCSS;
-        if (!s.isEmpty())
-        {
-            int reqidx = s.indexOf("goog.require");
-            if (reqidx != -1)
-                s = s.substring(0, reqidx - 1);
-
-            writeNewline();
-            writeNewline("/**");
-            writeNewline(" * @expose");
-            writeNewline(" */");
-            StringBuilder sb = new StringBuilder();
-            sb.append(cname);
-            sb.append(ASEmitterTokens.MEMBER_ACCESS.getToken());
-            sb.append(JSEmitterTokens.PROTOTYPE.getToken());
-            sb.append(ASEmitterTokens.MEMBER_ACCESS.getToken());
-            sb.append("cssData");
-            sb.append(ASEmitterTokens.SPACE.getToken() +
-                        ASEmitterTokens.EQUAL.getToken() +
-                        ASEmitterTokens.SPACE.getToken() +
-                        ASEmitterTokens.SQUARE_OPEN.getToken());
-            sb.append(s);
-            write(sb.toString());
-            writeNewline();
-        }
-    }
     
     private void emitHeader(IMXMLDocumentNode node)
     {
@@ -1520,17 +1487,6 @@ public class MXMLVF2JSEmitter extends MXMLEmitter implements
             }
         }
 
-        String s = ((MXMLFlexJSBlockWalker)getMXMLWalker()).encodedCSS;
-        if (!s.isEmpty())
-        {
-            int reqidx = s.indexOf("goog.require");
-            if (reqidx != -1)
-            {
-                String reqs = s.substring(reqidx);
-                writeNewline(reqs);
-            }
-        }
-
         // erikdebruin: Add missing language feature support, like the 'is' and 
         //              'as' operators. We don't need to worry about requiring
         //              this in every project: ADVANCED_OPTIMISATIONS will NOT

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db870b15/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/MXMLVF2JSPublisher.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/MXMLVF2JSPublisher.java b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/MXMLVF2JSPublisher.java
index d927e84..164806c 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/MXMLVF2JSPublisher.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/codegen/mxml/vf2js/MXMLVF2JSPublisher.java
@@ -34,6 +34,7 @@ import org.apache.flex.compiler.codegen.js.IJSPublisher;
 import org.apache.flex.compiler.config.Configuration;
 import org.apache.flex.compiler.internal.codegen.js.JSSharedData;
 import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogPublisher;
+import org.apache.flex.compiler.internal.driver.js.flexjs.JSCSSCompilationSession;
 import org.apache.flex.compiler.internal.driver.js.goog.JSGoogConfiguration;
 import org.apache.flex.compiler.internal.graph.VF2JSDepsWriter;
 import org.apache.flex.compiler.internal.projects.FlexJSProject;
@@ -437,7 +438,8 @@ public class MXMLVF2JSPublisher extends JSGoogPublisher implements
         appendString.append("\n\n");
         appendString.append(projectName);
         appendString.append(".prototype.cssData = [");
-        String s = project.cssEncoding;
+        JSCSSCompilationSession cssSession = (JSCSSCompilationSession) project.getCSSCompilationSession();
+        String s = cssSession.getEncodedCSS();
         int reqidx = s.indexOf("goog.require");
         if (reqidx != -1)
         {
@@ -589,7 +591,8 @@ public class MXMLVF2JSPublisher extends JSGoogPublisher implements
             throws IOException
     {
         StringBuilder cssFile = new StringBuilder();
-        cssFile.append(project.cssDocument);
+        JSCSSCompilationSession cssSession = (JSCSSCompilationSession) project.getCSSCompilationSession();
+        cssFile.append(cssSession.emitCSS());
 
         writeFile(dirPath + File.separator + projectName + ".css",
                 cssFile.toString(), false);

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db870b15/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/flexjs/JSCSSCompilationSession.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/flexjs/JSCSSCompilationSession.java b/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/flexjs/JSCSSCompilationSession.java
index 7a518d2..35525c6 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/flexjs/JSCSSCompilationSession.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/driver/js/flexjs/JSCSSCompilationSession.java
@@ -48,12 +48,12 @@ public class JSCSSCompilationSession extends CSSCompilationSession
 
     private ArrayList<String> requires;
     
-    public String getEncodedCSS(ICompilerProject project, final Collection<ICompilerProblem> problems)
+    public String getEncodedCSS()
     {
         final ICSSDocument css = synthesisNormalizedCSS();
         StringBuilder sb = new StringBuilder();
         requires = new ArrayList<String>();
-        encodeCSS(css, sb, project, problems);
+        encodeCSS(css, sb);
         sb.append("];\n");
         for (String r : requires)
         {
@@ -76,19 +76,21 @@ public class JSCSSCompilationSession extends CSSCompilationSession
         ImmutableList<ICSSRule> rules = css.getRules();
         for (ICSSRule rule : rules)
         {
-            sb.append(rule.toString());
+        	String s = rule.toString();
+        	if (s.startsWith("global {"))
+        		s = s.replace("global {", "* {");
+            sb.append(s);
             sb.append("\n\n");
         }
     }
     
-    private void encodeCSS(ICSSDocument css, StringBuilder sb,
-            ICompilerProject project, final Collection<ICompilerProblem> problems)
+    private void encodeCSS(ICSSDocument css, StringBuilder sb)
     {
         ImmutableList<ICSSRule> rules = css.getRules();
         boolean skipcomma = true;
         for (ICSSRule rule : rules)
         {
-            String s = encodeRule(rule, project, problems);
+            String s = encodeRule(rule);
             if (s != null)
             {
                 if (skipcomma)
@@ -100,8 +102,7 @@ public class JSCSSCompilationSession extends CSSCompilationSession
         }
     }
     
-    private String encodeRule(ICSSRule rule,
-            ICompilerProject project, final Collection<ICompilerProblem> problems)
+    private String encodeRule(ICSSRule rule)
     {
         final StringBuilder result = new StringBuilder();
 
@@ -271,4 +272,21 @@ public class JSCSSCompilationSession extends CSSCompilationSession
         return result.toString();
 
     }
+    
+    @Override
+    protected boolean keepRule(ICSSRule newRule)
+    {
+    	if (super.keepRule(newRule))
+    		return true;
+    	
+    	// include all rules not found in defaults.css
+    	// theoretically, defaults.css rules were
+    	// properly added in the super call.
+    	String sp = newRule.getSourcePath();
+    	if (!sp.contains("defaults.css"))
+    		return true;
+    	
+        return false;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db870b15/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java b/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
index ceacef0..9451dda 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/projects/FlexJSProject.java
@@ -57,8 +57,6 @@ public class FlexJSProject extends FlexProject
     private HashMap<ICompilationUnit, HashMap<String, DependencyType>> requires = new HashMap<ICompilationUnit, HashMap<String, DependencyType>>();
 
     public ICompilationUnit mainCU;
-    public String cssDocument;
-    public String cssEncoding;
 
     @Override
     public void addDependency(ICompilationUnit from, ICompilationUnit to,
@@ -152,10 +150,27 @@ public class FlexJSProject extends FlexProject
         return null;
     }
 
+    JSCSSCompilationSession cssSession = new JSCSSCompilationSession();
+    
     @Override
     public CSSCompilationSession getCSSCompilationSession()
     {
-        return new JSCSSCompilationSession();
+    	// When building SWFs, each MXML document may have its own styles
+    	// specified by fx:Style blocks.  The CSS is separately compiled and
+    	// stored in the class definition for the MXML document.  That helps
+    	// with deferred loading of classes.  The styles and thus the
+    	// classes for an MXML document are not initialized until the MXML
+    	// class is initialized.
+    	// For JS compilation, the CSS for non-standard CSS could be done the
+    	// same way, but AFAICT, standard CSS properties are best loaded by
+    	// specifying a .CSS file in the HTML.  The CSS is probably less text
+    	// than its codegen'd representation, and the browser can probably
+    	// load a .CSS file faster than us trying to run code to update the
+    	// styles.
+    	// So, for FlexJS, all style blocks from all MXML files are gathered into
+    	// one .css file and a corresponding codegen block that is output as
+    	// part of the main .JS file.
+    	return cssSession;
     }
 
     private HashMap<IASNode, String> astCache = new HashMap<IASNode, String>();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/db870b15/compiler.jx/src/org/apache/flex/compiler/internal/targets/FlexJSTarget.java
----------------------------------------------------------------------
diff --git a/compiler.jx/src/org/apache/flex/compiler/internal/targets/FlexJSTarget.java b/compiler.jx/src/org/apache/flex/compiler/internal/targets/FlexJSTarget.java
index ca8a5ff..83c118b 100644
--- a/compiler.jx/src/org/apache/flex/compiler/internal/targets/FlexJSTarget.java
+++ b/compiler.jx/src/org/apache/flex/compiler/internal/targets/FlexJSTarget.java
@@ -144,7 +144,7 @@ public class FlexJSTarget extends JSTarget implements IJSTarget
             final Collection<ICompilerProblem> problems)
             throws InterruptedException
     {
-        JSCSSCompilationSession cssCompilationSession = new JSCSSCompilationSession();
+        JSCSSCompilationSession cssCompilationSession = (JSCSSCompilationSession) flexProject.getCSSCompilationSession();
         cssCompilationSession.setKeepAllTypeSelectors(targetSettings.keepAllTypeSelectors());
         
         // Performance heuristic: let's start compilation on all of the compilation
@@ -222,16 +222,6 @@ public class FlexJSTarget extends JSTarget implements IJSTarget
 
         cssCompilationSession.cssDocuments.addAll(activatedStyleSheets.sort());
         
-        try
-        {
-            flexProject.cssDocument = cssCompilationSession.emitCSS();
-            flexProject.cssEncoding = cssCompilationSession.getEncodedCSS(flexProject, problems);
-        }
-        catch (Exception e)
-        {
-            e.printStackTrace();
-        }
-
         return super.findAllCompilationUnitsToLink(compilationUnits, problems);
     }