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 2015/07/15 02:54:59 UTC

[1/5] git commit: [flex-falcon] [refs/heads/develop] - handle @font-face by outputting a list of urls (instead of embedding). Framework code can tthen load fontswfs

Repository: flex-falcon
Updated Branches:
  refs/heads/develop e25e48272 -> 1f8f602c2


handle @font-face by outputting a list of urls (instead of embedding).  Framework code can tthen load fontswfs


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

Branch: refs/heads/develop
Commit: c98ed6e97b67b7c7ebdafa6e0096034ad6943459
Parents: e25e482
Author: Alex Harui <ah...@apache.org>
Authored: Tue Jul 14 08:24:24 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Jul 14 17:54:53 2015 -0700

----------------------------------------------------------------------
 .../css/codegen/CSSCompilationSession.java      | 22 ++++++----
 .../internal/css/codegen/CSSReducer.java        | 45 +++++++++++++++++++-
 2 files changed, 58 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c98ed6e9/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSCompilationSession.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSCompilationSession.java b/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSCompilationSession.java
index 5d0b69c..8cb40d0 100644
--- a/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSCompilationSession.java
+++ b/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSCompilationSession.java
@@ -35,6 +35,7 @@ import org.antlr.runtime.tree.CommonTree;
 
 import org.apache.flex.abc.visitors.IABCVisitor;
 import org.apache.flex.compiler.css.ICSSDocument;
+import org.apache.flex.compiler.css.ICSSFontFace;
 import org.apache.flex.compiler.css.ICSSProperty;
 import org.apache.flex.compiler.css.ICSSRule;
 import org.apache.flex.compiler.css.ICSSSelector;
@@ -96,6 +97,7 @@ public class CSSCompilationSession
         resolvedEmbedProperties = new HashMap<CSSFunctionCallPropertyValue, EmbedCompilationUnit>();
         activatedRules = new HashSet<ICSSRule>();
         cssDocuments = new ArrayList<ICSSDocument>();
+        fontFaces = new ArrayList<CSSFontFace>();
         singleSelectorRules = new LinkedHashMap<String, SingleSelectorRule>();
         rulesWithMediaQueries = new LinkedHashSet<ICSSRule>();
         cssDisabled = false;
@@ -124,6 +126,11 @@ public class CSSCompilationSession
     public final Set<ICSSRule> activatedRules;
 
     /**
+     * A set of font faces that will be included in the code generation.
+     */
+    public final ArrayList<CSSFontFace> fontFaces;
+
+    /**
      * A list of CSS models to be included in the code generation. The CSS
      * properties are prioritized by their order in the list. The first CSS in
      * the model has the least priority.
@@ -187,6 +194,10 @@ public class CSSCompilationSession
                     addRuleToCodeGeneration(newRule);
                 }
             }
+            for (final ICSSFontFace fontFace : cssDocument.getFontFaces())
+            {
+                fontFaces.add((CSSFontFace)fontFace);
+            }
         }
 
         // Merge all rules.
@@ -201,7 +212,7 @@ public class CSSCompilationSession
             rules.add((CSSRule)rule);
         }
 
-        return new SynthesizedCSSDocument(rules);
+        return new SynthesizedCSSDocument(rules, fontFaces);
     }
 
     /**
@@ -357,14 +368,9 @@ public class CSSCompilationSession
          */
         private static final List<CSSNamespaceDefinition> NO_NAMESPACES = ImmutableList.of();
 
-        /**
-         * TODO: support @font-face rules.
-         */
-        private static final List<CSSFontFace> FONT_FACES = ImmutableList.of();
-
-        private SynthesizedCSSDocument(final List<CSSRule> rules)
+        private SynthesizedCSSDocument(final List<CSSRule> rules, List<CSSFontFace> fontFaces)
         {
-            super(rules, NO_NAMESPACES, FONT_FACES, NO_TREE, NO_TOKEN_STREAM);
+            super(rules, NO_NAMESPACES, fontFaces, NO_TREE, NO_TOKEN_STREAM);
         }
 
     }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/c98ed6e9/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java b/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java
index 58caeed..751495e 100644
--- a/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java
+++ b/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java
@@ -52,6 +52,7 @@ import org.apache.flex.compiler.definitions.references.ReferenceFactory;
 import org.apache.flex.compiler.internal.as.codegen.LexicalScope;
 import org.apache.flex.compiler.internal.css.CSSArrayPropertyValue;
 import org.apache.flex.compiler.internal.css.CSSColorPropertyValue;
+import org.apache.flex.compiler.internal.css.CSSFontFace;
 import org.apache.flex.compiler.internal.css.CSSFunctionCallPropertyValue;
 import org.apache.flex.compiler.internal.css.CSSKeywordPropertyValue;
 import org.apache.flex.compiler.internal.css.CSSNumberPropertyValue;
@@ -85,6 +86,11 @@ public class CSSReducer implements ICSSCodeGenResult
     private static final String GLOBAL_SELECTOR = "global";
 
     /**
+     * The base name of CSS FontFace list.
+     */
+    public static final String FONTFACE_ARRAY = "fontFaces";
+    
+    /**
      * The base name of CSS Factory Functions.
      */
     public static final String FACTORY_FUNCTIONS = "factoryFunctions";
@@ -110,6 +116,11 @@ public class CSSReducer implements ICSSCodeGenResult
     public static final Name NAME_DATA_ARRAY = new Name(DATA_ARRAY);
 
     /**
+     * AET name for {@code var data:Array}.
+     */
+    public static final Name NAME_FONTFACE_ARRAY = new Name(FONTFACE_ARRAY);
+
+    /**
      * ABC {@code Name} for<br>
      * <code>public static var factoryFunctions:Object = generateFactoryFunctions();</code>
      */
@@ -201,6 +212,11 @@ public class CSSReducer implements ICSSCodeGenResult
     private String mediaQueryString;
 
     /**
+     * The list of fontfaces
+     */
+    private ArrayList<String> fontFaces = new ArrayList<String>();
+
+    /**
      * The map of media query to factory functions
      */
     private HashMap<String,ArrayList<String>> mediaQueryMap = new HashMap<String, ArrayList<String>>();
@@ -255,6 +271,18 @@ public class CSSReducer implements ICSSCodeGenResult
             initializeFactoryFunctions.addAll(pair.arrayReduction);
             initializeFactoryFunctions.addInstruction(ABCConstants.OP_initproperty, NAME_DATA_ARRAY);
     
+            // Initialize "fontFaces".
+            initializeFactoryFunctions.addInstruction(ABCConstants.OP_getlocal0);
+            for (String fontFace: fontFaces)
+            {
+                initializeFactoryFunctions.addInstruction(ABCConstants.OP_pushstring, fontFace);
+            }
+            if (fontFaces.size() > 0)
+                initializeFactoryFunctions.addInstruction(ABCConstants.OP_newarray, fontFaces.size());
+            else
+                initializeFactoryFunctions.addInstruction(ABCConstants.OP_pushnull);
+            initializeFactoryFunctions.addInstruction(ABCConstants.OP_initproperty, NAME_FONTFACE_ARRAY);
+    
             // Initialize "inheritingStyles".
             @SuppressWarnings("unused")
             final String inheritingStylesText =
@@ -277,6 +305,19 @@ public class CSSReducer implements ICSSCodeGenResult
             initializeFactoryFunctions.addInstruction(ABCConstants.OP_initproperty, 
                     new Name(DATA_ARRAY + Integer.toString(styleTagIndex)));
     
+            // Initialize "fontFaces".
+            initializeFactoryFunctions.addInstruction(ABCConstants.OP_getlocal0);
+            for (String fontFace: fontFaces)
+            {
+                initializeFactoryFunctions.addInstruction(ABCConstants.OP_pushstring, fontFace);
+            }
+            if (fontFaces.size() > 0)
+                initializeFactoryFunctions.addInstruction(ABCConstants.OP_newarray, fontFaces.size());
+            else
+                initializeFactoryFunctions.addInstruction(ABCConstants.OP_pushnull);
+            initializeFactoryFunctions.addInstruction(ABCConstants.OP_initproperty, 
+                    new Name(FONTFACE_ARRAY + Integer.toString(styleTagIndex)));
+
             // Initialize "inheritingStyles".
             @SuppressWarnings("unused")
             final String inheritingStylesText =
@@ -719,7 +760,9 @@ public class CSSReducer implements ICSSCodeGenResult
 
     public PairOfInstructionLists reduceFontFace(ICSSNode site)
     {
-        // TODO Implement @font-face code generation
+        CSSFontFace fontFace = (CSSFontFace)site;
+        String fontFaceSource = fontFace.getSourceValue();
+        fontFaces.add(fontFaceSource);
         return null;
     }
 


[5/5] git commit: [flex-falcon] [refs/heads/develop] - handle escapes

Posted by ah...@apache.org.
handle escapes


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

Branch: refs/heads/develop
Commit: dc60ca0634fe0e23a8778a76bb9c1b5da57db1b4
Parents: c98ed6e
Author: Alex Harui <ah...@apache.org>
Authored: Tue Jul 14 08:25:04 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Jul 14 17:54:54 2015 -0700

----------------------------------------------------------------------
 .../internal/css/CSSStringPropertyValue.java    | 36 +++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dc60ca06/compiler/src/org/apache/flex/compiler/internal/css/CSSStringPropertyValue.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/css/CSSStringPropertyValue.java b/compiler/src/org/apache/flex/compiler/internal/css/CSSStringPropertyValue.java
index 0201357..84531ba 100644
--- a/compiler/src/org/apache/flex/compiler/internal/css/CSSStringPropertyValue.java
+++ b/compiler/src/org/apache/flex/compiler/internal/css/CSSStringPropertyValue.java
@@ -35,7 +35,7 @@ public class CSSStringPropertyValue extends CSSPropertyValue
     {
         super(tree, tokenStream, CSSModelTreeType.PROPERTY_VALUE);
         assert isQuoted(stringWithQuotes) : "Don't strip quotes in parser: [" + stringWithQuotes + "]";
-        this.value = stripQuotes(stringWithQuotes);
+        this.value = convertEscapes(stripQuotes(stringWithQuotes));
     }
 
     private final String value;
@@ -76,4 +76,38 @@ public class CSSStringPropertyValue extends CSSPropertyValue
     {
         return value.substring(1, value.length() - 1);
     }
+    
+    private static String convertEscapes(String value)
+    {
+        int idx = 0;
+        int c = value.indexOf('\\');
+        while (c != -1)
+        {
+            char cnext = value.charAt(c + 1);
+            if (cnext != '\\' && cnext != 'n' && cnext != 't' && cnext != 'r')
+            {
+                int n = value.length() - (c + 1);
+                if (n > 6)
+                    n = 6;
+                StringBuilder sub = new StringBuilder();
+                int i = 0;
+                for (; i < n; i++)
+                {
+                    char cc = value.charAt(c + i + 1);
+                    if (cc != ' ')
+                        sub.append(cc);
+                    else
+                        break;
+                }
+                int ccode = Integer.parseInt(sub.toString(), 16);
+                sub = new StringBuilder();
+                sub.append(Character.toChars(ccode));
+                value = value.substring(0, c) + sub.toString() + value.substring(c + i + 1);
+            }
+            else
+                idx += 2;
+            c = value.indexOf('\\', idx);
+        }
+        return value;
+    }
 }


[4/5] git commit: [flex-falcon] [refs/heads/develop] - handle more complex font-face

Posted by ah...@apache.org.
handle more complex font-face


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

Branch: refs/heads/develop
Commit: 1f8f602c2ac8442cd6d5cc55168d64a0c7278ffc
Parents: 350daad
Author: Alex Harui <ah...@apache.org>
Authored: Tue Jul 14 17:52:18 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Jul 14 17:54:54 2015 -0700

----------------------------------------------------------------------
 .../js/flexjs/JSCSSCompilationSession.java      | 31 ++++++++++
 .../flex/compiler/internal/css/CSSFontFace.java |  8 +++
 .../flex/compiler/internal/css/CSSProperty.java | 16 ++++-
 .../apache/flex/compiler/internal/css/CSSTree.g |  2 +-
 .../css/CSSURLAndFormatPropertyValue.java       | 65 ++++++++++++++++++++
 .../css/codegen/CSSCompilationSession.java      |  4 +-
 6 files changed, 123 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f8f602c/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 0499610..3a7ff6c 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
@@ -33,6 +33,7 @@ import org.apache.flex.compiler.css.ICSSSelectorCondition;
 import org.apache.flex.compiler.internal.codegen.js.goog.JSGoogEmitterTokens;
 import org.apache.flex.compiler.internal.css.CSSArrayPropertyValue;
 import org.apache.flex.compiler.internal.css.CSSColorPropertyValue;
+import org.apache.flex.compiler.internal.css.CSSFontFace;
 import org.apache.flex.compiler.internal.css.CSSFunctionCallPropertyValue;
 import org.apache.flex.compiler.internal.css.CSSKeywordPropertyValue;
 import org.apache.flex.compiler.internal.css.CSSNumberPropertyValue;
@@ -72,6 +73,30 @@ public class JSCSSCompilationSession extends CSSCompilationSession
         return sb.toString();
     }
     
+    private String fontFaceToString(CSSFontFace fontFace)
+    {
+        final StringBuilder result = new StringBuilder();
+        result.append("@font-face {\n");
+        result.append("    ");
+        result.append("font-family: ");
+        result.append(fontFace.getFontFamily() + ";\n");
+        result.append("    ");
+        result.append("font-style: ");
+        result.append(fontFace.getFontStyle() + ";\n");
+        result.append("    ");
+        result.append("font-weight: ");
+        result.append(fontFace.getFontStyle() + ";\n");
+        result.append("    ");
+        ArrayList<ICSSPropertyValue> sources = fontFace.getSources();
+        for (ICSSPropertyValue src : sources)
+        {
+        	result.append("src: ");
+        	result.append(src.toString() + ";\n");
+        }
+       	result.append("}\n");
+        return result.toString();
+    }
+    
     private String cssRuleToString(ICSSRule rule)
     {
         final StringBuilder result = new StringBuilder();
@@ -140,6 +165,12 @@ public class JSCSSCompilationSession extends CSSCompilationSession
     
     private void walkCSS(ICSSDocument css, StringBuilder sb)
     {
+    	for (CSSFontFace fontFace : fontFaces)
+    	{
+    		sb.append(fontFaceToString(fontFace));
+    	}
+    	if (fontFaces.size() > 0)
+    		sb.append("\n\n");
         ImmutableList<ICSSRule> rules = css.getRules();
         for (ICSSRule rule : rules)
         {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f8f602c/compiler/src/org/apache/flex/compiler/internal/css/CSSFontFace.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/css/CSSFontFace.java b/compiler/src/org/apache/flex/compiler/internal/css/CSSFontFace.java
index 3a679cc..2bcf249 100644
--- a/compiler/src/org/apache/flex/compiler/internal/css/CSSFontFace.java
+++ b/compiler/src/org/apache/flex/compiler/internal/css/CSSFontFace.java
@@ -21,6 +21,7 @@ package org.apache.flex.compiler.internal.css;
 
 import static com.google.common.base.Preconditions.checkNotNull;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.antlr.runtime.TokenStream;
@@ -66,6 +67,7 @@ public class CSSFontFace extends CSSNodeBase implements ICSSFontFace
             final ICSSPropertyValue value = property.getValue();
             if (name.equals("src"))
             {
+                sources.add(value);
                 srcValue = value;
             }
             else if (name.equals("fontFamily"))
@@ -113,12 +115,18 @@ public class CSSFontFace extends CSSNodeBase implements ICSSFontFace
     }
 
     private final CSSFunctionCallPropertyValue source;
+    private final ArrayList<ICSSPropertyValue> sources = new ArrayList<ICSSPropertyValue>();
     private final String fontFamily;
     private final String fontStyle;
     private final String fontWeight;
     private final boolean isEmbedAsCFF;
     private final boolean isAdvancedAntiAliasing;
 
+    public ArrayList<ICSSPropertyValue> getSources()
+    {
+        return sources;
+    }
+    
     @Override
     public FontFaceSourceType getSourceType()
     {

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f8f602c/compiler/src/org/apache/flex/compiler/internal/css/CSSProperty.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/css/CSSProperty.java b/compiler/src/org/apache/flex/compiler/internal/css/CSSProperty.java
index 4dd0b4d..f5947ac 100644
--- a/compiler/src/org/apache/flex/compiler/internal/css/CSSProperty.java
+++ b/compiler/src/org/apache/flex/compiler/internal/css/CSSProperty.java
@@ -74,12 +74,16 @@ public class CSSProperty extends CSSNodeBase implements ICSSProperty
         }
         if (cssName.equals("content"))
         {
-            return String.format("%s : \"%s\" ;", cssName, ((CSSStringPropertyValue)value).getValue());            
+            return String.format("%s : \"%s\" ;", cssName, escape(((CSSStringPropertyValue)value).getValue()));            
         }
         if (value instanceof CSSStringPropertyValue)
         {
             return String.format("%s : %s ;", cssName, ((CSSStringPropertyValue)value).getValue());
         }
+        if (value instanceof CSSFunctionCallPropertyValue)
+        {
+            return String.format("%s : %s ;", cssName, ((CSSFunctionCallPropertyValue)value).toString());
+        }
         if (cssName.equalsIgnoreCase("border"))
         {
             if (value instanceof CSSArrayPropertyValue) {
@@ -137,4 +141,14 @@ public class CSSProperty extends CSSNodeBase implements ICSSProperty
         return result.toString();
     }
 
+    private String escape(String content)
+    {
+        if (content.length() == 1 && content.codePointAt(0) > 255)
+        {
+            int code = content.codePointAt(0);
+            content = Integer.toHexString(code);
+            return "\\" + content;
+        }
+        return content;
+    }
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f8f602c/compiler/src/org/apache/flex/compiler/internal/css/CSSTree.g
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/css/CSSTree.g b/compiler/src/org/apache/flex/compiler/internal/css/CSSTree.g
index c1ba3db..83d9f80 100644
--- a/compiler/src/org/apache/flex/compiler/internal/css/CSSTree.g
+++ b/compiler/src/org/apache/flex/compiler/internal/css/CSSTree.g
@@ -404,7 +404,7 @@ singleValue returns [CSSPropertyValue propertyValue]
     |   ^(EMBED es=ARGUMENTS)
         { $propertyValue = new CSSFunctionCallPropertyValue($EMBED.text, $es.text, $start, tokenStream); }
     |   ^(URL url=ARGUMENTS format=formatOption*)
-        { $propertyValue = new CSSFunctionCallPropertyValue($URL.text, $url.text, $start, tokenStream); }
+        { $propertyValue = new CSSURLAndFormatPropertyValue($URL.text, $url.text, $format.text, $start, tokenStream); }
     |   ^(LOCAL l=ARGUMENTS)
         { $propertyValue = new CSSFunctionCallPropertyValue($LOCAL.text, $l.text, $start, tokenStream); }
     |   s=STRING   

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f8f602c/compiler/src/org/apache/flex/compiler/internal/css/CSSURLAndFormatPropertyValue.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/css/CSSURLAndFormatPropertyValue.java b/compiler/src/org/apache/flex/compiler/internal/css/CSSURLAndFormatPropertyValue.java
new file mode 100644
index 0000000..e7dbede
--- /dev/null
+++ b/compiler/src/org/apache/flex/compiler/internal/css/CSSURLAndFormatPropertyValue.java
@@ -0,0 +1,65 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package org.apache.flex.compiler.internal.css;
+
+import org.antlr.runtime.TokenStream;
+import org.antlr.runtime.tree.CommonTree;
+import org.apache.flex.compiler.css.ICSSDocument;
+
+/**
+ * @author aharui
+ *
+ */
+public class CSSURLAndFormatPropertyValue extends CSSFunctionCallPropertyValue
+{
+    /**
+     * Initialize a {@link CSSURLAndFormatPropertyValue}.
+     * 
+     * @param name Function name.
+     * @param rawArguments Raw argument string with parentheses and quotes.
+     * @param tree AST.
+     * @param tokenStream Token stream.
+     */
+    public CSSURLAndFormatPropertyValue(final String name,
+                                        final String rawArguments,
+                                        final String format,
+                                        final CommonTree tree,
+                                        final TokenStream tokenStream)
+    {
+        super(name, rawArguments, tree, tokenStream);
+        this.format = format;
+    }
+
+    private String format;
+    
+    /**
+     * Generate CSS code fragment for this model object. This is used by
+     * recursively generating a CSS document from a {@link ICSSDocument} for
+     * debugging and testing purposes.
+     */
+    @Override
+    public String toString()
+    {
+        if (format == null)
+            return super.toString();
+        return super.toString() + " " + format;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/1f8f602c/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSCompilationSession.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSCompilationSession.java b/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSCompilationSession.java
index 8cb40d0..ae98028 100644
--- a/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSCompilationSession.java
+++ b/compiler/src/org/apache/flex/compiler/internal/css/codegen/CSSCompilationSession.java
@@ -128,7 +128,7 @@ public class CSSCompilationSession
     /**
      * A set of font faces that will be included in the code generation.
      */
-    public final ArrayList<CSSFontFace> fontFaces;
+    public ArrayList<CSSFontFace> fontFaces;
 
     /**
      * A list of CSS models to be included in the code generation. The CSS
@@ -185,6 +185,8 @@ public class CSSCompilationSession
      */
     protected ICSSDocument synthesisNormalizedCSS()
     {
+        fontFaces = new ArrayList<CSSFontFace>();
+        
         for (final ICSSDocument cssDocument : cssDocuments)
         {
             for (final ICSSRule newRule : cssDocument.getRules())


[3/5] git commit: [flex-falcon] [refs/heads/develop] - special case content and quote it

Posted by ah...@apache.org.
special case content and quote it


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

Branch: refs/heads/develop
Commit: 350daadd09d65552210b621cb7adffa379f2e556
Parents: 35ba112
Author: Alex Harui <ah...@apache.org>
Authored: Tue Jul 14 08:26:19 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Jul 14 17:54:54 2015 -0700

----------------------------------------------------------------------
 .../apache/flex/compiler/internal/css/CSSProperty.java    | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/350daadd/compiler/src/org/apache/flex/compiler/internal/css/CSSProperty.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/css/CSSProperty.java b/compiler/src/org/apache/flex/compiler/internal/css/CSSProperty.java
index 76ffced..4dd0b4d 100644
--- a/compiler/src/org/apache/flex/compiler/internal/css/CSSProperty.java
+++ b/compiler/src/org/apache/flex/compiler/internal/css/CSSProperty.java
@@ -72,14 +72,20 @@ public class CSSProperty extends CSSNodeBase implements ICSSProperty
         {
             cssName = cssName.replaceAll("[A-Z]", "-$0").toLowerCase();
         }
+        if (cssName.equals("content"))
+        {
+            return String.format("%s : \"%s\" ;", cssName, ((CSSStringPropertyValue)value).getValue());            
+        }
         if (value instanceof CSSStringPropertyValue)
         {
             return String.format("%s : %s ;", cssName, ((CSSStringPropertyValue)value).getValue());
         }
         if (cssName.equalsIgnoreCase("border"))
         {
-            CSSArrayPropertyValue borderValues = (CSSArrayPropertyValue)value;
-            return String.format("%s : %s ;", cssName, Joiner.on(" ").join(borderValues.getElements()));
+            if (value instanceof CSSArrayPropertyValue) {
+                CSSArrayPropertyValue borderValues = (CSSArrayPropertyValue)value;
+                return String.format("%s : %s ;", cssName, Joiner.on(" ").join(borderValues.getElements()));
+            }
         }
         return String.format("%s : %s ;", cssName, value.toString());
     }


[2/5] git commit: [flex-falcon] [refs/heads/develop] - handle #fff. 3-digits after the hash get each digit duplicated!

Posted by ah...@apache.org.
handle #fff.  3-digits after the hash get each digit duplicated!


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

Branch: refs/heads/develop
Commit: 35ba11290aa8e0315affb68b9935c79e4aa93d38
Parents: dc60ca0
Author: Alex Harui <ah...@apache.org>
Authored: Tue Jul 14 08:25:39 2015 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Tue Jul 14 17:54:54 2015 -0700

----------------------------------------------------------------------
 .../compiler/internal/css/CSSColorPropertyValue.java  | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/35ba1129/compiler/src/org/apache/flex/compiler/internal/css/CSSColorPropertyValue.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/css/CSSColorPropertyValue.java b/compiler/src/org/apache/flex/compiler/internal/css/CSSColorPropertyValue.java
index b63cf1f..909d2b5 100644
--- a/compiler/src/org/apache/flex/compiler/internal/css/CSSColorPropertyValue.java
+++ b/compiler/src/org/apache/flex/compiler/internal/css/CSSColorPropertyValue.java
@@ -197,10 +197,22 @@ public class CSSColorPropertyValue extends CSSPropertyValue
                                     final TokenStream tokenStream)
     {
         super(tree, tokenStream, CSSModelTreeType.PROPERTY_VALUE);
-        final String tokenText = tree.token.getText();
+        String tokenText = tree.token.getText();
         assert tokenText.startsWith("#") : "Invalid color:" + tokenText;
 
         this.token = tree.token;
+        if (tokenText.length() == 4)
+        {
+            StringBuilder six = new StringBuilder();
+            six.append("#");
+            six.append(tokenText.charAt(1));
+            six.append(tokenText.charAt(1));
+            six.append(tokenText.charAt(2));
+            six.append(tokenText.charAt(2));
+            six.append(tokenText.charAt(3));
+            six.append(tokenText.charAt(3));
+            tokenText = six.toString();
+        }
         this.colorInt = Integer.parseInt(tokenText.substring(1), 16);
     }