Repository: flex-falcon
Updated Branches:
  refs/heads/develop 920cc51f8 -> 309900734


fix css output.  encoder could use a refactor


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

Branch: refs/heads/develop
Commit: 3099007347ad0f95ae2a0886d7899274937536ea
Parents: 920cc51
Author: Alex Harui <[email protected]>
Authored: Mon Jul 17 07:45:27 2017 -0700
Committer: Alex Harui <[email protected]>
Committed: Mon Jul 17 07:45:27 2017 -0700

----------------------------------------------------------------------
 .../js/flexjs/JSCSSCompilationSession.java      | 58 ++++++++++++++++++++
 .../internal/css/codegen/CSSReducer.java        | 10 ++++
 2 files changed, 68 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/30990073/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/flexjs/JSCSSCompilationSession.java
----------------------------------------------------------------------
diff --git 
a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/flexjs/JSCSSCompilationSession.java
 
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/flexjs/JSCSSCompilationSession.java
index a3a9d54..902b624 100644
--- 
a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/flexjs/JSCSSCompilationSession.java
+++ 
b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/driver/js/flexjs/JSCSSCompilationSession.java
@@ -324,6 +324,64 @@ public class JSCSSCompilationSession extends 
CSSCompilationSession
                 }
                 result.append("]");
             }
+            else if (value instanceof CSSMultiValuePropertyValue)
+            {
+                ImmutableList<? extends ICSSPropertyValue> values = 
((CSSMultiValuePropertyValue)value).getElements();
+                result.append("[");
+                boolean firstone = true;
+                for (ICSSPropertyValue val : values)
+                {
+                    if (firstone)
+                        firstone = false;
+                    else
+                        result.append(", ");
+                    if (val instanceof CSSStringPropertyValue)
+                    {
+                        result.append("\"" + 
((CSSStringPropertyValue)val).getValue() + "\"");
+                    }
+                    else if (val instanceof CSSColorPropertyValue)
+                    {
+                        result.append(new 
Integer(((CSSColorPropertyValue)val).getColorAsInt()));
+                    }
+                    else if (val instanceof CSSRgbColorPropertyValue)
+                    {
+                        result.append(new 
Integer(((CSSRgbColorPropertyValue)val).getColorAsInt()));
+                    }
+                    else if (value instanceof CSSRgbaColorPropertyValue)
+                    {
+                        //todo: handle alpha in the RGBA ?
+                        result.append(new 
Integer(((CSSRgbaColorPropertyValue)value).getColorAsInt()));
+                    }
+                    else if (val instanceof CSSKeywordPropertyValue)
+                    {
+                        CSSKeywordPropertyValue keywordValue = 
(CSSKeywordPropertyValue)val;
+                        String keywordString = keywordValue.getKeyword();
+                        if (IASLanguageConstants.TRUE.equals(keywordString))
+                            result.append("true");
+                        else if 
(IASLanguageConstants.FALSE.equals(keywordString))
+                            result.append("false");
+                        else
+                            result.append("\"" + 
((CSSKeywordPropertyValue)val).getKeyword() + "\"");
+                    }
+                    else if (val instanceof CSSNumberPropertyValue)
+                    {
+                        result.append(new 
Double(((CSSNumberPropertyValue)val).getNumber().doubleValue()));
+                    }
+                    else if (val instanceof CSSURLAndFormatPropertyValue)
+                    {
+                        result.append("\"" + 
((CSSURLAndFormatPropertyValue)val).toString() + "\"");
+                    }
+                    else if (val instanceof CSSMultiValuePropertyValue)
+                    {
+                        result.append("\"" + 
((CSSMultiValuePropertyValue)val).toString() + "\"");
+                    }
+                    else
+                    {
+                        result.append("unexpected value type: " + 
val.toString());
+                    }
+                }
+                result.append("]");
+            }
             else if (value instanceof CSSStringPropertyValue)
             {
                 result.append("\"" + 
((CSSStringPropertyValue)value).getValue() + "\"");

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/30990073/compiler/src/main/java/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java
----------------------------------------------------------------------
diff --git 
a/compiler/src/main/java/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java
 
b/compiler/src/main/java/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java
index 0d4d82b..87bdcdb 100644
--- 
a/compiler/src/main/java/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java
+++ 
b/compiler/src/main/java/org/apache/flex/compiler/internal/css/codegen/CSSReducer.java
@@ -55,6 +55,7 @@ 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.CSSMultiValuePropertyValue;
 import org.apache.flex.compiler.internal.css.CSSNumberPropertyValue;
 import org.apache.flex.compiler.internal.css.CSSRgbColorPropertyValue;
 import org.apache.flex.compiler.internal.css.CSSRgbaColorPropertyValue;
@@ -539,6 +540,15 @@ public class CSSReducer implements ICSSCodeGenResult
             }
             valueInstructions.addInstruction(ABCConstants.OP_newarray, 
arrayValue.getElements().size());
         }
+        else if (value instanceof CSSMultiValuePropertyValue)
+        {
+            final CSSMultiValuePropertyValue arrayValue = 
(CSSMultiValuePropertyValue)value;
+            for (final ICSSPropertyValue elementValue : 
arrayValue.getElements())
+            {
+                
valueInstructions.addAll(getInstructionListForPropertyValue(elementValue));
+            }
+            valueInstructions.addInstruction(ABCConstants.OP_newarray, 
arrayValue.getElements().size());
+        }
         else
         {
             assert false : "Unsupported property value: " + value;

Reply via email to