You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by er...@apache.org on 2013/11/15 15:56:23 UTC

[9/9] git commit: [flex-asjs] [refs/heads/develop] - Changed the storage and retrieval of CSS properties and associated (super) class name metadata

Changed the storage and retrieval of CSS properties and associated (super) class name metadata

Signed-off-by: Erik de Bruin <er...@ixsoftware.nl>


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

Branch: refs/heads/develop
Commit: 2f9d81409a4448b5965a2090583e89c1c0439de6
Parents: a777143
Author: Erik de Bruin <er...@ixsoftware.nl>
Authored: Fri Nov 15 15:34:27 2013 +0100
Committer: Erik de Bruin <er...@ixsoftware.nl>
Committed: Fri Nov 15 15:34:27 2013 +0100

----------------------------------------------------------------------
 .../org/apache/flex/core/SimpleCSSValuesImpl.js | 63 +++++---------------
 1 file changed, 15 insertions(+), 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2f9d8140/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleCSSValuesImpl.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleCSSValuesImpl.js b/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleCSSValuesImpl.js
index 48a4318..12c0f56 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleCSSValuesImpl.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/core/SimpleCSSValuesImpl.js
@@ -24,6 +24,16 @@ org.apache.flex.core.SimpleCSSValuesImpl = function() {
 
 
 /**
+ * Metadata
+ *
+ * @type {Object.<string, Array.<Object>>}
+ */
+org.apache.flex.core.SimpleCSSValuesImpl.prototype.FLEXJS_CLASS_INFO =
+    { names: [{ name: 'SimpleCSSValuesImpl',
+                qName: 'org.apache.flex.core.SimpleCSSValuesImpl'}] };
+
+
+/**
  * @param {Object} thisObject The object to fetch a value for.
  * @param {string} valueName The name of the value to fetch.
  * @param {string} state The psuedo-state if any for.
@@ -72,7 +82,7 @@ org.apache.flex.core.SimpleCSSValuesImpl.prototype.getValue =
     }
   }
 
-  className = this.getQualifiedClassName(thisObject);
+  className = thisObject.FLEXJS_CLASS_INFO.names[0].qName;
   while (className != 'Object')
   {
     if (state)
@@ -94,10 +104,11 @@ org.apache.flex.core.SimpleCSSValuesImpl.prototype.getValue =
       if (value !== undefined)
         return value;
     }
-    thisObject = thisObject.__proto__;
-    if (thisObject.__proto__ == null)
+    thisObject = thisObject.constructor.superClass_;
+    if (!thisObject || !thisObject.FLEXJS_CLASS_INFO)
       break;
-    className = this.getQualifiedClassName(thisObject);
+
+    className = thisObject.FLEXJS_CLASS_INFO.names[0].qName;
   }
   o = values['global'];
   if (o != undefined)
@@ -112,29 +123,6 @@ org.apache.flex.core.SimpleCSSValuesImpl.prototype.getValue =
 
 
 /**
- * @param {Object} thisObject The object to get a name for.
- * @return {?string} The CSS selector name or null.
- */
-org.apache.flex.core.SimpleCSSValuesImpl.prototype.getQualifiedClassName =
-    function(thisObject) {
-  // relies on the values parser to populate the package tree
-  var proto = thisObject.__proto__;
-  if (proto.hasOwnProperty('__css__package_parent'))
-  {
-    var s = proto.__css__name;
-    while (true)
-    {
-      proto = proto.__css__package_parent;
-      if (proto == window || proto == undefined)
-        return s;
-      s = proto.__css__name + '.' + s;
-    }
-  }
-  return null;
-};
-
-
-/**
  * @param {Object} mainclass The main class for the application.
  */
 org.apache.flex.core.SimpleCSSValuesImpl.prototype.init = function(mainclass) {
@@ -159,27 +147,6 @@ org.apache.flex.core.SimpleCSSValuesImpl.prototype.init = function(mainclass) {
       for (var j = 0; j < numSel; j++)
       {
         var selName = cssData[i++];
-        if (selName.indexOf('.') != 0 &&
-            selName != '*' && selName != 'global')
-        {
-          // should be a type selector
-          var parts = selName.split('.');
-          var numParts = parts.length;
-          var part = window;
-          for (var k = 0; k < numParts; k++)
-          {
-            var partName = parts[k];
-            var subpart = part[partName];
-            if (subpart == undefined)
-              break;
-            // assume last part is ctor func
-            if (k == numParts - 1)
-              subpart = subpart.prototype;
-            subpart.__css__package_parent = part;
-            subpart.__css__name = partName;
-            part = subpart;
-          }
-        }
         if (values[selName])
           props = values[selName];
         values[selName] = props;