Transferred from the Adobe Open Source Subversion Repository

Revision: 8
Author:   open-source-svn-admin@adobe.com
Date:     2007-12-15T01:49:31.087529Z

Log Message:
-----------
The beginning of the open-source Flex SDK.

Populated the flex/sdk/trunk directory with an open-source subset of files from //depot/flex/sdk/...@191097 in the Faramir Perforce server. This changelist is a bit past the 3.0rc0 build.

The Ant scripts will not successfully build yet. They need to be adapted to the open-source subset.

Modified Paths:
--------------
2532 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1269090 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/mx/src/mx/controls/treeClasses/DefaultDataDescriptor.as
+++ frameworks/projects/mx/src/mx/controls/treeClasses/DefaultDataDescriptor.as
@@ -0,0 +1,624 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2006-2007 Adobe Systems Incorporated
+//  All Rights Reserved.
+//
+//  NOTICE: Adobe permits you to use, modify, and distribute this file
+//  in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package mx.controls.treeClasses
+{
+
+import flash.utils.Dictionary;
+import mx.collections.ArrayCollection;
+import mx.collections.CursorBookmark;
+import mx.collections.ICollectionView;
+import mx.collections.IList;
+import mx.collections.IViewCursor;
+import mx.collections.XMLListCollection;
+import mx.controls.menuClasses.IMenuDataDescriptor;
+import mx.utils.UIDUtil;
+
+/**
+ *  The DefaultDataDescriptor class provides a default implementation for
+ *  accessing and manipulating data for use in controls such as Tree and Menu.
+ *
+ *  This implementation handles e4x XML and object nodes in similar but different
+ *  ways. See each method description for details on how the method
+ *  accesses values in nodes of various types.
+ *
+ *  This class is the default value of the Tree, Menu, MenuBar, and
+ *  PopUpMenuButton control dataDescriptor properties.
+ *
+ *  @see mx.controls.treeClasses.ITreeDataDescriptor
+ *  @see mx.controls.menuClasses.IMenuDataDescriptor
+ *  @see mx.controls.Menu
+ *  @see mx.controls.MenuBar
+ *  @see mx.controls.PopUpMenuButton
+ *  @see mx.controls.Tree
+ */
+public class DefaultDataDescriptor implements ITreeDataDescriptor2, IMenuDataDescriptor
+{
+    include "../../core/Version.as";
+
+    /**
+     *  Constructor
+     */
+    public function DefaultDataDescriptor()
+    {
+        super();
+    }
+
+    /**
+     *  @private
+     */
+    private var ChildCollectionCache:Dictionary = new Dictionary(true);
+
+    /**
+     *  Provides access to a node's children. Returns a collection
+     *  of children if they exist. If the node is an Object, the method
+     *  returns the contents of the object's children field as
+     *  an ArrayCollection.
+     *  If the node is XML, the method returns an XMLListCollection containing
+     *  the child elements.
+     *
+     *  @param node The node object currently being evaluated.
+     *  @param model The collection that contains the node; ignored by this class.
+     *  @return An object containing the children nodes.
+     */
+    public function getChildren(node:Object, model:Object = null):ICollectionView
+    {
+        if (node == null)
+            return null;
+
+        var children:*;
+        var childrenCollection:ICollectionView;
+
+        //first get the children based on the type of node.
+        if (node is XML)
+        {
+            //trace("getChildren", node.toXMLString());
+            children = node.*;
+        }
+        else if (node is Object)
+        {
+            //we'll try the default children property
+            try
+            {
+                children = node.children;
+            }
+            catch(e:Error)
+            {
+            }
+        }
+
+        //no children exist for this node
+        if (children == undefined && !(children is XMLList))
+            return null;
+
+        //then wrap children in ICollectionView if necessary
+        if (children is ICollectionView)
+        {
+            childrenCollection = ICollectionView(children);
+        }
+        else if (children is Array)
+        {
+            var oldArrayCollection:ArrayCollection = ChildCollectionCache[node];
+            if (!oldArrayCollection)
+            {
+                childrenCollection = new ArrayCollection(children);
+                ChildCollectionCache[node] = childrenCollection;
+            }
+            else
+            {
+                childrenCollection = oldArrayCollection;
+                ArrayCollection(childrenCollection).mx_internal::dispatchResetEvent = false;
+                ArrayCollection(childrenCollection).source = children;
+            }
+
+        }
+        else if (children is XMLList)
+        {
+            var oldXMLCollection:XMLListCollection = ChildCollectionCache[node];
+            if (!oldXMLCollection)
+            {
+                // double check since XML as dictionary keys is inconsistent
+                for (var p:* in ChildCollectionCache)
+                {
+                    if (p === node)
+                    {
+                        oldXMLCollection = ChildCollectionCache[p];
+                        break;
+                    }
+                }
+            }
+
+            if (!oldXMLCollection)
+            {
+                childrenCollection =  new XMLListCollection(children);
+                ChildCollectionCache[node] = childrenCollection;
+            }
+            else
+            {
+                childrenCollection = oldXMLCollection;
+
+                //We don't want to send a RESET type of collectionChange event in this case.
+                XMLListCollection(childrenCollection).mx_internal::dispatchResetEvent = false;
+                XMLListCollection(childrenCollection).source = children;
+            }
+        }
+        else
+        {
+            var childArray:Array = new Array(children);
+            if (childArray != null)
+            {
+                childrenCollection =  new ArrayCollection(childArray);
+            }
+        }
+        return childrenCollection;
+    }
+
+    /**
+     *  Returns true if the node actually has children.
+     *
+     *  @param node The node object currently being evaluated.
+     *  @param model The collection that contains the node; ignored by this class.
+     *  @return boolean indicating if this node currently has children
+     */
+    public function hasChildren(node:Object, model:Object = null):Boolean
+    {
+        if (node == null)
+            return false;
+
+        //This default impl can't optimize this call to getChildren
+        //since we can't make any assumptions by type.  Custom impl's
+        //can probably avoid this call and reduce the number of calls to
+        //getChildren if need be.
+        var children:ICollectionView = getChildren(node, model);
+        try
+        {
+            if (children.length > 0)
+                return true;
+        }
+        catch(e:Error)
+        {
+        }
+        return false;
+    }
+
+    /**
+     *  Tests a node for termination.
+     *  Branches are non-terminating but are not required to have any leaf nodes.
+     *  If the node is XML, returns true if the node has children
+     *  or a true isBranch attribute.
+     *  If the node is an object, returns true if the node has a
+     *  (possibly empty) children field.
+     *
+     *  @param node The node object currently being evaluated.
+     *  @param model The collection that contains the node; ignored by this class.
+     *  @return boolean indicating if this node is non-terminating
+     */
+    public function isBranch(node:Object, model:Object = null):Boolean
+    {
+        if (node == null)
+            return false;
+
+        var branch:Boolean = false;
+
+        if (node is XML)
+        {
+            var childList:XMLList = node.children();
+            //accessing non-required e4x attributes is quirky
+            //but we know we'll at least get an XMLList
+            var branchFlag:XMLList = node.@isBranch;
+            //check to see if a flag has been set
+            if (branchFlag.length() == 1)
+            {
+                //check flag and return (this flag overrides termination status)
+                if (branchFlag[0] == "true")
+                    branch = true;
+            }
+            //since no flags, we'll check to see if there are children
+            else if (childList.length() != 0)
+            {
+                branch = true;
+            }
+        }
+        else if (node is Object)
+        {
+            try
+            {
+                if (node.children != undefined)
+                {
+                    branch = true;
+                }
+            }
+            catch(e:Error)
+            {
+            }
+        }
+        return branch;
+    }
+
+    /**
+     *  Returns a node's data.
+     *  Currently returns the entire node.
+     *
+     *  @param node The node object currently being evaluated.
+     *  @param model The collection that contains the node; ignored by this class.
+     *  @return The node.
+     */
+    public function getData(node:Object, model:Object = null):Object
+    {
+        return Object(node);
+    }
+
+    /**
+     *  Add a child node to a node at the specified index.
+     *  This implementation does the following:
+     *
+     *

+     *
If the parent parameter is null or undefined,
+     *          inserts the child parameter at the
+     *          specified index in the collection specified by model
+     *          parameter.
+     *

+     *
If the parent parameter has a children
+     *          field or property, the method adds the child parameter
+     *          to it at the index parameter location.
+     *          In this case, the model parameter is not required.
+     *

+     *
If the parent parameter does not have a children
+     *          field or property, the method adds the children
+     *          property to the parent. The method then adds the
+     *          child parameter to the parent at the
+     *          index parameter location.
+     *          In this case, the model parameter is not required.
+     *

+     *
If the index value is greater than the collection
+     *         length or number of children in the parent, adds the object as
+     *         the last child.
+     *

+     *

+     *
+     *  @param parent The node object that will parent the child
+     *  @param newChild The node object that will be parented by the node
+     *  @param index The 0-based index of where to put the child node relative to the parent
+     *  @param model The entire collection that this node is a part of
+     *  @return true if successful
+     */
+    public function addChildAt(parent:Object, newChild:Object, index:int, model:Object = null):Boolean
+    {
+        if (!parent)
+        {
+            try
+            {
+                if (index > model.length)
+                    index = model.length;
+                if (model is IList)
+                    IList(model).addItemAt(newChild, index);
+                else
+                {
+                    var cursor:IViewCursor = model.createCursor();
+                    cursor.seek(CursorBookmark.FIRST, index);
+                    cursor.insert(newChild);
+                }
+
+                return true;
+            }
+            catch(e:Error)
+            {
+            }
+        }
+        else
+        {
+            var children:ICollectionView = ICollectionView(getChildren(parent, model));
+            if (!children)
+            {
+                if (parent is XML)
+                {
+                    var temp:XMLList = new XMLList();
+                    XML(parent).appendChild(temp);
+                    children = new XMLListCollection(parent.children());
+                }
+                else if (parent is Object)
+                {
+                    parent.children = new ArrayCollection();
+                    children = parent.children;
+                }
+            }
+            try
+            {
+                if (index > children.length)
+                    index = children.length;
+                if (children is IList)
+                    IList(children).addItemAt(newChild, index);
+                else
+                {
+                    cursor = children.createCursor();
+                    cursor.seek(CursorBookmark.FIRST, index);
+                    cursor.insert(newChild);
+                }
+                return true;
+            }
+            catch(e:Error)
+            {
+            }
+        }
+        return false;
+    }
+
+    /**
+     *  Removes the child node from a node at the specified index.
+     *  If the parent parameter is null
+     *  or undefined, the method uses the model parameter to
+     *  access the child; otherwise, it uses the parent parameter
+     *  and ignores the model parameter.
+    *
+     *  @param parent The node object that currently parents the child node
+     *  @param child The node that is being removed
+     *  @param index The 0-based index of  the child node to remove relative to the parent
+     *  @param model The entire collection that this node is a part of
+     *  @return true if successful
+     */
+    public function removeChildAt(parent:Object, child:Object, index:int, model:Object = null):Boolean
+    {
+        //handle top level where there is no parent
+        if (!parent)
+        {
+            try
+            {
+                if (index > model.length)
+                    index = model.length;
+                if (model is IList)
+                    model.removeItemAt(index);
+                else
+                {
+                    var cursor:IViewCursor = model.createCursor();
+                    cursor.seek(CursorBookmark.FIRST, index);
+                    cursor.remove();
+                }
+
+                return true;
+            }
+            catch(e:Error)
+            {
+            }
+        }
+        else
+        {
+            var children:ICollectionView = ICollectionView(getChildren(parent, model));
+            try
+            {
+                if (index > children.length)
+                    index = children.length;
+                if (children is IList)
+                    IList(children).removeItemAt(index);
+                else
+                {
+                    cursor = children.createCursor();
+                    cursor.seek(CursorBookmark.FIRST, index);
+                    cursor.remove();
+                }
+
+                return true;
+            }
+            catch(e:Error)
+            {
+            }
+        }
+        return false;
+    }
+
+    /**
+     *  Returns the type identifier of a node.
+     *  This method is used by menu-based controls to determine if the
+     *  node represents a separator, radio button,
+     *  a check box, or normal item.
+     *
+     *  @param node The node object for which to get the type.
+     *  @return  the value of the type attribute or field,
+     *  or the empty string if there is no such field.
+     */
+    public function getType(node:Object):String
+    {
+        if (node is XML)
+        {
+            return String(node.@type);
+        }
+        else if (node is Object)
+        {
+            try
+            {
+                return String(node.type);
+            }
+            catch(e:Error)
+            {
+            }
+        }
+        return "";
+    }
+
+    /**
+     *  Returns whether the node is enabled.
+     *  This method is used by menu-based controls.
+     *
+     *  @param node The node for which to get the status.
+     *  @return the value of the node's enabled
+     *  attribute or field, or true if there is no such
+     *  entry or the value is not false.
+     */
+    public function isEnabled(node:Object):Boolean
+    {
+        var enabled:*;
+        if (node is XML)
+        {
+            enabled = node.@enabled;
+            if (enabled[0] == false)
+                return false;
+        }
+        else if (node is Object)
+        {
+            try
+            {
+                return !("false" == String(node.enabled))
+            }
+            catch(e:Error)
+            {
+            }
+        }
+        return true;
+    }
+
+    /**
+     *  Sets the value of the field or attribute in the data provider
+     *  that identifies whether the node is enabled.
+     *  This method sets the value of the node's enabled
+     *  attribute or field.
+     *  This method is used by menu-based controls.
+     *
+     *  @param node The node for which to set the status.
+     *  @param value Whether the node is enabled.
+     */
+    public function setEnabled(node:Object, value:Boolean):void
+    {
+        if (node is XML)
+        {
+            node.@enabled = value;
+        }
+        else if (node is Object)
+        {
+            try
+            {
+                node.enabled = value;
+            }
+            catch(e:Error)
+            {
+            }
+        }
+    }
+
+    /**
+     *  Returns whether the node is toggled.
+     *  This method is used by menu-based controls.
+     *
+     *  @param node The node for which to get the status.
+     *  @return The value of the node's toggled
+     *  attribute or field, or false if there is no such
+     *  entry.
+     */
+    public function isToggled(node:Object):Boolean
+    {
+        if (node is XML)
+        {
+            var toggled:* = node.@toggled;
+            if (toggled[0] == true)
+                return true;
+        }
+        else if (node is Object)
+        {
+            try
+            {
+                return Boolean(node.toggled);
+            }
+            catch(e:Error)
+            {
+            }
+        }
+        return false;
+    }
+
+    /**
+     *  Sets the value of the field or attribute in the data provider
+     *  that identifies whether the node is toggled.
+     *  This method sets the value of the node's toggled
+     *  attribute or field.
+     *  This method is used by menu-based controls.
+     *
+     *  @param node The node for which to set the status.
+     *  @param value Whether the node is toggled.
+     */
+    public function setToggled(node:Object, value:Boolean):void
+    {
+        if (node is XML)
+        {
+            node.@toggled = value;
+        }
+        else if (node is Object)
+        {
+            try
+            {
+                node.toggled = value;
+            }
+            catch(e:Error)
+            {
+            }
+        }
+    }
+
+    /**
+     *  Returns the name of the radio button group to which
+     *  the node belongs, if any.
+     *  This method is used by menu-based controls.
+     *
+     *  @param node The node for which to get the group name.
+     *  @return The value of the node's groupName
+     *  attribute or field, or an empty string if there is no such
+     *  entry.
+     */
+    public function getGroupName(node:Object):String
+    {
+        if (node is XML)
+        {
+            return node.@groupName;
+        }
+        else if (node is Object)
+        {
+            try
+            {
+                return node.groupName;
+            }
+            catch(e:Error)
+            {
+            }
+        }
+        return "";
+    }
+
+    /**
+     *  @inheritDoc
+     */
+    public function getHierarchicalCollectionAdaptor(hierarchicalData:ICollectionView,
+                                                uidFunction:Function,
+                                                openItems:Object,
+                                                model:Object = null):ICollectionView
+    {
+        return new HierarchicalCollectionView(hierarchicalData,
+                                                this,
+                                                uidFunction,
+                                                openItems);
+    }
+
+    /**
+     *  @inheritDoc
+     */
+    public function getNodeDepth(node:Object, iterator:IViewCursor, model:Object = null):int
+    {
+        if (node == iterator.current)
+            return HierarchicalViewCursor(iterator).currentDepth;
+        return -1;
+    }
+
+    /**
+     *  @inheritDoc
+     */
+    public function getParent(node:Object, collection:ICollectionView, model:Object = null):Object
+    {
+        return HierarchicalCollectionView(collection).getParentItem(node);
+    }
+}
+
+}


avoid frustum culling test when Mesh.visible = false and force world space volumes computation when the Mesh is added to the scene

--- src/aerys/minko/scene/controller/mesh/VisibilityController.as
+++ src/aerys/minko/scene/controller/mesh/VisibilityController.as
@@ -56,12 +56,18 @@
 		public function set frustumCulling(value : uint) : void
 		{
 			_visibilityData.frustumCulling = value;
+            testCulling();
 		}

 		public function get insideFrustum() : Boolean
 		{
-			return _visibilityData.inFrustum;
-		}
+			return _visibilityData.insideFrustum;
+		}
+
+        public function get computedVisibility() : Boolean
+        {
+            return frustumCulling == FrustumCulling.DISABLED || insideFrustum;
+        }

 		public function VisibilityController()
 		{
@@ -76,6 +82,8 @@
 			_boundingSphere = new BoundingSphere(Vector4.ZERO, 0.);

 			_visibilityData = new MeshVisibilityDataProvider();
+
+            _state = STATE_UNDEFINED;

 			targetAdded.add(targetAddedHandler);
 			targetRemoved.add(targetRemovedHandler);
@@ -113,21 +121,23 @@
 		private function meshAddedToSceneHandler(mesh	: Mesh,
 												 scene	: Scene) : void
 		{
-			scene.bindings.addCallback('worldToScreen', worldToViewChangedHandler);
+			scene.bindings.addCallback('worldToScreen', worldToScreenChangedHandler);
+
+            meshLocalToWorldChangedHandler(mesh.localToWorld);
 			mesh.localToWorld.changed.add(meshLocalToWorldChangedHandler);
 		}

 		private function meshRemovedFromSceneHandler(mesh	: Mesh,
 													 scene	: Scene) : void
 		{
-			scene.bindings.removeCallback('worldToScreen', worldToViewChangedHandler);
+			scene.bindings.removeCallback('worldToScreen', worldToScreenChangedHandler);
 			mesh.localToWorld.changed.remove(meshLocalToWorldChangedHandler);
 		}

-		private function worldToViewChangedHandler(bindings		: DataBindings,
-												   propertyName	: String,
-												   oldValue		: Matrix4x4,
-												   newValue		: Matrix4x4) : void
+		private function worldToScreenChangedHandler(bindings	    : DataBindings,
+                                                     propertyName	: String,
+                                                     oldValue		: Matrix4x4,
+                                                     newValue		: Matrix4x4) : void
 		{
 			testCulling();
 		}
@@ -141,10 +151,7 @@
 				return ;

 			if (culling & FrustumCulling.BOX)
-				transform.transformRawVectors(
-					geom.boundingBox._vertices,
-					_boundingBox._vertices
-				);
+				transform.transformRawVectors(geom.boundingBox._vertices, _boundingBox._vertices);

 			if (culling & FrustumCulling.SPHERE)
 			{
@@ -164,7 +171,8 @@
 		{
 			var culling	: uint	= _visibilityData.frustumCulling;

-			if (culling != FrustumCulling.DISABLED && _mesh.geometry.boundingBox)
+			if (culling != FrustumCulling.DISABLED && _mesh && _mesh.geometry.boundingBox
+                && visible)
 			{
 				var camera : AbstractCamera = (_mesh.root as Scene).activeCamera;

@@ -183,12 +191,12 @@

 				if (inside && _state != STATE_INSIDE)
 				{
-					_visibilityData.inFrustum = true;
+					_visibilityData.insideFrustum = true;
 					_state = STATE_INSIDE;
 				}
 				else if (!inside && _state != STATE_OUTSIDE)
 				{
-					_visibilityData.inFrustum = false;
+					_visibilityData.insideFrustum = false;
 					_state = STATE_OUTSIDE;
 				}
 			}


fix VisibilityController null pointer exception when Geometry.boundingSphere or Geometry.boundingBox is null

--- src/aerys/minko/scene/controller/mesh/VisibilityController.as
+++ src/aerys/minko/scene/controller/mesh/VisibilityController.as
@@ -137,6 +137,9 @@
 			var geom 	: Geometry 	= _mesh.geometry;
 			var culling	: uint		= _visibilityData.frustumCulling;

+			if (!geom.boundingBox || !geom.boundingSphere)
+				return ;
+
 			if (culling & FrustumCulling.BOX)
 				transform.transformRawVectors(
 					geom.boundingBox._vertices,


Fixed node list in the editor sometimes scrolling to wrong position after deleting nodes/components.

--- Bin/Data/Scripts/Editor/EditorScene.as
+++ Bin/Data/Scripts/Editor/EditorScene.as
@@ -333,7 +333,6 @@

     BeginSelectionModify();
     ListView@ list = sceneWindow.GetChild("NodeList", true);
-    list.contentElement.DisableLayoutUpdate();

     // Remove nodes
     for (uint i = 0; i < selectedNodes.length; ++i)
@@ -386,8 +385,6 @@
             list.selection = index;
     }

-    list.contentElement.EnableLayoutUpdate();
-    list.contentElement.UpdateLayout();
     EndSelectionModify();
     return true;
 }


rename EnvironmentMappingProperties.environmentMappingEnvironmentMap to EnvironmentMappingProperties.environmentMap for consistency (and because it was really long to type...)

--- src/aerys/minko/render/material/environment/EnvironmentMappingProperties.as
+++ src/aerys/minko/render/material/environment/EnvironmentMappingProperties.as
@@ -2,11 +2,11 @@
 {
 	public final class EnvironmentMappingProperties
 	{
-		public static const ENVIRONMENT_MAP				: String	= 'environmentMappingEnvironmentMap';
-        public static const ENVIRONMENT_MAP_FILTERING	: String	= 'environmentMappingEnvironmentMapFiltering';
-        public static const ENVIRONMENT_MAP_MIPMAPPING	: String	= 'environmentMappingEnvironmentMapMipMapping';
-        public static const ENVIRONMENT_MAP_WRAPPING	: String	= 'environmentMappingEnvironmentMapWrapping';
-        public static const ENVIRONMENT_MAP_FORMAT		: String	= 'environmentMappingEnvironmentMapFormat';
+		public static const ENVIRONMENT_MAP				: String	= 'environmentMap';
+        public static const ENVIRONMENT_MAP_FILTERING	: String	= 'environmentMapFiltering';
+        public static const ENVIRONMENT_MAP_MIPMAPPING	: String	= 'environmentMapMipMapping';
+        public static const ENVIRONMENT_MAP_WRAPPING	: String	= 'environmentMapWrapping';
+        public static const ENVIRONMENT_MAP_FORMAT		: String	= 'environmentMapFormat';

 		public static const ENVIRONMENT_BLENDING		: String 	= 'environmentMappingBlending';
 		public static const ENVIRONMENT_MAPPING_TYPE	: String	= 'environmentMappingType';


Added caching for LayoutableDelegates so that they don't get rebuilt with every render

--- src/laml/layout/StackLayout.as
+++ src/laml/layout/StackLayout.as
@@ -5,16 +5,23 @@
 		protected var component:Layoutable;

 		private var cache:Object;
+		private var horizontalDelegate:LayoutableDelegate;
+		private var verticalDelegate:LayoutableDelegate;

 		public function render(component:Layoutable):void {
 			if(component.numChildren == 0) {
 				return;
 			}
+
+			if(!horizontalDelegate) {
+				horizontalDelegate = new LayoutableDelegate(component, LayoutableDelegate.HORIZONTAL);
+			}
+
+			if(!verticalDelegate) {
+				verticalDelegate = new LayoutableDelegate(component, LayoutableDelegate.VERTICAL);
+			}

 			this.component = component;
-
-			var horizontalDelegate:LayoutableDelegate = new LayoutableDelegate(component, LayoutableDelegate.HORIZONTAL);
-			var verticalDelegate:LayoutableDelegate = new LayoutableDelegate(component, LayoutableDelegate.VERTICAL);

 			if(isNaN(horizontalDelegate.fixed) && isNaN(horizontalDelegate.percent)) {
 				horizontalDelegate.actual = getChildrenWidth(horizontalDelegate);


Transferred from the Adobe Open Source Subversion Repository

Revision: 8
Author:   open-source-svn-admin@adobe.com
Date:     2007-12-15T01:49:31.087529Z

Log Message:
-----------
The beginning of the open-source Flex SDK.

Populated the flex/sdk/trunk directory with an open-source subset of files from //depot/flex/sdk/...@191097 in the Faramir Perforce server. This changelist is a bit past the 3.0rc0 build.

The Ant scripts will not successfully build yet. They need to be adapted to the open-source subset.

Modified Paths:
--------------
2532 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1253510 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/core/src/CoreClasses.as
+++ frameworks/projects/core/src/CoreClasses.as
@@ -0,0 +1,52 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2006-2007 Adobe Systems Incorporated
+//  All Rights Reserved.
+//
+//  NOTICE: Adobe permits you to use, modify, and distribute this file
+//  in accordance with the terms of the license agreement accompanying it.
+//
+////////////////////////////////////////////////////////////////////////////////
+
+package
+{
+
+/**
+ *  @private
+ *  In some projects, this class is used to link additional classes
+ *  into the SWC beyond those that are found by dependency analysis
+ *  starting from the classes specified in manifest.xml.
+ *  This project has no manifest file (because there are no MXML tags
+ *  corresponding to any classes in it) so all the classes linked into
+ *  the SWC are found by a dependency analysis starting from the classes
+ *  listed here.
+ */
+internal class FlexClasses
+{
+	import mx.core.BitmapAsset; BitmapAsset;
+	import mx.core.ByteArrayAsset; ByteArrayAsset;
+	import mx.core.ButtonAsset; ButtonAsset;
+	import mx.core.FontAsset; FontAsset;
+	import mx.core.FlexLoader; FlexLoader;
+	import mx.core.IFlexModule; IFlexModule;
+	import mx.core.MovieClipAsset; MovieClipAsset;
+	import mx.core.MovieClipLoaderAsset; MovieClipLoaderAsset;
+	import mx.core.SimpleApplication; SimpleApplication;
+	import mx.core.SoundAsset; SoundAsset;
+	import mx.core.SpriteAsset; SpriteAsset;
+	import mx.core.TextFieldAsset; TextFieldAsset;
+	import mx.events.ModuleEvent; ModuleEvent;
+	import mx.modules.IModuleInfo; IModuleInfo;
+	import mx.modules.ModuleBase; ModuleBase;
+	import mx.modules.ModuleManager; ModuleManager;
+	import mx.resources.IResourceBundle; IResourceBundle;
+	import mx.resources.IResourceManager; IResourceManager;
+	import mx.resources.IResourceModule; IResourceModule;
+	import mx.resources.Locale; Locale;
+	import mx.resources.ResourceBundle; ResourceBundle;
+	import mx.resources.ResourceManager; ResourceManager;
+	// Maintain alphabetical order
+}
+
+}


Fixed a bug preventing EntityCache.getHierarchyInfo from working correctly. #WEAVE-237 Fixed

--- WeaveJS/src/weavejs/net/EntityCache.as
+++ WeaveJS/src/weavejs/net/EntityCache.as
@@ -1,16 +1,16 @@
-/* ***** BEGIN LICENSE BLOCK *****
- *
- * This file is part of Weave.
- *
- * The Initial Developer of Weave is the Institute for Visualization
- * and Perception Research at the University of Massachusetts Lowell.
- * Portions created by the Initial Developer are Copyright (C) 2008-2015
- * the Initial Developer. All Rights Reserved.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/.
- *
+/* ***** BEGIN LICENSE BLOCK *****
+ *
+ * This file is part of Weave.
+ *
+ * The Initial Developer of Weave is the Institute for Visualization
+ * and Perception Research at the University of Massachusetts Lowell.
+ * Portions created by the Initial Developer are Copyright (C) 2008-2015
+ * the Initial Developer. All Rights Reserved.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
  * ***** END LICENSE BLOCK ***** */

 package weavejs.net
@@ -28,11 +28,11 @@
     import weavejs.api.net.beans.EntityMetadata;
     import weavejs.util.CallbackUtils;
     import weavejs.util.JS;
-    import weavejs.util.WeavePromise;
+    import weavejs.util.WeavePromise;

 	/**
 	 * Provides an interface to a set of cached Entity objects.
-	 */
+	 */
     public class EntityCache implements ILinkableObject, IDisposableObject
     {
 		/**
@@ -102,13 +102,13 @@
 		 */
 		public function invalidate(id:int, alsoInvalidateRelatives:Boolean = false):void
 		{
-			if (Weave.wasDisposed(this))
-				return;
-
+			if (Weave.wasDisposed(this))
+				return;
+
 			//trace('invalidate',id, alsoInvalidateRelatives, entityCache[id]);
 			callbacks.delayCallbacks();
-
-			WeaveAPI.SessionManager.assignBusyTask(delayedCallback, this);
+
+			WeaveAPI.SessionManager.assignBusyTask(delayedCallback, this);

 			// trigger callbacks if we haven't previously decided to fetch this id
 			if (!idsToFetch[id])
@@ -215,8 +215,8 @@
 			{
 				var splicedIds:Array = ids.splice(0, MAX_ENTITY_REQUEST_COUNT);
 				service.getEntities(splicedIds).then(getEntityHandler.bind(this, splicedIds));
-			}
-
+			}
+
 			WeaveAPI.SessionManager.unassignBusyTask(delayedCallback);
         }

@@ -298,7 +298,7 @@
 		 */
 		public function getHierarchyInfo(publicMetadata:Object):WeavePromise
 		{
-			return service.getHierarchyInfo(publicMetadata)
+			return service.getHierarchyInfo(publicMetadata)
 				.then(handleEntityHierarchyInfo.bind(this, publicMetadata));
 		}

@@ -320,6 +320,7 @@
 				_idsByType[entityType] = ids;

 			callbacks.triggerCallbacks();
+			return result;
 		}

 		/**
@@ -363,8 +364,8 @@
 		 * @param purge If set to true, clears cache instead of just invalidating it.
 		 */
 		public function invalidateAll(purge:Boolean = false):void
-        {
-			if (Weave.wasDisposed(this))
+        {
+			if (Weave.wasDisposed(this))
 				return;
 			if (purge)
 			{
@@ -434,7 +435,7 @@
 				adminService.updateEntity(child_id, diff);
 			}

-			adminService.addChild(parent_id, child_id, index)
+			adminService.addChild(parent_id, child_id, index)
 				.then(handleIdsToInvalidate.bind(this, false));
 			invalidate(parent_id);
         }
@@ -495,9 +496,9 @@
 			return null;
 		}

-		public function dispose():void
-		{
-			WeaveAPI.SessionManager.unassignBusyTask(delayedCallback);
+		public function dispose():void
+		{
+			WeaveAPI.SessionManager.unassignBusyTask(delayedCallback);
 		}
     }
 }


Fixing describeParameters in ExtendedQueryHandler.

--- driver/src/main/flex/org/postgresql/db/ExtendedQueryHandler.as
+++ driver/src/main/flex/org/postgresql/db/ExtendedQueryHandler.as
@@ -16,7 +16,7 @@

         public function describeArguments(params:Array, serverParams:Object):Array {
             var encodedArgs:Array = [];
-            for (var arg:Object in params) {
+            for each (var arg:Object in params) {
                 var argInfo:ArgumentInfo;
                 if (arg == null) {
                     argInfo = new ArgumentInfo(EncodingFormat.TEXT, Oid.UNSPECIFIED, null);


Transferred from the Adobe Open Source Subversion Repository

Revision: 5101
Author:   gauravj@adobe.com
Date:     2009-02-27T05:22:45.887116Z

Log Message:
-----------
Update action script files with asdoc version tags.

QE Notes: None.
Doc Notes: Please review and update as necessary.
tests: checkintests

Modified Paths:
--------------
663 paths were modified

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1259169 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/framework/src/mx/core/FlexModuleFactory.as
+++ frameworks/projects/framework/src/mx/core/FlexModuleFactory.as
@@ -239,6 +239,11 @@

    /**
     *  @inheritDoc
+    *
+    *  @langversion 3.0
+    *  @playerversion Flash 9
+    *  @playerversion AIR 1.1
+    *  @productversion Flex 3
     */
     public function getDefinitionByName(name:String):Object
     {


Transferred from the Adobe Open Source Subversion Repository

Revision: 19253
Author:   jasonsj@adobe.com
Date:     2010-12-10T00:48:41.286807Z

Log Message:
-----------
Explicitly set default stage.quality to HIGH. Fixes rendering issues in mobiletheme skins.

Moved textShadowColor and textShadowAlpha from BasicInheritingTextStyles to only ActionBar and Button

Added mobile DefaultButtonSkin for Button.emphasized, accentColor styling.

Remove text shadow from CheckBox and RadioButton

QE notes: Changing mobile stage quality from MEDIUM to HIGH results in anti aliasing changes in rounded graphics and FTE fonts.
Doc notes:
Bugs:
SDK-28224 [AIR] Android stage quality capped at MEDIUM
SDK-28665 textShadowAlpha and textShadowColor are code hinted in Builder for mobile text controls.
SDK-28522 accentColor not working
SDK-28583 	textShadowAlpha should have a common global value, should only apply to ActionBar and Button
Reviewer: gruehle, jszeto
Tests run: checkintests, cyclone
Is noteworthy for integration: Yes

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/managers/SystemManager.as</path>
<path kind="file" action="A">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/DefaultButtonSkin.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/supportClasses/ButtonSkinBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/styles/metadata/BasicInheritingTextStyles.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/defaults.css</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/Button.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/MobileThemeClasses.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/mobiletheme/src/spark/skins/mobile/ButtonSkin.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1261867 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/framework/src/mx/managers/SystemManager.as
+++ frameworks/projects/framework/src/mx/managers/SystemManager.as
@@ -21,6 +21,7 @@
 import flash.display.Sprite;
 import flash.display.Stage;
 import flash.display.StageAlign;
+import flash.display.StageQuality;
 import flash.display.StageScaleMode;
 import flash.events.Event;
 import flash.events.EventDispatcher;
@@ -236,6 +237,7 @@
         {
             stage.scaleMode = StageScaleMode.NO_SCALE;
             stage.align = StageAlign.TOP_LEFT;
+            stage.quality = StageQuality.HIGH;
         }

         // If we don't have a stage then we are not top-level,


Transferred from the Adobe Open Source Subversion Repository

Revision: 2607
Author:   jimurphy@adobe.com
Date:     2008-07-24T14:18:24.312344Z

Log Message:
-----------
Merge 3.0.x revisions [2587,2601] -> trunk

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/SystemManager.as</path>
<path kind="dir" action="M">/flex/sdk/trunk</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/PopUpManagerImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/events/SandboxBridgeRequest.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/SWFLoader.as</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1261789 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/framework/src/mx/managers/SystemManager.as
+++ frameworks/projects/framework/src/mx/managers/SystemManager.as
@@ -2735,6 +2735,24 @@
 				 !info.regular));
     }

+    /**
+     *  @private
+     *
+     *  Dispatch an invalidate request to invalidate the size and
+     *  display list of the parent application.
+     */
+    private function dispatchInvalidateRequest():void
+    {
+        var bridge:IEventDispatcher = sandboxBridgeGroup.parentBridge;
+        var request:SandboxBridgeRequest = new SandboxBridgeRequest(
+                                                    SandboxBridgeRequest.INVALIDATE,
+                                                    false, false,
+                                                    bridge,
+                                                    SandboxBridgeRequest.INVALIDATE_SIZE |
+                                                    SandboxBridgeRequest.INVALIDATE_DISPLAY_LIST);
+         bridge.dispatchEvent(request);
+    }
+
 	/**
 	 *  @private
 	 *  Makes the mouseCatcher the same size as the stage,
@@ -3169,8 +3187,11 @@
 				obj = obj.parent;
 			}
 		}
-	}
-
+
+		if (topLevel && useBridge())
+		   dispatchInvalidateRequest();
+	}
+
 	/**
 	 *  @private
 	 *  Keep track of the size and position of the stage.
@@ -3776,7 +3797,7 @@
         var request:ModalWindowRequest = ModalWindowRequest.marshal(event);
         dispatchEvent(request);
     }
-
+
 	//--------------------------------------------------------------------------
 	//
 	//  Sandbox Event handlers for messages from parent
@@ -3803,8 +3824,8 @@
 	private function getSizeRequestHandler(event:Event):void
 	{
 		var eObj:Object = Object(event);
-		eObj.width = width;
-		eObj.height = height;
+		eObj.width = measuredWidth;
+		eObj.height = measuredHeight;
 	}

 	/**
@@ -4325,7 +4346,6 @@
         bridge.addEventListener(ModalWindowRequest.CREATE, modalWindowRequestHandler);
         bridge.addEventListener(ModalWindowRequest.SHOW, modalWindowRequestHandler);
         bridge.addEventListener(ModalWindowRequest.HIDE, modalWindowRequestHandler);
-
 	}

 	/**


Transferred from the Adobe Open Source Subversion Repository

Revision: 3594
Author:   pfarland@adobe.com
Date:     2008-10-13T18:00:52.025975Z

Log Message:
-----------
Initial check-in for Advanced CSS selector support. Note that since direct AST generation for advanced styles (i.e. equivalent code of StyleModule.vm, StyleDef.vm, ClassDefLib.vm) is not yet implemented and as such advanced selector support is only enabled when the compiler -keep=true is enabled at this time. Direct AST generation to follow.

This change adds support for descendant type selectors (e.g. Panel VBox Button), non-global class selectors (e.g. Button.special), id selectors (e.g. Button#button14), and combinations of these types of selectors (e.e. Panel.special VBox.box12 Button.cancel). Pseudo selector awareness is included but it is not yet wired up to the runtime states mechanism as an efficient method of reacting to state changes is still being developed. Combinator conditional global selectors will be supported soon (i.e. the scenario of combining both an id and class selector at the top level, e.g. .foo#foo12, this requires a more expensive search of global class selectors).

This change juggles both the introduction of advanced selector support while retaining legacy styles APIs. The major difference with advanced styles is that multiple styles need to be considered for a type. This requires new data structures to keep track of selectors by subject. Performance analysis will be conducted to ensure these new data structures do not add unacceptable overhead to the style subsystem.

For the compiler this change consolidates styles processing in the base StyleModule class and then MXML-specific overrides (i.e. inline <Styles> nodes and SWC defaults.css) are in the StylesContainer.java class, which now extends StyleModule. The existing structure for legacy simple style codegen was retained and advanced style codegen wedged in.

QA: Yes
Doc: Not yet
Checkintests: Pass 100%
mxunit styles tests: Pass 100% (note that styles modules include tests you need to manually compile the .css files to swf and they're currently cleaned out each time a build runs... QE please correct this).
mustella styles tests: QE's select list of components testsuites pass 100%. Any failures in the full suite will be addressed in the next-checkin.
Reviewers: Glenn (framework), Paul (compiler)

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/css/CssCompiler.java</path>
<path kind="file" action="M">/flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/css/StylesContainer.java</path>
<path kind="file" action="M">/flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/rep/MxmlDocument.java</path>
<path kind="file" action="M">/flex/sdk/trunk/tools/dependencychecker/frameworkSwcExceptionsList.txt</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/IStyleManager3.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/config/ConfigMap.as</path>
<path kind="file" action="A">/flex/sdk/trunk/modules/compiler/src/java/flash/css/StyleSelector.java</path>
<path kind="file" action="A">/flex/sdk/trunk/modules/compiler/src/java/flash/css/StyleProperty.java</path>
<path kind="file" action="M">/flex/sdk/trunk/modules/compiler/src/java/flash/css/StyleDeclaration.java</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/CSSSelectorKind.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/CSSConditionKind.as</path>
<path kind="file" action="M">/flex/sdk/trunk/modules/compiler/src/java/flash/css/FontFaceRule.java</path>
<path kind="file" action="M">/flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/ImplementationGenerator.java</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/IStyleClient.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/StyleManagerImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/CSSStyleDeclaration.as</path>
<path kind="file" action="M">/flex/sdk/trunk/modules/compiler/src/java/flash/css/StyleSheet.java</path>
<path kind="file" action="M">/flex/sdk/trunk/modules/compiler/src/java/flash/css/StyleDocumentHandler.java</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/StyleProtoChain.as</path>
<path kind="file" action="M">/flex/sdk/trunk/modules/compiler/src/java/flex2/tools/PreLink.java</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/CSSSelector.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/SystemManager.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/StyleManager.as</path>
<path kind="file" action="D">/flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/css/StyleProperty.java</path>
<path kind="file" action="M">/flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/css/StyleModule.java</path>
<path kind="file" action="M">/flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/css/StyleModule.vm</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/IAdvancedStyleClient.as</path>
<path kind="file" action="A">/flex/sdk/trunk/frameworks/projects/framework/src/mx/styles/CSSCondition.as</path>
<path kind="file" action="M">/flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/gen/ClassDefLib.vm</path>
<path kind="file" action="M">/flex/sdk/trunk/modules/compiler/src/java/flash/css/Rule.java</path>
<path kind="file" action="A">/flex/sdk/trunk/modules/compiler/src/java/flash/css/StyleCondition.java</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/FrameworkClasses.as</path>
<path kind="file" action="M">/flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/css/StyleDef.java</path>
<path kind="file" action="M">/flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/css/StyleDef.vm</path>
<path kind="file" action="M">/flex/sdk/trunk/modules/compiler/src/java/flash/css/StyleParser.java</path>

git-svn-id: 7146a936b37d36e51ea0d66f8acbe0b8281bc7b7@1262645 13f79535-47bb-0310-9956-ffa450edef68

--- frameworks/projects/framework/src/mx/styles/StyleProtoChain.as
+++ frameworks/projects/framework/src/mx/styles/StyleProtoChain.as
@@ -17,9 +17,11 @@
 import flash.system.ApplicationDomain;
 import flash.utils.getQualifiedClassName;
 import flash.utils.getQualifiedSuperclassName;
+
 import mx.core.ApplicationGlobals;
 import mx.core.FlexVersion;
 import mx.core.IFlexDisplayObject;
+
 import mx.core.IFontContextComponent;
 import mx.core.IInvalidating;
 import mx.core.IFlexModuleFactory;
@@ -31,6 +33,7 @@
 import mx.modules.ModuleManager;
 import mx.styles.IStyleClient;
 import mx.styles.StyleProxy;
+import mx.utils.OrderedObject;

 use namespace mx_internal;

@@ -94,13 +97,16 @@

         var className:String = getQualifiedClassName(object)
         className = className.replace("::", ".");
-
-        var cache:Array = StyleManager.typeSelectorCache[className];
+
+        var advancedObject:IAdvancedStyleClient = object as IAdvancedStyleClient;
+
+        var cacheKey:String = advancedObject ? getAdvancedCacheKey(className, advancedObject) : className;
+        var cache:Array = StyleManager.typeSelectorCache[cacheKey];
         if (cache)
-            return cache;
-
+           return cache;
+
         var decls:Array = [];
-        var classNames:Array = [];
+        var cacheKeys:Array = [];
         var caches:Array = [];
         var declcache:Array = [];

@@ -109,31 +115,42 @@
                className != "mx.core.UITextField" &&
                className != "mx.graphics.graphicsClasses.GraphicElement")
         {
-            var s:CSSStyleDeclaration;
-            cache = StyleManager.typeSelectorCache[className];
+            cache = StyleManager.typeSelectorCache[cacheKey];
             if (cache)
             {
                 decls = decls.concat(cache);
                 break;
             }

-            s = StyleManager.getStyleDeclaration(className);
-
-            if (s)
-            {
-                decls.unshift(s);
+            var ds:Array = null;
+            if (advancedObject)
+            {
+                var d:Object = StyleManager.getStyleDeclarations(className);
+                if (d)
+                    ds = getMatchingStyleDeclarations(d, advancedObject, true);
+            }
+            else
+            {
+                var s:CSSStyleDeclaration = StyleManager.getStyleDeclaration(className);
+                if (s)
+                    ds = [s];
+            }
+
+            if (ds && ds.length > 0)
+            {
+                decls = ds.concat(decls);
                 // We found one so the next set define the selectors
                 // for this found class and its ancestors.
                 // Save the old list and start a new list.
-                classNames.push(className);
-                caches.push(classNames);
+                cacheKeys.push(cacheKey);
+                caches.push(cacheKeys);
                 declcache.push(decls);
                 decls = [];
-                classNames = [];
+                cacheKeys = [];
             }
             else
             {
-                classNames.push(className);
+                cacheKeys.push(cacheKey);
             }

             try
@@ -141,6 +158,8 @@
                 className = getQualifiedSuperclassName(
                     myApplicationDomain.getDefinition(className));
                 className = className.replace("::", ".");
+
+                cacheKey = advancedObject ? getAdvancedCacheKey(className, advancedObject) : className;
             }
             catch(e:ReferenceError)
             {
@@ -148,17 +167,17 @@
             }
         }

-        caches.push(classNames);
+        caches.push(cacheKeys);
         declcache.push(decls);
         decls = [];
-
+
         while (caches.length)
         {
-            classNames = caches.pop();
+            cacheKeys = caches.pop();
             decls = decls.concat(declcache.pop());
-            while (classNames.length)
-            {
-                StyleManager.typeSelectorCache[classNames.pop()] = decls;
+            while (cacheKeys.length)
+            {
+                StyleManager.typeSelectorCache[cacheKeys.pop()] = decls;
             }
         }

@@ -176,15 +195,17 @@
         var i:int;

         var uicObject:UIComponent = object as UIComponent;
-
-        var classSelectors:Array = [];
+        var advancedObject:IAdvancedStyleClient = object as IAdvancedStyleClient;
+        var styleDeclaration:CSSStyleDeclaration = null;
+
+        var globalClassSelectors:Array = [];
         var styleName:Object = object.styleName;
         if (styleName)
         {
             if (styleName is CSSStyleDeclaration)
             {
-                // Get the style sheet referenced by the styleName property.
-                classSelectors.push(CSSStyleDeclaration(styleName));
+                // Get the styles referenced by the styleName property.
+                globalClassSelectors.push(CSSStyleDeclaration(styleName));
             }
             else if (styleName is IFlexDisplayObject || styleName is IStyleClient)
             {
@@ -195,15 +216,16 @@
             }
             else if (styleName is String)
             {
-                // Get the style sheets referenced by the styleName property
+                // Get the styles referenced by the styleName property
                 var styleNames:Array = styleName.split(/\s+/);
                 n = styleNames.length;
                 for (i = 0; i < n; i++)
                 {
                     if (styleNames[i].length)
                     {
-                        classSelectors.push(
-                            StyleManager.getStyleDeclaration("." + styleNames[i]));
+                        styleDeclaration = StyleManager.getStyleDeclaration("." + styleNames[i]);
+                        if (styleDeclaration)
+                            globalClassSelectors.push(styleDeclaration);
                     }
                 }
             }
@@ -256,47 +278,109 @@
             }
         }

-        // Working backwards up the list, the next element in the
-        // search path is the type selector
-        var typeSelectors:Array = object.getClassStyleDeclarations();
-        n = typeSelectors.length;
-        for (i = 0; i < n; i++)
-        {
-            var typeSelector:CSSStyleDeclaration = typeSelectors[i];
-
-            inheritChain =
-                typeSelector.addStyleToProtoChain(inheritChain, uicObject);
-
-            nonInheritChain =
-                typeSelector.addStyleToProtoChain(nonInheritChain, uicObject);
-
-            if (typeSelector.effects)
-                object.registerEffects(typeSelector.effects);
-        }
-
-        // Next are the class selectors
-        n = classSelectors.length;
-        for (i = 0; i < n; i++)
-        {
-            var classSelector:CSSStyleDeclaration = classSelectors[i];
-            if (classSelector)
-            {
+        var styleDeclarations:Array = null;
+
+        // If we have an advanced style client, we handle this separately
+        // because of the considerably more complex selector matches...
+        if (advancedObject)
+        {
+            styleDeclarations = [];
+
+            // Check for global class selector that matches our styleName(s)
+            if (globalClassSelectors.length > 0)
+            {
+                styleDeclarations = styleDeclarations.concat(globalClassSelectors);
+            }
+
+            // Check for a global pseudo selector that matches our current state.
+            if (advancedObject.currentState)
+            {
+                styleDeclaration = StyleManager.getStyleDeclaration(":" + advancedObject.currentState);
+                if (styleDeclaration)
+                    styleDeclarations.push(styleDeclaration);
+            }
+
+            // Check for a global id selector that matches our current id
+            if (advancedObject.id)
+            {
+                styleDeclaration = StyleManager.getStyleDeclaration("#" + advancedObject.id);
+                if (styleDeclaration)
+                    styleDeclarations.push(styleDeclaration);
+            }
+
+            // If we had global selectors, concatenate them with our type
+            // selectors and resort by specificity...
+            if (styleDeclarations.length > 0)
+            {
+                styleDeclarations = styleDeclarations.concat(advancedObject.getClassStyleDeclarations());
+                styleDeclarations = styleDeclarations.sortOn("specificity", Array.NUMERIC);
+            }
+            else
+            {
+                // We only have type selectors
+                styleDeclarations = advancedObject.getClassStyleDeclarations();
+            }
+
+            n = styleDeclarations.length;
+            for (i = 0; i < n; i++)
+            {
+                styleDeclaration = styleDeclarations[i];
+
                 inheritChain =
-                    classSelector.addStyleToProtoChain(inheritChain, uicObject);
-
+                    styleDeclaration.addStyleToProtoChain(inheritChain, uicObject);
+
                 nonInheritChain =
-                    classSelector.addStyleToProtoChain(nonInheritChain, uicObject);
-
-                if (classSelector.effects)
-                    object.registerEffects(classSelector.effects);
+                    styleDeclaration.addStyleToProtoChain(nonInheritChain, uicObject);
+
+                if (styleDeclaration.effects)
+                    object.registerEffects(styleDeclaration.effects);
+            }
+        }
+        // Otherwise we use the legacy Flex 3 logic for simple selectors.
+        else
+        {
+            // Working backwards up the list, the next element in the
+            // search path is the type selector
+            styleDeclarations = object.getClassStyleDeclarations();
+            n = styleDeclarations.length;
+            for (i = 0; i < n; i++)
+            {
+                styleDeclaration = styleDeclarations[i];
+
+                inheritChain =
+                    styleDeclaration.addStyleToProtoChain(inheritChain, uicObject);
+
+                nonInheritChain =
+                    styleDeclaration.addStyleToProtoChain(nonInheritChain, uicObject);
+
+                if (styleDeclaration.effects)
+                    object.registerEffects(styleDeclaration.effects);
+            }
+
+            // Next are the class selectors
+            n = globalClassSelectors.length;
+            for (i = 0; i < n; i++)
+            {
+                styleDeclaration = globalClassSelectors[i];
+                if (styleDeclaration)
+                {
+                    inheritChain =
+                        styleDeclaration.addStyleToProtoChain(inheritChain, uicObject);
+
+                    nonInheritChain =
+                        styleDeclaration.addStyleToProtoChain(nonInheritChain, uicObject);
+
+                    if (styleDeclaration.effects)
+                        object.registerEffects(styleDeclaration.effects);
+                }
             }
         }

         // Finally, we'll add the in-line styles
         // to the head of the proto chain.

-        var styleDeclaration:CSSStyleDeclaration = object.styleDeclaration;
-
+        styleDeclaration = object.styleDeclaration;
+
         object.inheritingStyles =
             styleDeclaration ?
             styleDeclaration.addStyleToProtoChain(inheritChain, uicObject) :
@@ -701,6 +785,57 @@
                 parent.invalidateDisplayList();
         }
     }
+
+    /**
+     *  @private
+     *  Find all matching style declarations for an IStyleClient2 component.
+     *
+     *  @param declarations - an Array of declarations that is searched for
+     *  matches.
+     *  @param object - an instance of the component to match.
+     *
+     *  @return An Array of style declarations for the given subject.
+     */
+    private static function getMatchingStyleDeclarations(declarations:Object,
+            object:IAdvancedStyleClient, ignoreType:Boolean=false):Array // of CSSStyleDeclaration
+    {
+        var matchingDecls:Array = [];
+
+        // Find the subset of declarations that match this component
+        for (var selector:String in declarations)
+        {
+            var decl:CSSStyleDeclaration = declarations[selector];
+            if (decl.isMatch(object, ignoreType))
+                matchingDecls.push(decl);
+        }
+
+        // Then sort by specificity...
+        // TODO: Check that for equal entries the last one added remains
+        // last (as "the last should win")...
+        if (matchingDecls.length > 0)
+            matchingDecls.sortOn("specificity", Array.NUMERIC);
+
+        return matchingDecls;
+    }
+
+    private static function getAdvancedCacheKey(className:String, object:IAdvancedStyleClient):String
+    {
+        var cacheKey:String = className;
+
+        if (object.id)
+            cacheKey += object.id;
+
+        if (object.styleName)
+            cacheKey += object.styleName;
+
+        if (object.currentState)
+            cacheKey += object.currentState;
+
+        if (object.styleParent)
+            cacheKey += getAdvancedCacheKey(object.styleParent.className, object.styleParent);
+
+        return cacheKey;
+    }
 }

 }