org.apache.royale.core.SimpleCSSValuesImpl.prototype.getValue = function()

in asdoc/org/apache/royale/core/SimpleCSSValuesImpl.js [187:303]


org.apache.royale.core.SimpleCSSValuesImpl.prototype.getValue = function(thisObject, valueName, state, attrs) {
  state = typeof state !== 'undefined' ? state : null;
  attrs = typeof attrs !== 'undefined' ? attrs : null;
  valueName = this.org_apache_royale_core_SimpleCSSValuesImpl_toCamelCase(valueName);
  var /** @type {*} */ value;
  var /** @type {*} */ o;
  var /** @type {string} */ className;
  var /** @type {string} */ selectorName;
  if (org.apache.royale.utils.Language.is(thisObject, org.apache.royale.core.IStyleableObject)) {
    var /** @type {Object} */ styleable = thisObject;
    if (styleable.style != null) {
      
      value = styleable.style[valueName];
      this.foundIndex = (this.org_apache_royale_core_SimpleCSSValuesImpl_lastIndex * 2) >> 0;
      if (value === org.apache.royale.core.SimpleCSSValuesImpl.INHERIT)
        return this.org_apache_royale_core_SimpleCSSValuesImpl_getInheritingValue(thisObject, valueName, state, attrs);
      if (value !== undefined)
        return value;
    }
    if (styleable.id != null) {
      o = this.values["#" + styleable.id];
      if (o !== undefined) {
        this.foundIndex = (o[org.apache.royale.core.SimpleCSSValuesImpl.INDEX] + this.org_apache_royale_core_SimpleCSSValuesImpl_lastIndex) >> 0;
        value = o[valueName];
        if (value === org.apache.royale.core.SimpleCSSValuesImpl.INHERIT)
          return this.org_apache_royale_core_SimpleCSSValuesImpl_getInheritingValue(thisObject, valueName, state, attrs);
        if (value !== undefined)
          return value;
      }
    }
    var /** @type {string} */ classNames = styleable.className;
    var /** @type {*} */ classValue;
    if (classNames != null) {
      var /** @type {Array} */ classNameList = classNames.split(" ");
      var foreachiter0_target = classNameList;
      for (var foreachiter0 in foreachiter0_target) 
      {
      className = foreachiter0_target[foreachiter0];
      {
        if (state != null) {
          selectorName = className + ":" + state;
          o = this.values["." + selectorName];
          if (o !== undefined) {
            this.foundIndex = (o[org.apache.royale.core.SimpleCSSValuesImpl.INDEX]) >> 0;
            value = o[valueName];
            if (value === org.apache.royale.core.SimpleCSSValuesImpl.INHERIT)
              classValue = this.org_apache_royale_core_SimpleCSSValuesImpl_getInheritingValue(thisObject, valueName, state, attrs);
            if (value !== undefined)
              classValue = value;
          }
        }
        o = this.values["." + className];
        if (o !== undefined) {
          this.foundIndex = (o[org.apache.royale.core.SimpleCSSValuesImpl.INDEX]) >> 0;
          value = o[valueName];
          if (value === org.apache.royale.core.SimpleCSSValuesImpl.INHERIT)
            classValue = this.org_apache_royale_core_SimpleCSSValuesImpl_getInheritingValue(thisObject, valueName, state, attrs);
          if (value !== undefined)
            classValue = value;
        }
      }}
      
    }
    if (classValue !== undefined)
      return classValue;
  }
  o = this.values["*"];
  if (o !== undefined) {
    this.foundIndex = this.org_apache_royale_core_SimpleCSSValuesImpl_lastIndex;
    value = o[valueName];
    if (value !== undefined)
      return value;
  }
  
  className = org.apache.royale.utils.Language.string(thisObject.ROYALE_CLASS_INFO.names[0].qName);
  var /** @type {Object} */ thisInstance = thisObject;
  while (className != "Object") {
    if (state != null) {
      selectorName = className + ":" + state;
      o = this.values[selectorName];
      if (o !== undefined) {
        this.foundIndex = (0 - o[org.apache.royale.core.SimpleCSSValuesImpl.INDEX]) >> 0;
        value = o[valueName];
        if (value === org.apache.royale.core.SimpleCSSValuesImpl.INHERIT)
          return this.org_apache_royale_core_SimpleCSSValuesImpl_getInheritingValue(thisObject, valueName, state, attrs);
        if (value !== undefined)
          return value;
      }
    }
    o = this.values[className];
    if (o !== undefined) {
      this.foundIndex = (0 - o[org.apache.royale.core.SimpleCSSValuesImpl.INDEX]) >> 0;
      value = o[valueName];
      if (value === org.apache.royale.core.SimpleCSSValuesImpl.INHERIT)
        return this.org_apache_royale_core_SimpleCSSValuesImpl_getInheritingValue(thisObject, valueName, state, attrs);
      if (value !== undefined)
        return value;
    }
    
    var /** @type {Object} */ constructorAsObject = thisInstance["constructor"];
    thisInstance = constructorAsObject.superClass_;
    if (!thisInstance || !thisInstance.ROYALE_CLASS_INFO)
      break;
    className = org.apache.royale.utils.Language.string(thisInstance.ROYALE_CLASS_INFO.names[0].qName);
  }
  if (org.apache.royale.core.SimpleCSSValuesImpl.inheritingStyles[valueName] !== undefined && org.apache.royale.utils.Language.is(thisObject, org.apache.royale.core.IChild)) {
    var /** @type {Object} */ parentObject = thisObject.parent;
    if (parentObject)
      return this.getValue(parentObject, valueName, state, attrs);
  }
  this.foundIndex = (0 - this.org_apache_royale_core_SimpleCSSValuesImpl_lastIndex) >> 0;
  o = this.values["global"];
  if (o !== undefined) {
    return o[valueName];
  }
  return undefined;
};