flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [1/2] git commit: [flex-falcon] - Make CSS parsing and toString() more compliant so it can be used in JS
Date Wed, 24 Apr 2013 17:39:32 GMT
Updated Branches:
  refs/heads/develop c5bd521f1 -> 6a164f397


Make CSS parsing and toString() more compliant so it can be used in JS


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

Branch: refs/heads/develop
Commit: 9a416a2c7ddcd089877263dab9cc992801d8582a
Parents: c5bd521
Author: Alex Harui <aharui@apache.org>
Authored: Wed Apr 24 10:21:11 2013 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Wed Apr 24 10:21:11 2013 -0700

----------------------------------------------------------------------
 .../flex/compiler/internal/css/CSSProperty.java    |   39 +++++++--------
 .../compiler/internal/css/codegen/CSSReducer.java  |    5 ++
 2 files changed, 24 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9a416a2c/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 4c36a7c..3c7bc87 100644
--- a/compiler/src/org/apache/flex/compiler/internal/css/CSSProperty.java
+++ b/compiler/src/org/apache/flex/compiler/internal/css/CSSProperty.java
@@ -1,20 +1,15 @@
 /*
- *
- *  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.
- *
+ * 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;
@@ -24,6 +19,8 @@ import org.antlr.runtime.tree.CommonTree;
 
 import org.apache.flex.compiler.css.ICSSProperty;
 import org.apache.flex.compiler.css.ICSSPropertyValue;
+
+import com.google.common.base.Joiner;
 import com.google.common.base.Strings;
 
 /**
@@ -31,10 +28,7 @@ import com.google.common.base.Strings;
  */
 public class CSSProperty extends CSSNodeBase implements ICSSProperty
 {
-    protected CSSProperty(final String name,
-                          final CSSPropertyValue value,
-                          final CommonTree tree,
-                          final TokenStream tokenStream)
+    protected CSSProperty(final String name, final CSSPropertyValue value, final CommonTree
tree, final TokenStream tokenStream)
     {
         super(tree, tokenStream, CSSModelTreeType.PROPERTY);
         assert !Strings.isNullOrEmpty(name) : "CSS property name can't be empty.";
@@ -63,6 +57,11 @@ public class CSSProperty extends CSSNodeBase implements ICSSProperty
     @Override
     public String toString()
     {
+        if (rawName.equalsIgnoreCase("border"))
+        {
+            CSSArrayPropertyValue borderValues = (CSSArrayPropertyValue)value;
+            return String.format("%s : %s ;", rawName, Joiner.on(" ").join(borderValues.getElements()));
+        }
         return String.format("%s : %s ;", rawName, value.toString());
     }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/9a416a2c/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 e1a77ce..f41aafb 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
@@ -391,6 +391,11 @@ public class CSSReducer implements ICSSCodeGenResult
                     valueInstructions.addInstruction(ABCConstants.OP_getlex, reference.getMName());
                 }
             }
+            else if ("url".equals(functionCall.name))
+            {
+                final String urlString = CSSFunctionCallPropertyValue.getSingleArgumentFromRaw(functionCall.rawArguments);
+                valueInstructions.addInstruction(ABCConstants.OP_pushstring, urlString);
+            }
             else if ("PropertyReference".equals(functionCall.name))
             {
                 // TODO: implement me


Mime
View raw message