FLEX-35340 handle more CSS situations in encoding

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

Branch: refs/heads/develop
Commit: 6e5879752eb00b34b962ba20ffaeb0b03850abdb
Parents: 98ffba3
Author: Alex Harui <aha...@apache.org>
Authored: Fri Jul 14 10:51:09 2017 -0700
Committer: Alex Harui <aha...@apache.org>
Committed: Fri Jul 14 10:51:09 2017 -0700

----------------------------------------------------------------------
 .../js/flexjs/JSCSSCompilationSession.java      | 18 ++++++++++-
 .../mxml/flexjs/TestFlexJSMXMLApplication.java  |  4 +++
 .../resources/flexjs/files/CSSTestSource.css    | 23 ++++++++++++--
 .../files/CSSTestSource_encoded_result.txt      | 22 +++++++++++++
 .../flexjs/files/CSSTestSource_result.css       | 33 +++++++++++++++++---
 5 files changed, 92 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6e587975/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 2a77161..a3a9d54 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
@@ -39,7 +39,15 @@ import com.google.common.collect.ImmutableList;
 
 public class JSCSSCompilationSession extends CSSCompilationSession
 {
-
+       private List<String> otherCSSFunctions = Arrays.asList(
+                        "-moz-linear-gradient",
+                "-webkit-linear-gradient",
+                "linear-gradient",
+                "progid:DXImageTransform.Microsoft.gradient",
+                "translateX",
+                "translateY"   
+       );
+       
     private ArrayList<String> requires;
     
     public String getEncodedCSS()
@@ -305,6 +313,10 @@ public class JSCSSCompilationSession extends 
CSSCompilationSession
                     {
                         result.append("\"" + 
((CSSURLAndFormatPropertyValue)val).toString() + "\"");
                     }
+                    else if (val instanceof CSSMultiValuePropertyValue)
+                    {
+                        result.append("\"" + 
((CSSMultiValuePropertyValue)val).toString() + "\"");
+                    }
                     else
                     {
                         result.append("unexpected value type: " + 
val.toString());
@@ -383,6 +395,10 @@ public class JSCSSCompilationSession extends 
CSSCompilationSession
                     problems.add(e);
                     */
                 }
+                else if (otherCSSFunctions.contains(functionCall.name))
+                {
+                       // ignore for now?
+                }
                 else
                 {
                     assert false : "CSS parser bug: unexpected function call 
property value: " + functionCall;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6e587975/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
----------------------------------------------------------------------
diff --git 
a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
 
b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
index 1c5433b..2ff5ad1 100644
--- 
a/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
+++ 
b/compiler-jx/src/test/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/TestFlexJSMXMLApplication.java
@@ -66,6 +66,10 @@ public class TestFlexJSMXMLApplication extends FlexJSTestBase
         String result = getCodeFromFile("CSSTestSource_result.css", 
"flexjs/files");
         String output = jscss.emitCSS();       
         assertThat(output, is(result));
+        String encoding = jscss.getEncodedCSS();
+        result = getCodeFromFile("CSSTestSource_encoded_result.txt", 
"flexjs/files");
+        assertThat(encoding, is(result));
+        
 
     }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6e587975/compiler-jx/src/test/resources/flexjs/files/CSSTestSource.css
----------------------------------------------------------------------
diff --git a/compiler-jx/src/test/resources/flexjs/files/CSSTestSource.css 
b/compiler-jx/src/test/resources/flexjs/files/CSSTestSource.css
index 6bbb192..74340ba 100755
--- a/compiler-jx/src/test/resources/flexjs/files/CSSTestSource.css
+++ b/compiler-jx/src/test/resources/flexjs/files/CSSTestSource.css
@@ -29,14 +29,14 @@
 */
 .glass {
     borderColor:                   #767473;
-    fillAlphas:                    .60, .60, .60, .60;
+    fillAlphas:                    .60, .70, .80, .90;
     fillColors:                    #888888, #F3F3F3, #9E9E9E, #FCFCFC;
     highlightAlphas:       .07, .45;
 }
 
 .glassSlider
 {
-    fillAlphas:                    .80, .80, .80, .80;
+    fillAlphas:                    .80, .70, .60, .50;
     fillColors:                    #F3F3F3, #BBBBBB, #FCFCFC, #CCCCCC;
 }
 
@@ -86,3 +86,22 @@
   color: #fff;
   width: calc((100% - 50px)/3);
 }
+
+.FLEX35340A {
+    background: -moz-linear-gradient(top,  #ffffff 0%, #e1e1e1 100%); /* 
FF3.6-15 */
+    filter: progid:DXImageTransform.Microsoft.gradient( 
startColorstr='#ffffff', endColorstr='#e1e1e1',GradientType=0 ); /* IE6-9 */
+       transform: translateY(-50%);
+}
+
+.FLEX35340B {
+    background: -webkit-linear-gradient(top,  #ffffff 0%,#e1e1e1 100%); /* 
Chrome10-25,Safari5.1-6 */
+}
+
+.FLEX35340C {
+    background: linear-gradient(to bottom,  #ffffff 0%,#e1e1e1 100%); /* W3C, 
IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
+}
+
+.FLEX35340D {
+       font-family: Georgia, Times New Roman, Times, serif;
+       box-shadow: 0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.2),0 
1px 5px 0 rgba(0,0,0,.12);
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6e587975/compiler-jx/src/test/resources/flexjs/files/CSSTestSource_encoded_result.txt
----------------------------------------------------------------------
diff --git 
a/compiler-jx/src/test/resources/flexjs/files/CSSTestSource_encoded_result.txt 
b/compiler-jx/src/test/resources/flexjs/files/CSSTestSource_encoded_result.txt
new file mode 100755
index 0000000..2014ac0
--- /dev/null
+++ 
b/compiler-jx/src/test/resources/flexjs/files/CSSTestSource_encoded_result.txt
@@ -0,0 +1,22 @@
+/*******************************************************************************
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.
+//
+////////////////////////////////////////////////////////////////////////////////
+*/
+0,
1,
".glass",
function() {this["borderColor"] = 7763059;
this["highlightAlphas"] = [0.07000000029802322, 0.44999998807907104];
this["fillColors"] = [8947848, 15987699, 10395294, 16579836];
this["fillAlphas"] = [0.6000000238418579, 0.699999988079071, 0.800000011920929, 
0.8999999761581421]},
0,
1,
".glassSlider",
function() {this["fillColors"] = [15987699, 12303291, 16579836, 13421772];
this["fillAlphas"] = [0.800000011920929, 0.699999988079071, 0.6000000238418579, 
0.5]},
0,
1,
".listItem",
function() {this["borderStyle"] = "outset";
this["backgroundColor"] = 16777215;
this["verticalAlign"] = "middle";
this["horizontalGap"] = 5.0;
this["backgroundAlpha"] = 0.5;
this["paddingLeft"] = 4.0;
this["paddingRight"] = 4.0},
0,
1,
".outer.inner",
function() {this["width"] = 512.0},
0,
1,
".outer .inner",
function() {this["width"] = 512.0},
0,
1,
".outer>.innerTitle",
function() {this["height"] = 176.0;
this["color"] = 16777215;
this["background"] = },
0,
1,
".outer>.innerMenu",
function() {t
 his["color"] = 16777215},
0,
1,
"h4",
function() {this["color"] = 16777215},
0,
1,
".outerother.inner",
function() {this["height"] = 320.0;
this["width"] = 320.0},
0,
1,
".outerother-square>.innerTitle",
function() {this["color"] = 16777215;
this["background"] = },
0,
1,
".usescalc",
function() {this["color"] = 16777215;
this["width"] = },
0,
1,
".FLEX35340A",
function() {this["transform"] = ;
this["background"] = ;
this["filter"] = },
0,
1,
".FLEX35340B",
function() {this["background"] = },
0,
1,
".FLEX35340C",
function() {this["background"] = },
0,
1,
".FLEX35340D",
function() {this["boxShadow"] = ["0 2px 2px 0 rgba(0,0,0,.14)", "0 3px 1px -2px 
rgba(0,0,0,.2)", "0 1px 5px 0 rgba(0,0,0,.12)"];
this["fontFamily"] = ["Georgia", "Times New Roman", "Times", "serif"]}];
+
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/6e587975/compiler-jx/src/test/resources/flexjs/files/CSSTestSource_result.css
----------------------------------------------------------------------
diff --git 
a/compiler-jx/src/test/resources/flexjs/files/CSSTestSource_result.css 
b/compiler-jx/src/test/resources/flexjs/files/CSSTestSource_result.css
index bc01e64..a526831 100755
--- a/compiler-jx/src/test/resources/flexjs/files/CSSTestSource_result.css
+++ b/compiler-jx/src/test/resources/flexjs/files/CSSTestSource_result.css
@@ -21,15 +21,15 @@
 /* Generated by Apache Flex Cross-Compiler */
 .glass {
         border-color: #767473;
-        highlight-alphas: .07 .45;
-        fill-colors: #888888 #F3F3F3 #9E9E9E #FCFCFC;
-        fill-alphas: .60 .60 .60 .60;
+        highlight-alphas: .07, .45;
+        fill-colors: #888888, #F3F3F3, #9E9E9E, #FCFCFC;
+        fill-alphas: .60, .70, .80, .90;
 }
 
 
 .glassSlider {
-        fill-colors: #F3F3F3 #BBBBBB #FCFCFC #CCCCCC;
-        fill-alphas: .80 .80 .80 .80;
+        fill-colors: #F3F3F3, #BBBBBB, #FCFCFC, #CCCCCC;
+        fill-alphas: .80, .70, .60, .50;
 }
 
 
@@ -89,4 +89,27 @@
 }
 
 
+.FLEX35340A {
+        transform: translateY(-50%);
+        background: -moz-linear-gradient(top,  #ffffff 0%, #e1e1e1 100%);
+        filter: progid:DXImageTransform.Microsoft.gradient( 
startColorstr='#ffffff', endColorstr='#e1e1e1',GradientType=0 );
+}
+
+
+.FLEX35340B {
+        background: -webkit-linear-gradient(top,  #ffffff 0%,#e1e1e1 100%);
+}
+
+
+.FLEX35340C {
+        background: linear-gradient(to bottom,  #ffffff 0%,#e1e1e1 100%);
+}
+
+
+.FLEX35340D {
+        box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 3px 1px -2px 
rgba(0,0,0,.2), 0 1px 5px 0 rgba(0,0,0,.12);
+        font-family: Georgia, Times New Roman, Times, serif;
+}
+
+
 

Reply via email to