flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [10/50] git commit: [flex-asjs] [refs/heads/develop] - support inline styles
Date Thu, 25 Sep 2014 16:03:52 GMT
support inline styles


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

Branch: refs/heads/develop
Commit: 0358d0bc14c1a6318854e6003fdf81cdcb2728b7
Parents: 00eddfe
Author: Alex Harui <aharui@apache.org>
Authored: Mon Sep 15 15:00:55 2014 -0700
Committer: Alex Harui <aharui@apache.org>
Committed: Tue Sep 23 14:49:44 2014 -0700

----------------------------------------------------------------------
 .../org/apache/flex/core/SimpleCSSValuesImpl.as | 46 ++++++++++++++++++--
 1 file changed, 43 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/0358d0bc/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleCSSValuesImpl.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleCSSValuesImpl.as
b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleCSSValuesImpl.as
index 902e5b5..95b0987 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleCSSValuesImpl.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/core/SimpleCSSValuesImpl.as
@@ -268,9 +268,23 @@ package org.apache.flex.core
 			var className:String;
 			var selectorName:String;
 			
-			if ("className" in thisObject)
+			if (thisObject is IStyleableObject)
 			{
-				className = thisObject.className;
+                var styleable:IStyleableObject = IStyleableObject(thisObject);
+                if (styleable.style != null)
+                {
+                    try {
+                        value = styleable.style[valueName];
+                    }
+                    catch (e:Error) {
+                        value = undefined;
+                    }
+                    if (value == "inherit")
+                        return getInheritingValue(thisObject, valueName, state, attrs);
+                    if (value !== undefined)
+                        return value;
+                }
+				className = styleable.className;
 				if (state)
 				{
 					selectorName = className + ":" + state;
@@ -278,6 +292,8 @@ package org.apache.flex.core
 					if (o)
 					{
 						value = o[valueName];
+                        if (value == "inherit")
+                            return getInheritingValue(thisObject, valueName, state, attrs);
 						if (value !== undefined)
 							return value;
 					}
@@ -287,6 +303,8 @@ package org.apache.flex.core
 				if (o)
 				{
 					value = o[valueName];
+                    if (value == "inherit")
+                        return getInheritingValue(thisObject, valueName, state, attrs);
 					if (value !== undefined)
 						return value;
 				}
@@ -303,6 +321,8 @@ package org.apache.flex.core
 					if (o)
 					{
 						value = o[valueName];
+                        if (value == "inherit")
+                            return getInheritingValue(thisObject, valueName, state, attrs);
 						if (value !== undefined)
 							return value;
 					}
@@ -312,6 +332,8 @@ package org.apache.flex.core
 	            if (o)
 	            {
 	                value = o[valueName];
+                    if (value == "inherit")
+                        return getInheritingValue(thisObject, valueName, state, attrs);
 	                if (value !== undefined)
 	                    return value;
 	            }
@@ -339,9 +361,27 @@ package org.apache.flex.core
 			{
 				return o[valueName];
 			}
-			return null;
+			return undefined;
 		}
 		
+        private function getInheritingValue(thisObject:Object, valueName:String, state:String
= null, attrs:Object = null):*
+        {
+            var value:*;
+            if (thisObject is IChild)
+            {
+                var parentObject:Object = IChild(thisObject).parent;
+                if (parentObject)
+                {
+                    value = getValue(parentObject, valueName, state, attrs);
+                    if (value == "inherit" || value === undefined)
+                        return getInheritingValue(parentObject, valueName, state, attrs);
+                    if (value !== undefined)
+                        return value;
+                }
+            }
+            return "inherit";
+        }
+        
         /**
          *  A method that stores a value to be shared with other objects.
          *  It is global, not per instance.  Fancier implementations


Mime
View raw message