Transferred from the Adobe Open Source Subversion Repository

Revision: 16236
Author:   jszeto@adobe.com
Date:     2010-05-20T00:54:54.963159Z

Log Message:
-----------
Form Feature Work

Merging in Form classes from the private sandbox. All spec'ed functionality has been implemented.

QE notes: none
Doc notes: Needs ASDoc comments
Bugs: none
Reviewer: Hans, Kevin
Tests run: checkintests
Is noteworthy for integration: no

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/SparkClasses.as</path>
<path kind="file" copyfrom-path="/private/flex/sdk/branches/flex4_5/frameworks/projects/spark/src/spark/layouts/FormItemLayout.as" copyfrom-rev="15875" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/layouts/FormItemLayout.as</path>
<path kind="file" copyfrom-path="/private/flex/sdk/branches/flex4_5/frameworks/projects/spark/src/spark/skins/spark/assets/ErrorIndicator.png" copyfrom-rev="16235" action="R">/flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/assets/ErrorIndicator.png</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/layouts/supportClasses/LayoutElementHelper.as</path>
<path kind="file" copyfrom-path="/private/flex/sdk/branches/flex4_5/frameworks/projects/spark/src/spark/layouts/ConstraintLayout.as" copyfrom-rev="15875" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/layouts/ConstraintLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/managers/ToolTipManagerImpl.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/defaults.css</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBase.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableTextBase.as</path>
<path kind="file" copyfrom-path="/private/flex/sdk/branches/flex4_5/frameworks/projects/spark/src/spark/skins/spark/StackedFormItemSkin.mxml" copyfrom-rev="15875" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/StackedFormItemSkin.mxml</path>
<path kind="file" copyfrom-path="/private/flex/sdk/branches/flex4_5/frameworks/projects/spark/src/spark/components/Form.as" copyfrom-rev="15875" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Form.as</path>
<path kind="file" copyfrom-path="/private/flex/sdk/branches/flex4_5/frameworks/projects/spark/src/spark/skins/spark/FormItemSkin.mxml" copyfrom-rev="15875" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/FormItemSkin.mxml</path>
<path kind="file" copyfrom-path="/private/flex/sdk/branches/flex4_5/frameworks/projects/spark/src/spark/skins/spark/StackedFormHeadingSkin.mxml" copyfrom-rev="16047" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/StackedFormHeadingSkin.mxml</path>
<path kind="file" copyfrom-path="/private/flex/sdk/branches/flex4_5/frameworks/projects/spark/src/spark/skins/spark/FormHeadingSkin.mxml" copyfrom-rev="15875" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/FormHeadingSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/TextBase.as</path>
<path kind="dir" action="M">/flex/sdk/trunk</path>
<path kind="file" copyfrom-path="/private/flex/sdk/branches/flex4_5/frameworks/projects/spark/src/spark/layouts/FormLayout.as" copyfrom-rev="15875" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/layouts/FormLayout.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/spark-manifest.xml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/defaults.css</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/bundles/en_US/layout.properties</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/GroupBase.as</path>
<path kind="file" copyfrom-path="/private/flex/sdk/branches/flex4_5/frameworks/projects/spark/src/spark/skins/spark/assets/RequiredIndicator.png" copyfrom-rev="16235" action="R">/flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/assets/RequiredIndicator.png</path>
<path kind="dir" copyfrom-path="/private/flex/sdk/branches/flex4_5/frameworks/projects/spark/src/spark/skins/spark/assets" copyfrom-rev="16235" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/assets</path>
<path kind="file" copyfrom-path="/private/flex/sdk/branches/flex4_5/frameworks/projects/spark/src/spark/components/FormItem.as" copyfrom-rev="15875" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/FormItem.as</path>
<path kind="file" copyfrom-path="/private/flex/sdk/branches/flex4_5/frameworks/projects/spark/src/spark/components/FormHeading.as" copyfrom-rev="15875" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/FormHeading.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableComponent.as</path>
<path kind="file" copyfrom-path="/private/flex/sdk/branches/flex4_5/frameworks/projects/spark/src/spark/skins/spark/FormSkin.mxml" copyfrom-rev="15875" action="A">/flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/FormSkin.mxml</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/core/UIComponent.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/FocusSkin.as</path>

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

--- frameworks/projects/spark/src/spark/layouts/ConstraintLayout.as
+++ frameworks/projects/spark/src/spark/layouts/ConstraintLayout.as
@@ -1,6 +1,5 @@
 package spark.layouts
 {
-import flash.geom.Point;
 import flash.utils.Dictionary;

 import mx.containers.errors.ConstraintError;
@@ -8,7 +7,6 @@
 import mx.containers.utilityClasses.ConstraintRow;
 import mx.core.ILayoutElement;
 import mx.core.mx_internal;
-import mx.resources.IResourceManager;
 import mx.resources.ResourceManager;

 import spark.components.supportClasses.GroupBase;
@@ -17,6 +15,89 @@

 use namespace mx_internal;

+[ResourceBundle("layout")]
+
+/**
+ *  The ConstraintLayout class arranges the layout elements based on their individual
+ *  settings and a set of constraint regions defined by constraint columns and
+ *  constraint rows. Although you can use all of the properties and constraints from
+ *  BasicLayout to position and size elements, ConstraintLayout gives you the ability
+ *  to create sibling-relative layouts by constraining elements to the specified
+ *  columns and rows.
+ *
+ *
Note: The Spark list-based controls (the Spark List control and its subclasses
+ *  such as ButtonBar, ComboBox, DropDownList, and TabBar) do not support the ConstraintLayout class.
+ *  Do not use ConstraintLayout with the Spark list-based controls.

+ *
+ *
Per-element supported constraints are left, right,
+ *  top, bottom, baseline,
+ *  percentWidth, and percentHeight.
+ *  Element's minimum and maximum sizes will always be respected.

+ *
+ *
Columns and rows may have an explicit size or content size (no explicit size).
+ *  Explicit size regions will be fixed at their specified size, while content size
+ *  regions will stretch to fit only the elements constrained to them. If multiple
+ *  content size regions are spanned by an element, the space will be divided
+ *  equally among the content size regions.

+ *
+ *
The measured size of the container is calculated from the elements, their
+ *  constraints, their preferred sizes, and the sizes of the rows and columns.
+ *  The size of each row and column is just big enough to hold all of the elements
+ *  constrained to it at their preferred sizes with constraints satisfied. The measured
+ *  size of the container is big enough to hold all of the columns and rows as well as
+ *  any other elements left at their preferred sizes with constraints satisfied.

+ *
+ *
During a call to the updateDisplayList() method,
+ *  the element's size is determined according to
+ *  the rules in the following order of precedence (the element's minimum and
+ *  maximum sizes are always respected):

+ *

+ *
If the element has percentWidth or percentHeight set,
+ *    then its size is calculated as a percentage of the available size, where the available
+ *    size is the region or container size minus any left, right,
+ *    top, or bottom constraints.

+ *
+ *
If the element has both left and right constraints, it's width is
+ *    set to be the region's or container's width minus the left
+ *    and right constraints.

+ *
+ *
If the element has both top and bottom constraints,
+ *    it's height is set to be the container's height minus the top
+ *    and bottom constraints.

+ *
+ *
The element is set to its preferred width and/or height.

+ *

+ *
+ *
The element's position is determined according to the rules in the following
+ *  order of precedence:

+ *

+ *
If element's baseline is specified, then the element is positioned in
+ *    the vertical direction such that its baselinePosition (usually the base line
+ *    of its first line of text) is aligned with baseline constraint.

+ *
+ *
If element's top or left constraints
+ *    are specified, then the element is
+ *    positioned such that the top-left corner of the element's layout bounds is
+ *    offset from the top-left corner of the container by the specified values.

+ *
+ *
If element's bottom or right constraints are specified,
+ *    then the element is positioned such that the bottom-right corner
+ *    of the element's layout bounds is
+ *    offset from the bottom-right corner of the container by the specified values.

+ *
+ *
When no constraints determine the position in the horizontal or vertical
+ *    direction, the element is positioned according to its x and y coordinates.

+ *

+ *
+ *
The content size of the container is calculated as the maximum of the
+ *  coordinates of the bottom-right corner of all the layout elements and
+ *  constraint regions.

+ *
+ *  @langversion 3.0
+ *  @playerversion Flash 10
+ *  @playerversion AIR 1.5
+ *  @productversion Flex 4.5
+ */
 public class ConstraintLayout extends LayoutBase
 {
     //--------------------------------------------------------------------------
@@ -46,15 +127,11 @@
     }

     /**
+     *  @private
      *  @return Returns the maximum value for an element's dimension so that the component doesn't
      *  spill out of the container size. Calculations are based on the layout rules.
-     *  Pass in unscaledWidth, hCenter, left, right, childX to get a maxWidth value.
-     *  Pass in unscaledHeight, vCenter, top, bottom, childY to get a maxHeight value.
-     *
-     *  @langversion 3.0
-     *  @playerversion Flash 10
-     *  @playerversion AIR 1.5
-     *  @productversion Flex 4
+     *  Pass in unscaledWidth, left, right, childX to get a maxWidth value.
+     *  Pass in unscaledHeight, top, bottom, childY to get a maxHeight value.
      */
     static private function maxSizeToFitIn(totalSize:Number,
                                            lowConstraint:Number,
@@ -90,7 +167,7 @@
      *  @langversion 3.0
      *  @playerversion Flash 10
      *  @playerversion AIR 1.5
-     *  @productversion Flex 4
+     *  @productversion Flex 4.5
      */
     public function ConstraintLayout()
     {
@@ -103,13 +180,12 @@
     //
     //--------------------------------------------------------------------------

-    // for throwing errors
-    private var resourceManager:IResourceManager =
-        ResourceManager.getInstance();
-
-    // Arrays that keep track of children spanning
-    // content size columns or rows or whether the
-    // elements don't use columns or rows at all.
+    /**
+     *  @private
+     *  Vectors that keep track of children spanning
+     *  content size columns or rows or whether the
+     *  elements don't use columns or rows at all.
+     */
     private var colSpanElements:Vector.<ElementConstraintInfo> = null;
     private var rowSpanElements:Vector.<ElementConstraintInfo> = null;
     private var otherElements:Vector.<ElementConstraintInfo> = null;
@@ -127,16 +203,23 @@
     //----------------------------------

     private var _constraintColumns:Vector.<ConstraintColumn> = new Vector.<ConstraintColumn>(0, true);
+    // An associative array of column id --> column index
+    private var columnsObject:Object = new Object();

     /**
      *  A Vector of ConstraintColumn instances that partition the target container.
      *  The ConstraintColumn instance at index 0 is the left-most column;
      *  indices increase from left to right.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4.5
      */
     public function get constraintColumns():Vector.<ConstraintColumn>
     {
         // make defensive copy
-        return Vector.<ConstraintColumn>(_constraintColumns);
+        return _constraintColumns.slice();
     }

     /**
@@ -148,18 +231,28 @@
         if (value == null)
         {
             _constraintColumns = new Vector.<ConstraintColumn>(0, true);
+            columnsObject = new Object();
             return;
         }

         var n:int = value.length;
-        var temp:Vector.<ConstraintColumn> = new Vector.<ConstraintColumn>(n, true);
+        var col:ConstraintColumn;
+        var temp:Vector.<ConstraintColumn> = value.slice();
+        var obj:Object = new Object();
+
         for (var i:int = 0; i < n; i++)
         {
-            value[i].container = this.target;
-            temp[i] = value[i];
+            col = temp[i];
+            col.container = this.target;
+            obj[col.id] = i;
+
+            // TODO (klin): Allow percentWidth columns.
+            if (!isNaN(col.percentWidth))
+                throw new Error(ResourceManager.getInstance().getString("layout", "percentWidthColumn"));
         }

         _constraintColumns = temp;
+        columnsObject = obj;

         if (target)
         {
@@ -173,15 +266,22 @@
     //----------------------------------

     private var _constraintRows:Vector.<ConstraintRow> = new Vector.<ConstraintRow>(0, true);
+    // An associative array of row id --> row index
+    private var rowsObject:Object = new Object();

     /**
      *  A Vector of ConstraintRow instances that partition the target container.
      *  The ConstraintRow instance at index 0 is the top-most column;
      *  indices increase from top to bottom.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4.5
      */
     public function get constraintRows():Vector.<ConstraintRow>
     {
-        return Vector.<ConstraintRow>(_constraintRows);
+        return _constraintRows.slice();
     }

     /**
@@ -193,18 +293,27 @@
         if (value == null)
         {
             _constraintRows = new Vector.<ConstraintRow>(0, true);
+            rowsObject = new Object();
             return;
         }

         var n:int = value.length;
-        var temp:Vector.<ConstraintRow> = new Vector.<ConstraintRow>(n, true);
+        var row:ConstraintRow;
+        var temp:Vector.<ConstraintRow> = value.slice();
+        var obj:Object = new Object();
+
         for (var i:int = 0; i < n; i++)
         {
-            value[i].container = this.target;
-            temp[i] = value[i];
+            row = temp[i];
+            row.container = this.target;
+            obj[row.id] = i;
+
+            if (!isNaN(row.percentHeight))
+                throw new Error(ResourceManager.getInstance().getString("layout", "percentHeightRow"));
         }

         _constraintRows = temp;
+        rowsObject = obj;

         if (target)
         {
@@ -228,25 +337,21 @@

         for (i = 0; i < n; i++)
         {
-            _constraintColumns[i].container = this.target;
+            _constraintColumns[i].container = value;
         }

         n = _constraintRows.length;
         for (i = 0; i < n; i++)
         {
-            _constraintRows[i].container = this.target
-        }
-    }
-
-    /**
-     *  @private
-     *  Used by FormItemLayout to implement its updateDisplayList.
-     */
-    mx_internal function checkUseVirtualLayout():void
-    {
-        if (useVirtualLayout)
-            throw new Error(ResourceManager.getInstance().getString("layout", "constraintLayoutNotVirtualized"));
-    }
+            _constraintRows[i].container = value;
+        }
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Overridden Methods: LayoutBase
+    //
+    //--------------------------------------------------------------------------

     /**
      *  @private
@@ -266,25 +371,32 @@
         var layoutTarget:GroupBase = target;
         if (!layoutTarget)
             return;
+
+        var width:Number = 0;
+        var height:Number = 0;
+        var minWidth:Number = 0;
+        var minHeight:Number = 0;

         parseConstraints();

-        var width:Number = measureAndPositionColumns();
-        var height:Number = measureAndPositionRows();
+        // TODO (klin): minimum will be different when percent size comes into play
+        width = minWidth = measureAndPositionColumns();
+        height = minHeight = measureAndPositionRows();

         if (otherElements)
         {
-            var p:Point = measureOtherContent();
-
-            width = Math.max(width, p.x);
-            height = Math.max(height, p.y);
+            var vec:Vector.<Number> = measureOtherContent();
+
+            width = Math.max(width, vec[0]);
+            height = Math.max(height, vec[1]);
+            minWidth = Math.max(minWidth, vec[2]);
+            minHeight = Math.max(minHeight, vec[3]);
         }

         layoutTarget.measuredWidth = Math.ceil(width);
         layoutTarget.measuredHeight = Math.ceil(height);
-
-        // FIXME (klin): measuredMinWidth/Height? I think we only have to do this for other content,
-        // since the columns and rows are fixed at this point.
+        layoutTarget.measuredMinWidth = Math.ceil(minWidth);
+        layoutTarget.measuredMinHeight = Math.ceil(minHeight);

         // clear out cache
         colSpanElements = null;
@@ -316,10 +428,21 @@
         layoutContent(unscaledWidth, unscaledHeight);
     }

+    //--------------------------------------------------------------------------
+    //
+    //  Methods: Used by FormItemLayout
+    //
+    //--------------------------------------------------------------------------
+
     /**
      *  Lays out the elements of the layoutTarget using the current
      *  widths and heights of the columns and rows. Used by FormItemLayout
-     *  to set new column widths and then lay elements using those new widths.
+     *  after setting new column widths to lay elements using those new widths.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4.5
      */
     protected function layoutContent(unscaledWidth:Number, unscaledHeight:Number):void
     {
@@ -363,6 +486,11 @@
     /**
      *  Used by FormItemLayout to measure and set new column widths
      *  before laying out the elements.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10
+     *  @playerversion AIR 1.5
+     *  @productversion Flex 4.5
      */
     protected function measureAndPositionColumnsAndRows():void
     {
@@ -370,275 +498,209 @@
         measureAndPositionColumns();
         measureAndPositionRows();
     }
-
-    /**
-     *  @private
-     *  Iterates over elements and calls parseElementConstraints on each.
-     */
-    private function parseConstraints():void
-    {
-        var layoutTarget:GroupBase = target;
-        if (!layoutTarget)
-            return;
-
-        var count:Number = layoutTarget.numElements;
-        var layoutElement:ILayoutElement;
-
-        constraintCache = new Dictionary(true);
-
-        for (var i:int = 0; i < count; i++)
-        {
-            layoutElement = layoutTarget.getElementAt(i);
-            if (!layoutElement || !layoutElement.includeInLayout)
-                continue;
-
-            parseElementConstraints(layoutElement);
-        }
-    }
-
-    /**
-     *  @private
-     *  This function parses the constraints of a single element, creates an
-     *  ElementConstraintInfo object for the element, and throws errors if the
-     *  columns or rows are not found for each constraint.
-     */
-    private function parseElementConstraints(layoutElement:ILayoutElement):void
-    {
-        // Variables to track the offsets
-        var left:Number;
-        var right:Number;
-        var top:Number;
-        var bottom:Number;
-        var baseline:Number;
-
-        // Variables to track the boundaries from which
-        // the offsets are calculated from. If null, the
-        // boundary is the parent container edge.
-        var leftBoundary:String;
-        var rightBoundary:String;
-        var topBoundary:String;
-        var bottomBoundary:String;
-        var baselineBoundary:String;
-
-        var message:String;
-
-        var temp:Array;
-        temp = LayoutElementHelper.parseConstraintExp(layoutElement.left);
-        if (!temp)
-            left = NaN;
-        else if (temp.length == 1)
-            left = Number(temp[0]);
+
+    /**
+     *  @private
+     *  This function is mx_internal so that FormItemLayout can use it
+     *  in its updateDisplayList.
+     */
+    mx_internal function checkUseVirtualLayout():void
+    {
+        if (useVirtualLayout)
+            throw new Error(ResourceManager.getInstance().getString("layout", "constraintLayoutNotVirtualized"));
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Sizes and positions the element based on the given size of the container
+     *  and the element's constraints.
+     *
+     *  1) Retrieves element constraints from the constraint cache.
+     *  2) Determines the x and y boundaries of each side.
+     *  3) Sizes the element based on constraints and its preferred
+     *     size. The precedence for sizing is as follows: percent,
+     *     top and bottom constraints, preferred size.
+     *  4) Positions the element based on its constraints. The precedence
+     *     for positioning is as follows: baseline, left and top, right and bottom,
+     *     x and y.
+     */
+    private function applyConstraintsToElement(unscaledWidth:Number,
+                                               unscaledHeight:Number,
+                                               layoutElement:ILayoutElement):void
+    {
+        var elementInfo:ElementConstraintInfo = constraintCache[layoutElement];
+
+        var left:Number = elementInfo.left;
+        var right:Number = elementInfo.right;
+        var top:Number = elementInfo.top;
+        var bottom:Number = elementInfo.bottom;
+        var baseline:Number = elementInfo.baseline;
+
+        var leftBoundary:String = elementInfo.leftBoundary;
+        var rightBoundary:String = elementInfo.rightBoundary;
+        var topBoundary:String = elementInfo.topBoundary;
+        var bottomBoundary:String = elementInfo.bottomBoundary;
+        var baselineBoundary:String = elementInfo.baselineBoundary;
+
+        var percentWidth:Number = layoutElement.percentWidth;
+        var percentHeight:Number = layoutElement.percentHeight;
+
+        var availableWidth:Number;
+        var availableHeight:Number;
+
+        var elementWidth:Number = NaN;
+        var elementHeight:Number = NaN;
+        var elementMaxWidth:Number = NaN;
+        var elementMaxHeight:Number = NaN;
+        var elementX:Number = 0;
+        var elementY:Number = 0;
+
+        var leftHolder:Number = 0;
+        var rightHolder:Number = unscaledWidth;
+        var topHolder:Number = 0;
+        var bottomHolder:Number = unscaledHeight;
+        var baselineHolder:Number = 0;
+
+        var i:Number;
+
+        var col:ConstraintColumn;
+        var row:ConstraintRow;
+
+        if (leftBoundary)
+        {
+            col = _constraintColumns[elementInfo.colSpanLeftIndex];
+            leftHolder = col.x;
+        }
+
+        if (rightBoundary)
+        {
+            col = _constraintColumns[elementInfo.colSpanRightIndex];
+            rightHolder = col.x + col.width;
+        }
+
+        if (topBoundary)
+        {
+            row = _constraintRows[elementInfo.rowSpanTopIndex];
+            topHolder = row.y;
+        }
+
+        if (bottomBoundary)
+        {
+            row = _constraintRows[elementInfo.rowSpanBottomIndex];
+            bottomHolder = row.y + row.height;
+        }
+
+        if (baselineBoundary)
+        {
+            row = _constraintRows[elementInfo.baselineIndex];
+            baselineHolder = row.y;
+
+            // If bottom doesn't exist, then the bottom should be restricted to the
+            // baseline row.
+            if (isNaN(bottom))
+                bottomHolder = row.y + row.height;
+        }
+
+        // available width
+        availableWidth = Math.round(rightHolder - leftHolder);
+
+        // cases are baseline with top and bottom,
+        // baseline with top, baseline with bottom, no baseline
+        if (!isNaN(baseline) && (isNaN(top) || isNaN(bottom)))
+            availableHeight = Math.round(bottomHolder - baselineHolder);
         else
-        {
-            leftBoundary = temp[0];
-            left = temp[1];
-        }
-
-        temp = LayoutElementHelper.parseConstraintExp(layoutElement.right);
-        if (!temp)
-            right = NaN;
-        else if (temp.length == 1)
-            right = Number(temp[0]);
+            availableHeight = Math.round(bottomHolder - topHolder);
+
+        // set width
+        if (!isNaN(percentWidth))
+        {
+            if (!isNaN(left))
+                availableWidth -= left;
+            if (!isNaN(right))
+                availableWidth -= right;
+
+            elementWidth = Math.round(availableWidth * Math.min(percentWidth * 0.01, 1));
+            elementMaxWidth = Math.min(layoutElement.getMaxBoundsWidth(),
+                maxSizeToFitIn(unscaledWidth, left, right, layoutElement.getLayoutBoundsX()));
+        }
+        else if (!isNaN(left) && !isNaN(right))
+        {
+            elementWidth = availableWidth - left - right;
+        }
+
+        // set height
+        if (!isNaN(percentHeight))
+        {
+            if (!isNaN(top))
+                availableHeight -= top;
+            if (!isNaN(bottom))
+                availableHeight -= bottom;
+
+            elementHeight = Math.round(availableHeight * Math.min(percentHeight * 0.01, 1));
+            elementMaxHeight = Math.min(layoutElement.getMaxBoundsHeight(),
+                maxSizeToFitIn(unscaledHeight, top, bottom, layoutElement.getLayoutBoundsY()));
+        }
+        else if (!isNaN(top) && !isNaN(bottom))
+        {
+            elementHeight = availableHeight - top - bottom;
+        }
+
+        // Apply min and max constraints, make sure min is applied last. In the cases
+        // where elementWidth and elementHeight are NaN, setLayoutBoundsSize will use preferredSize
+        // which is already constrained between min and max.
+        if (!isNaN(elementWidth))
+        {
+            if (isNaN(elementMaxWidth))
+                elementMaxWidth = layoutElement.getMaxBoundsWidth();
+            elementWidth = Math.max(layoutElement.getMinBoundsWidth(), Math.min(elementMaxWidth, elementWidth));
+        }
+
+        if (!isNaN(elementHeight))
+        {
+            if (isNaN(elementMaxHeight))
+                elementMaxHeight = layoutElement.getMaxBoundsHeight();
+            elementHeight = Math.max(layoutElement.getMinBoundsHeight(), Math.min(elementMaxHeight, elementHeight));
+        }
+
+        layoutElement.setLayoutBoundsSize(elementWidth, elementHeight);
+        // update temp variables
+        elementWidth = layoutElement.getLayoutBoundsWidth();
+        elementHeight = layoutElement.getLayoutBoundsHeight();
+
+        // Horizontal Position
+        if (!isNaN(left))
+            elementX = leftHolder + left;
+        else if (!isNaN(right))
+            elementX = rightHolder - right - elementWidth;
         else
-        {
-            rightBoundary = temp[0];
-            right = temp[1];
-        }
-
-        temp = LayoutElementHelper.parseConstraintExp(layoutElement.top);
-        if (!temp)
-            top = NaN;
-        else if (temp.length == 1)
-            top = Number(temp[0]);
+            elementX = layoutElement.getLayoutBoundsX();
+
+        // Vertical Position
+        if (!isNaN(baseline))
+            elementY = baselineHolder + Math.round(baseline - layoutElement.baselinePosition);
+        else if (!isNaN(top))
+            elementY = topHolder + top;
+        else if (!isNaN(bottom))
+            elementY = bottomHolder - bottom - elementHeight;
         else
-        {
-            topBoundary = temp[0];
-            top = temp[1];
-        }
-
-        temp = LayoutElementHelper.parseConstraintExp(layoutElement.bottom);
-        if (!temp)
-            bottom = NaN;
-        else if (temp.length == 1)
-            bottom = Number(temp[0]);
-        else
-        {
-            bottomBoundary = temp[0];
-            bottom = temp[1];
-        }
-
-        temp = LayoutElementHelper.parseConstraintExp(layoutElement.baseline);
-        if (!temp)
-            baseline = NaN;
-        else if (temp.length == 1)
-            baseline = Number(temp[0]);
-        else
-        {
-            baselineBoundary = temp[0];
-            baseline = temp[1];
-        }
-
-        // save values into a Dictionary based on element name.
-        var elementInfo:ElementConstraintInfo = new ElementConstraintInfo(layoutElement,
-            left, right, top, bottom, baseline,
-            leftBoundary, rightBoundary,
-            topBoundary, bottomBoundary, baselineBoundary);
-        constraintCache[layoutElement] = elementInfo;
-
-        // If some pair of boundaries don't exist, we will need to measure
-        // the container size based on the element's other properties like
-        // x, y, width, height.
-        var i:Number;
-        if (!(leftBoundary || rightBoundary) ||
-            !(topBoundary || bottomBoundary) ||
-            !baselineBoundary)
-        {
-            if (!otherElements)
-                otherElements = new Vector.<ElementConstraintInfo>();
-
-            otherElements.push(elementInfo);
-        }
-
-        // match columns
-        if (leftBoundary || rightBoundary)
-        {
-            var numColumns:Number = _constraintColumns.length;
-            var colid:String;
-
-            if (!colSpanElements)
-                colSpanElements = new Vector.<ElementConstraintInfo>();
-
-            colSpanElements.push(elementInfo);
-
-            if (leftBoundary)
-            {
-                for (i = 0; i < numColumns; i++)
-                {
-                    colid = _constraintColumns[i].id;
-
-                    if (leftBoundary == colid)
-                    {
-                        elementInfo.colSpanLeftIndex = i;
-                        break;
-                    }
-                }
-
-                // throw error if no match.
-                if (elementInfo.colSpanLeftIndex < 0)
-                {
-                    message = resourceManager.getString(
-                        "containers", "columnNotFound", [ leftBoundary ]);
-                    throw new ConstraintError(message);
-                }
-            }
-
-            // can we assume rightIndex >= leftIndex?
-            if (rightBoundary)
-            {
-                for (i = 0; i < numColumns; i++)
-                {
-                    colid = _constraintColumns[i].id;
-
-                    if (rightBoundary == colid)
-                    {
-                        elementInfo.colSpanRightIndex = i;
-                        break;
-                    }
-                }
-
-                // throw error if no match.
-                if (elementInfo.colSpanRightIndex < 0)
-                {
-                    message = resourceManager.getString(
-                        "containers", "columnNotFound", [ rightBoundary ]);
-                    throw new ConstraintError(message);
-                }
-            }
-        }
-
-        // match rows.
-        var numRows:Number = _constraintRows.length;
-        if (topBoundary || bottomBoundary || baselineBoundary)
-        {
-            var rowid:String;
-
-            if (!rowSpanElements)
-                rowSpanElements = new Vector.<ElementConstraintInfo>();
-
-            rowSpanElements.push(elementInfo);
-
-            if (topBoundary)
-            {
-                for (i = 0; i < numRows; i++)
-                {
-                    rowid = _constraintRows[i].id;
-
-                    if (topBoundary == rowid)
-                    {
-                        elementInfo.rowSpanTopIndex = i;
-                        break;
-                    }
-                }
-
-                // throw error if no match.
-                if (elementInfo.rowSpanTopIndex < 0)
-                {
-                    message = resourceManager.getString(
-                        "containers", "columnNotFound", [ topBoundary ]);
-                    throw new ConstraintError(message);
-                }
-            }
-
-            if (bottomBoundary)
-            {
-                for (i = 0; i < numRows; i++)
-                {
-                    rowid = _constraintRows[i].id;
-
-                    if (bottomBoundary == rowid)
-                    {
-                        elementInfo.rowSpanBottomIndex = i;
-                        break;
-                    }
-                }
-
-                // throw error if no match.
-                if (elementInfo.rowSpanBottomIndex < 0)
-                {
-                    message = resourceManager.getString(
-                        "containers", "columnNotFound", [ bottomBoundary ]);
-                    throw new ConstraintError(message);
-                }
-            }
-
-            if (baselineBoundary)
-            {
-                for (i = 0; i < numRows; i++)
-                {
-                    rowid = _constraintRows[i].id;
-
-                    if (baselineBoundary == rowid)
-                    {
-                        elementInfo.baselineIndex = i;
-                        break;
-                    }
-                }
-
-                // throw error if no match.
-                if (elementInfo.baselineIndex < 0)
-                {
-                    message = resourceManager.getString(
-                        "containers", "columnNotFound", [ baselineBoundary ]);
-                    throw new ConstraintError(message);
-                }
-            }
-        }
+            elementY = layoutElement.getLayoutBoundsY();
+
+        layoutElement.setLayoutBoundsPosition(elementX, elementY);
     }

     /**
      *  @private
      *  This function measures the ConstraintColumns partitioning
-     *  the target and sets their x positions.
+     *  the target and sets their x positions. The calculations
+     *  are based on the current constraintCache. To update the
+     *  constraintCache, one needs to call the parseConstraints()
+     *  method.
      *
      *  The algorithm works like this:
      *  1. Fixed columns honor their pixel values.
@@ -666,6 +728,12 @@
      */
     private function measureAndPositionColumns():Number
     {
+        // TODO (klin): Parameterize this to work for both columns and rows.
+        // This may mean we need to add some mx_internal properties to
+        // the columns for "major size", etc... Question is, what about
+        // 1-D properties like baseline? What parts can we parameterize and
+        // what parts aren't possible.
+
         if (_constraintColumns.length <= 0)
             return 0;

@@ -709,6 +777,7 @@
                 var extX:Number = 0;
                 var preferredWidth:Number = layoutElement.getPreferredBoundsWidth();
                 var maxExtent:Number;
+                var availableWidth:Number;

                 var j:int;
                 var colWidth:Number = 0;
@@ -734,56 +803,49 @@
                 }

                 maxExtent = extX + preferredWidth;
-
-                // if there is no left or no right constraint, there must be
-                // a corresponding column constraint on the other side. We
-                // calculate the last column that this element touches to
-                // find the other column that the element spans to.
-                if (leftIndex < 0)
-                {
-                    leftIndex = 0; // defaults to first column
+                availableWidth = maxExtent;
+
+                // If either the left or the right constraint doesn't exist,
+                // we must find the span of the element. We do this by
+                // determining the index of the last column that the element
+                // occupies in the unconstrained direction.
+                if (leftIndex < 0 || rightIndex < 0)
+                {
+                    var isLeft:Boolean = leftIndex < 0;
+                    var startIndex:int = isLeft ? rightIndex : leftIndex;
+                    var endIndex:int = isLeft ? -1 : numCols;
+                    var increment:int = isLeft ? -1 : 1;

-                    // subtract fixed rows
-                    for (j = rightIndex; j >= 0; j--)
+                    // defaults to 0
+                    if (isLeft)
+                        leftIndex = 0;
+                    else // defaults to numCols - 1
+                        rightIndex = numCols - 1;
+
+                    for (j = startIndex; j != endIndex ; j += increment)
                     {
                         col = _constraintColumns[j];

+                        // subtract fixed columns
                         if (!isNaN(col.explicitWidth))
-                            maxExtent -= col.width;
+                            availableWidth -= col.explicitWidth;

-                        if (col.contentSize || maxExtent < 0)
+                        if (col.contentSize || availableWidth < 0)
                         {
-                            leftIndex = j;
+                            if (isLeft)
+                                leftIndex = j;
+                            else
+                                rightIndex = j;
                             break;
                         }
                     }
                 }
-                else if (rightIndex < 0)
-                {
-                    rightIndex = numCols - 1; // defaults to last column
-
-                    // subtract fixed rows
-                    for (j = leftIndex; j < numCols; j++)
-                    {
-                        col = _constraintColumns[j];
-
-                        if (!isNaN(col.explicitWidth))
-                            maxExtent -= col.width;
-
-                        if (col.contentSize || maxExtent < 0)
-                        {
-                            rightIndex = j;
-                            break;
-                        }
-                    }
-                }
-
-                // always 0 or positive.
-                span = rightIndex - leftIndex;
+
+                // always 1 or positive.
+                span = rightIndex - leftIndex + 1;
                 //trace(span);
-
-                // span of 0 means the element spans one column
-                if (span == 0)
+
+                if (span == 1)
                 {
                     col = _constraintColumns[leftIndex];

@@ -800,11 +862,49 @@
                 }
                 else
                 {
-                    // multiple spanning stuff.
+                    // multiple spanning case. span >= 2.
+                    // 1) start from leftIndex and subtract fixed columns
+                    // 2) divide space evenly into content size columns.
+                    var contentCols:Vector.<ConstraintColumn> = new Vector.<ConstraintColumn>();
+
+                    availableWidth = maxExtent;
+
+                    for (j = leftIndex; j <= rightIndex; j++)
+                    {
+                        col = _constraintColumns[j];
+
+                        if (!isNaN(col.explicitWidth))
+                        {
+                            availableWidth -= col.width;
+
+                            if (availableWidth < 0)
+                            {
+                                availableWidth += col.width;
+                                break;
+                            }
+                        }
+                        else if (col.contentSize)
+                        {
+                            contentCols.push(col);
+                        }
+                    }
+
+                    var numContentCols:Number = contentCols.length;
+
+                    if (numContentCols > 0)
+                    {
+                        colWidth = availableWidth / numContentCols;
+
+                        for (j = 0; j < numContentCols; j++)
+                        {
+                            col = contentCols[j];
+                            col.setActualWidth(Math.ceil(Math.max(col.width, colWidth)));
+                        }
+                    }
                 }
             }
         }
-
+
         // Position columns and add up widths.
         for (i = 0; i < numCols; i++)
         {
@@ -820,7 +920,9 @@
      *  @private
      *  Synonymous to measureAndPositionColumns(), but with added baseline constraint.
      *  Baseline is only included in the measurement if at least one of the element's
-     *  top or bottom constraint doesn't exist.
+     *  top or bottom constraint doesn't exist. The calculations are based on the
+     *  current constraintCache. To update the constraintCache, one needs to call
+     *  the parseConstraints() method.
      */
     private function measureAndPositionRows():Number
     {
@@ -867,6 +969,7 @@
                 var extY:Number = 0;
                 var preferredHeight:Number = layoutElement.getPreferredBoundsHeight();
                 var maxExtent:Number;
+                var availableHeight:Number;

                 var j:int;
                 var rowHeight:Number = 0;
@@ -907,56 +1010,49 @@
                 }

                 maxExtent = extY + preferredHeight;
-
-                // if there is no top or no bottom constraint, there must be
-                // a corresponding row constraint on the other side. We
-                // calculate the last row that this element touches to
-                // find the real span of the element.
-                if (topIndex < 0)
-                {
-                    topIndex = 0; // defaults to first row
+                availableHeight = maxExtent
+
+                // If either the top or the bottom constraint doesn't exist,
+                // we must find the span of the element. We do this by
+                // determining the index of the last column that the element
+                // occupies in the unconstrained direction.
+                if (topIndex < 0 || bottomIndex < 0)
+                {
+                    var isTop:Boolean = topIndex < 0;
+                    var startIndex:int = isTop ? bottomIndex : topIndex;
+                    var endIndex:int = isTop ? -1 : numRows;
+                    var increment:int = isTop ? -1 : 1;

-                    // subtract fixed rows
-                    for (j = bottomIndex; j >= 0; j--)
+                    // defaults to 0
+                    if (isTop)
+                        topIndex = 0;
+                    else // defaults to numRows - 1
+                        bottomIndex = numRows - 1;
+
+                    for (j = startIndex; j != endIndex ; j += increment)
                     {
                         row = _constraintRows[j];
-
+
+                        // subtract fixed rows
                         if (!isNaN(row.explicitHeight))
-                            maxExtent -= row.height;
+                            availableHeight -= row.explicitHeight;

-                        if (row.contentSize || maxExtent < 0)
+                        if (row.contentSize || availableHeight < 0)
                         {
-                            topIndex = j;
+                            if (isTop)
+                                topIndex = j;
+                            else
+                                bottomIndex = j;
                             break;
                         }
                     }
                 }
-                else if (bottomIndex < 0)
-                {
-                    bottomIndex = numRows - 1; // defaults to last row
-
-                    // subtract fixed rows
-                    for (j = topIndex; j < numRows; j++)
-                    {
-                        row = _constraintRows[j];
-
-                        if (!isNaN(row.explicitHeight))
-                            maxExtent -= row.height;
-
-                        if (row.contentSize || maxExtent < 0)
-                        {
-                            bottomIndex = j;
-                            break;
-                        }
-                    }
-                }
-
-                // always 0 or positive.
-                span = bottomIndex - topIndex;
+
+                // always 1 or positive.
+                span = bottomIndex - topIndex + 1;
                 //trace(span);

-                // span of 0 means the element spans one row
-                if (span == 0)
+                if (span == 1)
                 {
                     row = _constraintRows[topIndex];

@@ -973,7 +1069,45 @@
                 }
                 else
                 {
-                    // multiple spanning stuff.
+                    // multiple spanning case. span >= 2.
+                    // 1) start from topIndex and subtract fixed rows
+                    // 2) divide space evenly into content size rows.
+                    var contentRows:Vector.<ConstraintRow> = new Vector.<ConstraintRow>();
+
+                    availableHeight = maxExtent;
+
+                    for (j = topIndex; j <= bottomIndex; j++)
+                    {
+                        row = _constraintRows[j];
+
+                        if (!isNaN(row.explicitHeight))
+                        {
+                            availableHeight -= row.height;
+
+                            if (availableHeight < 0)
+                            {
+                                availableHeight += row.height;
+                                break;
+                            }
+                        }
+                        else if (row.contentSize)
+                        {
+                            contentRows.push(row);
+                        }
+                    }
+
+                    var numContentRows:Number = contentRows.length;
+
+                    if (numContentRows > 0)
+                    {
+                        rowHeight = availableHeight / numContentRows;
+
+                        for (j = 0; j < numContentRows; j++)
+                        {
+                            row = contentRows[j];
+                            row.setActualHeight(Math.ceil(Math.max(row.height, rowHeight)));
+                        }
+                    }
                 }
             }
         }
@@ -993,22 +1127,23 @@
      *  @private
      *  Measures the size of target based on content not included in the columns and rows.
      *  Basically, applies BasicLayout to other content to determine measured size.
-     */
-    private function measureOtherContent():Point
+     *  Returns a vector with the measured [width, height, minWidth, minHeight].
+     */
+    private function measureOtherContent():Vector.<Number>
     {
         var width:Number = 0;
         var height:Number = 0;
         var minWidth:Number = 0;
         var minHeight:Number = 0;
         var count:int = otherElements.length;
-
+
         for (var i:int = 0; i < count; i++)
         {
             var elementInfo:ElementConstraintInfo = otherElements[i];
             var layoutElement:ILayoutElement = elementInfo.layoutElement;

             // Only measure width if not constrained to columns.
-            if (!(elementInfo.leftBoundary || elementInfo.rightBoundary))
+            if (!elementInfo.leftBoundary && !elementInfo.rightBoundary)
             {
                 var left:Number = elementInfo.left;
                 var right:Number = elementInfo.right;
@@ -1039,27 +1174,28 @@
                 var elementMinWidth:Number =
                     constraintsDetermineWidth(elementInfo) ? layoutElement.getMinBoundsWidth() :
                     preferredWidth;
+
                 minWidth = Math.max(minWidth, extX + elementMinWidth);
             }

             // only measure height if not constrained to rows.
-            var hasTopOrBottom:Boolean = !(elementInfo.topBoundary || elementInfo.bottomBoundary);
-            var hasBaseline:Boolean = !elementInfo.baselineBoundary;
-
-            if (hasTopOrBottom || hasBaseline)
+            var noVerticalBoundaries:Boolean = !elementInfo.topBoundary && !elementInfo.bottomBoundary;
+            var noBaselineBoundary:Boolean = !elementInfo.baselineBoundary;
+
+            if (noVerticalBoundaries || noBaselineBoundary)
             {
                 var top:Number;
                 var bottom:Number;
                 var baseline:Number;
                 var extY:Number;

-                if (hasTopOrBottom)
+                if (noVerticalBoundaries)
                 {
                     top = elementInfo.top;
                     bottom = elementInfo.bottom;
                 }

-                if (hasBaseline)
+                if (noBaselineBoundary)
                     baseline = elementInfo.baseline;

                 if (!isNaN(top) && !isNaN(bottom))
@@ -1096,185 +1232,214 @@
             }
         }

-        return new Point(Math.max(width, minWidth), Math.max(height, minHeight));
-    }
-
-    /**
-     *  @private
-     *  Sizes and positions the element based on the given size of the container
-     *  and the element's constraints.
-     *
-     *  1) Retrieves element constraints from the constraint cache.
-     *  2) Determines the x and y boundaries of each side.
-     *  3) Sizes the element based on constraints and its preferred
-     *     size. The precedence for sizing is as follows: percent,
-     *     top and bottom constraints, preferred size.
-     *  4) Positions the element based on its constraints. The precedence
-     *     for positioning is as follows: baseline, left and top, right and bottom,
-     *     x and y.
-     */
-    private function applyConstraintsToElement(unscaledWidth:Number,
-                                               unscaledHeight:Number,
-                                               layoutElement:ILayoutElement):void
-    {
-        var elementInfo:ElementConstraintInfo = constraintCache[layoutElement];
-
-        var left:Number = elementInfo.left;
-        var right:Number = elementInfo.right;
-        var top:Number = elementInfo.top;
-        var bottom:Number = elementInfo.bottom;
-        var baseline:Number = elementInfo.baseline;
-
-        var leftBoundary:String = elementInfo.leftBoundary;
-        var rightBoundary:String = elementInfo.rightBoundary;
-        var topBoundary:String = elementInfo.topBoundary;
-        var bottomBoundary:String = elementInfo.bottomBoundary;
-        var baselineBoundary:String = elementInfo.baselineBoundary;
-
-        var percentWidth:Number = layoutElement.percentWidth;
-        var percentHeight:Number = layoutElement.percentHeight;
-
-        var availableWidth:Number;
-        var availableHeight:Number;
-
-        var elementWidth:Number = NaN;
-        var elementHeight:Number = NaN;
-        var elementMaxWidth:Number = NaN;
-        var elementMaxHeight:Number = NaN;
-        var elementX:Number = 0;
-        var elementY:Number = 0;
-
-        var leftHolder:Number = 0;
-        var rightHolder:Number = unscaledWidth;
-        var topHolder:Number = 0;
-        var bottomHolder:Number = unscaledHeight;
-        var baselineHolder:Number = 0;
-
+        var vec:Vector.<Number> = new Vector.<Number>(4, true);
+        vec[0] = Math.max(width, minWidth);
+        vec[1] = Math.max(height, minHeight);
+        vec[2] = minWidth;
+        vec[3] = minHeight;
+
+        return vec;
+    }
+
+    /**
+     *  @private
+     *  Iterates over elements and calls parseElementConstraints on each.
+     */
+    private function parseConstraints():void
+    {
+        var layoutTarget:GroupBase = target;
+        if (!layoutTarget)
+            return;
+
+        var count:Number = layoutTarget.numElements;
+        var layoutElement:ILayoutElement;
+
+        var cache:Dictionary = new Dictionary(true);
+
+        for (var i:int = 0; i < count; i++)
+        {
+            layoutElement = layoutTarget.getElementAt(i);
+            if (!layoutElement || !layoutElement.includeInLayout)
+                continue;
+
+            parseElementConstraints(layoutElement, cache);
+        }
+
+        this.constraintCache = cache;
+    }
+
+    /**
+     *  @private
+     *  This function parses the constraints of a single element, creates an
+     *  ElementConstraintInfo object for the element, and throws errors if the
+     *  columns or rows are not found for each constraint.
+     */
+    private function parseElementConstraints(layoutElement:ILayoutElement, constraintCache:Dictionary):void
+    {
+        // Variables to track the offsets
+        var left:Number;
+        var right:Number;
+        var top:Number;
+        var bottom:Number;
+        var baseline:Number;
+
+        // Variables to track the boundaries from which
+        // the offsets are calculated from. If null, the
+        // boundary is the parent container edge.
+        var leftBoundary:String;
+        var rightBoundary:String;
+        var topBoundary:String;
+        var bottomBoundary:String;
+        var baselineBoundary:String;
+
+        var message:String;
+
+        var temp:Array;
+        temp = LayoutElementHelper.parseConstraintExp(layoutElement.left);
+        left = temp[0];
+        leftBoundary = temp[1];
+
+        temp = LayoutElementHelper.parseConstraintExp(layoutElement.right);
+        right = temp[0];
+        rightBoundary = temp[1];
+
+        temp = LayoutElementHelper.parseConstraintExp(layoutElement.top);
+        top = temp[0];
+        topBoundary = temp[1];
+
+        temp = LayoutElementHelper.parseConstraintExp(layoutElement.bottom);
+        bottom = temp[0];
+        bottomBoundary = temp[1];
+
+        temp = LayoutElementHelper.parseConstraintExp(layoutElement.baseline);
+        baseline = temp[0];
+        baselineBoundary = temp[1];
+
+        // save values into a Dictionary based on element name.
+        var elementInfo:ElementConstraintInfo = new ElementConstraintInfo(layoutElement,
+            left, right, top, bottom, baseline,
+            leftBoundary, rightBoundary,
+            topBoundary, bottomBoundary, baselineBoundary);
+        constraintCache[layoutElement] = elementInfo;
+
+        // If some pair of boundaries don't exist, we will need to measure
+        // the container size based on the element's other properties like
+        // x, y, width, height.
         var i:Number;
-
-        var col:ConstraintColumn;
-        var row:ConstraintRow;
-
-        if (leftBoundary)
-        {
-            col = _constraintColumns[elementInfo.colSpanLeftIndex];
-            leftHolder = col.x;
-        }
-
-        if (rightBoundary)
-        {
-            col = _constraintColumns[elementInfo.colSpanRightIndex];
-            rightHolder = col.x + col.width;
-        }
-
-        if (topBoundary)
-        {
-            row = _constraintRows[elementInfo.rowSpanTopIndex];
-            topHolder = row.y;
-        }
-
-        if (bottomBoundary)
-        {
-            row = _constraintRows[elementInfo.rowSpanBottomIndex];
-            bottomHolder = row.y + row.height;
-        }
-
-        if (baselineBoundary)
-        {
-            row = _constraintRows[elementInfo.baselineIndex];
-            baselineHolder = row.y;
-
-            // If bottom doesn't exist, then the bottom should be restricted to the
-            // baseline row.
-            if (isNaN(bottom))
-                bottomHolder = row.y + row.height;
-        }
-
-        // available width
-        availableWidth = Math.round(rightHolder - leftHolder);
-
-        // cases are baseline with top and bottom,
-        // baseline with top, baseline with bottom, no baseline
-        if (!isNaN(baseline) && (isNaN(top) || isNaN(bottom)))
-            availableHeight = Math.round(bottomHolder - baselineHolder);
-        else
-            availableHeight = Math.round(bottomHolder - topHolder);
-
-        // set width
-        if (!isNaN(percentWidth))
-        {
-            if (!isNaN(left))
-                availableWidth -= left;
-            if (!isNaN(right))
-                availableWidth -= right;
-
-            elementWidth = Math.round(availableWidth * Math.min(percentWidth * 0.01, 1));
-            elementMaxWidth = Math.min(layoutElement.getMaxBoundsWidth(),
-                maxSizeToFitIn(unscaledWidth, left, right, layoutElement.getLayoutBoundsX()));
-        }
-        else if (!isNaN(left) && !isNaN(right))
-        {
-            elementWidth = availableWidth - left - right;
-        }
-
-        // set height
-        if (!isNaN(percentHeight))
-        {
-            if (!isNaN(top))
-                availableHeight -= top;
-            if (!isNaN(bottom))
-                availableHeight -= bottom;
-
-            elementHeight = Math.round(availableHeight * Math.min(percentHeight * 0.01, 1));
-            elementMaxHeight = Math.min(layoutElement.getMaxBoundsHeight(),
-                maxSizeToFitIn(unscaledHeight, top, bottom, layoutElement.getLayoutBoundsY()));
-        }
-        else if (!isNaN(top) && !isNaN(bottom))
-        {
-            elementHeight = availableHeight - top - bottom;
-        }
-
-        // Apply min and max constraints, make sure min is applied last. In the cases
-        // where elementWidth and elementHeight are NaN, setLayoutBoundsSize will use preferredSize
-        // which is already constrained between min and max.
-        if (!isNaN(elementWidth))
-        {
-            if (isNaN(elementMaxWidth))
-                elementMaxWidth = layoutElement.getMaxBoundsWidth();
-            elementWidth = Math.max(layoutElement.getMinBoundsWidth(), Math.min(elementMaxWidth, elementWidth));
-        }
-
-        if (!isNaN(elementHeight))
-        {
-            if (isNaN(elementMaxHeight))
-                elementMaxHeight = layoutElement.getMaxBoundsHeight();
-            elementHeight = Math.max(layoutElement.getMinBoundsHeight(), Math.min(elementMaxHeight, elementHeight));
-        }
-
-        layoutElement.setLayoutBoundsSize(elementWidth, elementHeight);
-        // update temp variables
-        elementWidth = layoutElement.getLayoutBoundsWidth();
-        elementHeight = layoutElement.getLayoutBoundsHeight();
-
-        // Horizontal Position
-        if (!isNaN(left))
-            elementX = leftHolder + left;
-        else if (!isNaN(right))
-            elementX = rightHolder - right - elementWidth;
-        else
-            elementX = layoutElement.getLayoutBoundsX();
-
-        // Vertical Position
-        if (!isNaN(baseline))
-            elementY = baselineHolder + Math.round(baseline - layoutElement.baselinePosition);
-        else if (!isNaN(top))
-            elementY = topHolder + top;
-        else if (!isNaN(bottom))
-            elementY = bottomHolder - bottom - elementHeight;
-        else
-            elementY = layoutElement.getLayoutBoundsY();
-
-        layoutElement.setLayoutBoundsPosition(elementX, elementY);
+        if ((!leftBoundary && !rightBoundary) ||
+            (!topBoundary && !bottomBoundary) ||
+            !baselineBoundary)
+        {
+            if (!otherElements)
+                otherElements = new Vector.<ElementConstraintInfo>();
+
+            otherElements.push(elementInfo);
+        }
+
+        // match columns
+        if (leftBoundary || rightBoundary)
+        {
+            var numColumns:Number = _constraintColumns.length;
+            var colIndex:Object;
+
+            if (!colSpanElements)
+                colSpanElements = new Vector.<ElementConstraintInfo>();
+
+            colSpanElements.push(elementInfo);
+
+            if (leftBoundary)
+            {
+                colIndex = columnsObject[leftBoundary];
+
+                if (colIndex != null)
+                    elementInfo.colSpanLeftIndex = int(colIndex);
+
+                // throw error if no match.
+                if (elementInfo.colSpanLeftIndex < 0)
+                {
+                    message = ResourceManager.getInstance().getString(
+                        "layout", "columnNotFound", [ leftBoundary ]);
+                    throw new ConstraintError(message);
+                }
+            }
+
+            // can we assume rightIndex >= leftIndex?
+            if (rightBoundary)
+            {
+                colIndex = columnsObject[rightBoundary];
+
+                if (colIndex != null)
+                    elementInfo.colSpanRightIndex = int(colIndex);
+
+                // throw error if no match.
+                if (elementInfo.colSpanRightIndex < 0)
+                {
+                    message = ResourceManager.getInstance().getString(
+                        "layout", "columnNotFound", [ rightBoundary ]);
+                    throw new ConstraintError(message);
+                }
+            }
+        }
+
+        // match rows.
+        var numRows:Number = _constraintRows.length;
+        if (topBoundary || bottomBoundary || baselineBoundary)
+        {
+            var rowIndex:Object;
+
+            if (!rowSpanElements)
+                rowSpanElements = new Vector.<ElementConstraintInfo>();
+
+            rowSpanElements.push(elementInfo);
+
+            if (topBoundary)
+            {
+                rowIndex = rowsObject[topBoundary];
+
+                if (rowIndex != null)
+                    elementInfo.rowSpanTopIndex = int(rowIndex);
+
+                // throw error if no match.
+                if (elementInfo.rowSpanTopIndex < 0)
+                {
+                    message = ResourceManager.getInstance().getString(
+                        "layout", "rowNotFound", [ topBoundary ]);
+                    throw new ConstraintError(message);
+                }
+            }
+
+            if (bottomBoundary)
+            {
+                rowIndex = rowsObject[bottomBoundary];
+
+                if (rowIndex != null)
+                    elementInfo.rowSpanBottomIndex = int(rowIndex);
+
+                // throw error if no match.
+                if (elementInfo.rowSpanBottomIndex < 0)
+                {
+                    message = ResourceManager.getInstance().getString(
+                        "layout", "rowNotFound", [ bottomBoundary ]);
+                    throw new ConstraintError(message);
+                }
+            }
+
+            if (baselineBoundary)
+            {
+                rowIndex = rowsObject[baselineBoundary];
+
+                if (rowIndex != null)
+                    elementInfo.baselineIndex = int(rowIndex);
+
+                // throw error if no match.
+                if (elementInfo.baselineIndex < 0)
+                {
+                    message = ResourceManager.getInstance().getString(
+                        "layout", "rowNotFound", [ baselineBoundary ]);
+                    throw new ConstraintError(message);
+                }
+            }
+        }
     }
 }
 }
@@ -1300,12 +1465,12 @@
      */
     public function ElementConstraintInfo(
         layoutElement:ILayoutElement,
-        left:Number, right:Number, //hc:Number,
-        top:Number, bottom:Number, //vc:Number,
+        left:Number, right:Number,
+        top:Number, bottom:Number,
         baseline:Number, leftBoundary:String = null,
-        rightBoundary:String = null, //hcBoundary:String = null,
+        rightBoundary:String = null,
         topBoundary:String = null, bottomBoundary:String = null,
-        /*vcBoundary:String = null, */baselineBoundary:String = null,
+        baselineBoundary:String = null,
         colSpanLeftIndex:int = -1, colSpanRightIndex:int = -1,
         rowSpanTopIndex:int = -1, rowSpanBottomIndex:int = -1,
         baselineIndex:int = -1):void
@@ -1318,19 +1483,15 @@
         // offsets
         this.left = left;
         this.right = right;
-/*        this.hc = hc;*/
         this.top = top;
         this.bottom = bottom;
-/*        this.vc = vc;*/
         this.baseline = baseline;

         // boundaries (ie: parent, column or row edge)
         this.leftBoundary = leftBoundary;
         this.rightBoundary = rightBoundary;
-/*        this.hcBoundary = hcBoundary;*/
         this.topBoundary = topBoundary;
         this.bottomBoundary = bottomBoundary;
-/*        this.vcBoundary = vcBoundary;*/
         this.baselineBoundary = baselineBoundary;

         this.colSpanLeftIndex = colSpanLeftIndex;
@@ -1350,17 +1511,13 @@

     public var left:Number;
     public var right:Number;
-/*    public var hc:Number;*/
     public var top:Number;
     public var bottom:Number;
-/*    public var vc:Number;*/
     public var baseline:Number;
     public var leftBoundary:String;
     public var rightBoundary:String;
-/*    public var hcBoundary:String;*/
     public var topBoundary:String;
     public var bottomBoundary:String;
-/*    public var vcBoundary:String;*/
     public var baselineBoundary:String;

     public var colSpanLeftIndex:int;


fixed bug addtostage

fixed bug addtostage

--- src/flash/display/DisplayObject.as
+++ src/flash/display/DisplayObject.as
@@ -71,7 +71,7 @@
 		public function get stage():Stage  { return _stage; }

 		public function set stage(v:Stage):void  {
-			if (_stage != v) {
+			//if (_stage != v) {
 				_stage = v;
 				if (_stage) {
 					dispatchEvent(new Event(Event.ADDED_TO_STAGE));
@@ -79,7 +79,7 @@
 					SpriteFlexjs.dirtyGraphics = true;
 					dispatchEvent(new Event(Event.REMOVED_FROM_STAGE));
 				}
-			}
+			//}
 		}

 		public function get root():DisplayObject  { return null }


Updated mouse controls

Updated mouse controls

--- src/heartattacks/doodads/Player.as
+++ src/heartattacks/doodads/Player.as
@@ -79,8 +79,8 @@
 				this.heart.beat(0.5);
 			}

-			this.processArrowControls();
 			this.processMouseControls();
+			//this.processArrowControls();

 			this.runTime += 1 / 60;
 			var currentSpeed:Number = this.MovementSpeed;
@@ -133,10 +133,42 @@

 		private function processMouseControls():void
 		{
-			if (Input.mouseDown && Input.mouseX)
-			{
-				var deltaX:Number = Input.mouseX < this.x ? 1 : -1;
-				this.steer(deltaX, this.TurningSpeed);
+			if (Input.mouseDown)
+			{
+				if (this.collidePoint(this.x, this.y, Input.mouseX, Input.mouseY))
+				{
+					this.spritemap.play("stand-forward");
+					this.isWaiting = true;
+				}
+				else
+				{
+					this.isWaiting = false;
+					var dx:Number = Input.mouseX - this.centerX;
+					var dy:Number = Input.mouseY - this.centerY;
+					var theta:Number = Math.atan2(dy, dx);
+					this.heading = theta;
+					if (this.heading < Math.PI / 2 - Math.PI / 8)
+					{
+						this.spritemap.flipped = false;
+						this.spritemap.play("walk-side");
+					}
+					else if (this.heading > Math.PI / 2 + Math.PI / 8)
+					{
+						this.spritemap.flipped = true;
+						this.spritemap.play("walk-side");
+					}
+					else
+					{
+						this.spritemap.flipped = false;
+						this.spritemap.play("walk-forward");
+					}
+				}
+			}
+			else
+			{
+				this.isWaiting = false;
+				this.heading = Math.PI / 2;
+				this.spritemap.play("walk-forward");
 			}
 		}

@@ -165,6 +197,10 @@
 		private function steer(direction:int, torque:Number):void
 		{
 			this.heading += direction * Math.PI / torque;
+		}
+
+		private function normalizeHeading():void
+		{
 			this.heading = (Math.PI * 2 + this.heading) % (Math.PI * 2);
 			if (this.heading < Math.PI / 4)
 			{


Transferred from the Adobe Open Source Subversion Repository

Revision: 18697
Author:   dloverin@adobe.com
Date:     2010-11-18T15:19:57.251528Z

Log Message:
-----------
Grid item editor bug fixes.

DataGridEditor
•         The F2 key was editing non-editable cells in cell selection mode
•         Mouse clicking on non-UI components in an editor was causing the editor to close.

GridItemEditor
•         Calling event.stopPropagation() on mouse move events was keeping RichEditableText from seeing the mouse moves and selecting text with the mouse (it listens to the stage). Canceling the mouse move event has the same effect. The work around I ended up with was to dispatch the mouse move event to the datagrid’s parent and stopPropagation() on the original event. This is a bit messy but it keeps all the logic in the editor.

QE notes: None.
Doc notes: None.
Bugs: SDK-28582
Reviewer: Hans
Tests run: checkintests
Is noteworthy for integration: No.

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/gridClasses/DataGridEditor.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/gridClasses/GridItemEditor.as</path>

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

--- frameworks/projects/spark/src/spark/components/gridClasses/DataGridEditor.as
+++ frameworks/projects/spark/src/spark/components/gridClasses/DataGridEditor.as
@@ -1095,20 +1095,29 @@
     /**
      *  @private
      *  Check if a mouse click occured within the editor.
+     *
+     *  @param event A MouseEvent or a SandboxMouseEvent
+     *
+     *  @return true if the target is within the editor, false otherwise.
      */
     private function editorOwnsClick(event:Event):Boolean
     {
-        return (event is MouseEvent &&
-            event.target is IUIComponent &&
-            editorOwns(IUIComponent(event.target)));
-    }
-
-    /**
-     *  @private
-     *  Check if a mouse click occured within the editor. The editor can be either
-     *  editedItemRenderer or itemEditorInstance.
-     *
-     *  @param child - child to test.
+        if (event is MouseEvent)
+        {
+            var target:IUIComponent = getIUIComponent(DisplayObject(event.target));
+            if (target)
+                return editorOwns(target);
+        }
+
+        return false;
+    }
+
+    /**
+     *  @private
+     *  Check if a child is contained within the editor using the owns() method.
+     *  The editor can be either editedItemRenderer or itemEditorInstance.
+     *
+     *  @param child child to test.
      *  @return true if the child is owned by the editor.
      */
     private function editorOwns(child:IUIComponent):Boolean
@@ -1123,6 +1132,31 @@

     /**
      *  @private
+     *  The IUIComponent related to a given object. If the object is not a IUIComponent
+     *  then work up the display list until we find a IUIComponent.
+     *  @param  displayObject The object to get a IUIComponet from.
+     *  @return returns the displayObject if it is a display object or its
+     *  closest parent that is a display object.
+     */
+    private function getIUIComponent(displayObject:DisplayObject):IUIComponent
+    {
+        if (displayObject is IUIComponent)
+            return IUIComponent(displayObject);
+
+        var current:DisplayObject = displayObject.parent;
+        while (current)
+        {
+            if (current is IUIComponent)
+                return IUIComponent(current);
+
+            current = current.parent;
+        }
+
+        return null;
+    }
+
+    /**
+     *  @private
      *
      *  Restore the focusable children flags.
      */
@@ -1180,7 +1214,8 @@

         if (event.keyCode == dataGrid.editKey)
         {
-            // ignore F2 if we are already editing a cell.
+            // ignore F2 if we are already editing a cell or the column is not
+            // editable
             if (itemEditorInstance)
                 return;

@@ -1195,7 +1230,7 @@
                                                         false);
                 return;
             }
-            else
+            else if (canEditColumn(grid.caretColumnIndex))
             {
                 dataGrid.startItemEditorSession(grid.caretRowIndex, grid.caretColumnIndex);
             }


FLEX-34216 accept patch from Mihai Chira

--- frameworks/projects/spark/src/spark/components/gridClasses/DataGridEditor.as
+++ frameworks/projects/spark/src/spark/components/gridClasses/DataGridEditor.as
@@ -532,6 +532,7 @@

             o.removeEventListener(KeyboardEvent.KEY_DOWN, editor_keyDownHandler);
             o.removeEventListener(FocusEvent.FOCUS_OUT, editor_focusOutHandler);
+            o.removeEventListener(Event.REMOVED_FROM_STAGE, editor_removedFromStageHandler);
             o.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, editor_keyFocusChangeHandler);
             addRemoveFlexEventEnterListener(DisplayObject(o), false);

@@ -673,7 +674,7 @@
             var editor:IEventDispatcher = itemEditorInstance ? itemEditorInstance : editedItemRenderer;

             editor.addEventListener(FocusEvent.FOCUS_OUT, editor_focusOutHandler);
-
+			editor.addEventListener(Event.REMOVED_FROM_STAGE, editor_removedFromStageHandler);
             // listen for keyStrokes on the itemEditorInstance (which lets the grid supervise for ESC/ENTER)
             editor.addEventListener(KeyboardEvent.KEY_DOWN, editor_keyDownHandler);
             editor.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, editor_keyFocusChangeHandler, false, 1000);
@@ -1574,6 +1575,23 @@
      *  @private
      *  Closes the itemEditorInstance if the focus is outside of the data grid.
      */
+    private function editor_removedFromStageHandler(event:Event):void
+	{
+		if (itemEditorInstance || editedItemRenderer)
+		{
+			// If we can't save the data, say, because the data was invalid,
+			// then cancel the save.
+			if (!dataGrid.endItemEditorSession())
+			{
+				dataGrid.endItemEditorSession(true);
+			}
+		}
+	}
+
+    /**
+     *  @private
+     *  Closes the itemEditorInstance if the focus is outside of the data grid.
+     */
     private function editor_focusOutHandler(event:FocusEvent):void
     {
         //trace("editor_focusOutHandler " + event.relatedObject);


Transferred from the Adobe Open Source Subversion Repository

Revision: 23246
Author:   cframpto@adobe.com
Date:     2011-12-20T17:40:08.069454Z

Log Message:
-----------
Rollback 23243.  If comment followed header it was stripped as well.

Modified Paths:
--------------
2361 paths were modified

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

--- frameworks/projects/advancedgrids/src/mx/olap/aggregators/AverageAggregator.as
+++ frameworks/projects/advancedgrids/src/mx/olap/aggregators/AverageAggregator.as
@@ -1,3 +1,13 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  ADOBE SYSTEMS INCORPORATED
+//  Copyright 2009 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.olap.aggregators


Transferred from the Adobe Open Source Subversion Repository

Revision: 8131
Author:   chaase@adobe.com
Date:     2009-06-23T23:08:25.193334Z

Log Message:
-----------
Fix for 2 gumbo_priority bugs. One was a miscalculation of a Parallel effect's duration when it had zero-duration child effects, causing a problem when seeking into that parallel effect. The other was a fix to the easing model for transform effects. Now a transform effect will handle easing through its internal keyframes, preserving the behavior specified by the caller (or by the default easing behavior).

QE Notes: None. Behavior for AnimateTransform should be as before, although the way easing is applied to the subclasses has changed (and is now correct)
Doc Notes: None
Bugs: sdk-21477, sdk-21422
Reviewer: Jason
Tests: checkintests, Mustella spark/effects

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/Move3D.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/Rotate.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/Scale3D.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/Rotate3D.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/Move.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/Scale.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/spark/src/spark/effects/AnimateTransform.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/framework/src/mx/effects/effectClasses/ParallelInstance.as</path>

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

--- frameworks/projects/framework/src/mx/effects/effectClasses/ParallelInstance.as
+++ frameworks/projects/framework/src/mx/effects/effectClasses/ParallelInstance.as
@@ -142,13 +142,16 @@
      */
     override public function set playheadTime(value:Number):void
     {
-        var totalDur:Number = Parallel(effect).compositeDuration;
-        var childPlayheadTime:Number =
-            (value - startDelay) % (totalDur + repeatDelay);
+        var totalDur:Number = Parallel(effect).compositeDuration + repeatDelay;
+        var childPlayheadTime:Number = (totalDur > 0) ?
+            (value - startDelay) % totalDur :
+            value - startDelay;

         // This will seek in the Parallel's instance
         super.playheadTime = childPlayheadTime;
-        playCount = 1 + (value - startDelay) / (totalDur + repeatDelay);
+        playCount = (totalDur > 0) ?
+            1 + (value - startDelay) / totalDur :
+            1;

         // Tell all of our children to set their playheadTime
         for (var i:int = 0; i < childSets.length; i++)


Transferred from the Adobe Open Source Subversion Repository

Revision: 23247
Author:   cframpto@adobe.com
Date:     2011-12-20T19:21:13.134833Z

Log Message:
-----------
Remove ADOBE SYSTEMS license and replace with Apache license in headers - frameworks.  A 2nd pass will be needed to get the files not handled up by the scripts.

Modified Paths:
--------------
4959 paths were modified

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

--- frameworks/projects/advancedgrids/src/mx/collections/SummaryRow.as
+++ frameworks/projects/advancedgrids/src/mx/collections/SummaryRow.as
@@ -1,11 +1,19 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2009 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.
+//  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.
 //
 ////////////////////////////////////////////////////////////////////////////////


Transferred from the Adobe Open Source Subversion Repository

Revision: 23247
Author:   cframpto@adobe.com
Date:     2011-12-20T19:21:13.134833Z

Log Message:
-----------
Remove ADOBE SYSTEMS license and replace with Apache license in headers - frameworks.  A 2nd pass will be needed to get the files not handled up by the scripts.

Modified Paths:
--------------
4959 paths were modified

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

--- frameworks/projects/spark/src/spark/components/RichEditableText.as
+++ frameworks/projects/spark/src/spark/components/RichEditableText.as
@@ -1,11 +1,19 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2008 Adobe Systems Incorporated
-//  All Rights Reserved.
+//  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
 //
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
+//      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.
 //
 ////////////////////////////////////////////////////////////////////////////////


Transferred from the Adobe Open Source Subversion Repository

Revision: 3346
Author:   smgilson@adobe.com
Date:     2008-09-25T12:26:51.179444Z

Log Message:
-----------
fix invalid html ins ASDoc comment

Checkin Test Passed: Yes
QA: No
Bug:
Doc: No

Modified Paths:
--------------
/flex/sdk/trunk/frameworks/projects/flex4/src/flex/effects/Animation.as

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

--- frameworks/projects/spark/src/spark/effects/animation/Animation.as
+++ frameworks/projects/spark/src/spark/effects/animation/Animation.as
@@ -53,7 +53,7 @@
 /**
  * Dispatched when the effect ends. An animationUpdate event
  * is also dispatched at the same time. A repeating animation dispatches
- * this event only after the final repetition.

+ * this event only after the final repetition.
  *
  * @eventType flex.events.AnimationEvent.ANIMATION_END
  */


Transferred from the Adobe Open Source Subversion Repository

Revision: 19467
Author:   cframpto@adobe.com
Date:     2010-12-17T21:27:38.093578Z

Log Message:
-----------
Fix DG tooltips for rtl layoutDirection and centralize the toolTipShowHandler() for the DG item renderers.  Fix optimization in scrollPositionChanged so it works as intended.
Added for tooling - if UIComponentGlobals.designMode, initialize exceptions will be caught and an intializeError event dispatched.

QE notes:
Doc notes:
Bugs: SDK-28743, SDK-28894
Reviewer: Ryan (SDK-28743), Hans (SDK-28894)
Tests run: cyclone
Is noteworthy for integration: yes: if UIComponentGlobals.designMode, initialize exceptions will be caught and an intializeError event dispatched

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/core/UIComponent.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/skins/spark/UITextFieldGridItemRenderer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/gridClasses/GridColumnHeaderGroupLayout.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/skins/spark/TextFieldGridItemRendererInclude.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/gridClasses/GridItemRenderer.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/skins/spark/DefaultGridItemRenderer.as</path>

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

--- frameworks/projects/spark/src/spark/components/gridClasses/GridColumnHeaderGroupLayout.as
+++ frameworks/projects/spark/src/spark/components/gridClasses/GridColumnHeaderGroupLayout.as
@@ -185,7 +185,7 @@

         // Only invalidate if we're clipping and scrollR extends outside visibleRenderersBounds
         const scrollR:Rectangle = columnHeaderGroup.scrollRect;
-        if (scrollR && !visibleRenderersBounds.containsRect(scrollR))
+		if (scrollR && !visibleRenderersBounds.containsRect(scrollR))
             columnHeaderGroup.invalidateDisplayList();
     }

@@ -358,11 +358,12 @@

         columnHeaderGroup.setContentSize(grid.contentWidth, rendererHeight);

-        visibleRenderersBounds.left = visibleLeft;
-        visibleRenderersBounds.right = visibleRight;
-        visibleRenderersBounds.top = rendererY;
-        visibleRenderersBounds.height = rendererHeight;
-
+		visibleRenderersBounds.left = visibleLeft - paddingLeft;
+		visibleRenderersBounds.right = visibleRight = paddingRight;
+		visibleRenderersBounds.top = rendererY - paddingTop;
+        visibleRenderersBounds.height = rendererHeight + paddingTop + paddingBottom;
+
+
         // We may have created new renderers or changed their visibility.  Force
         // validation to avoid a display list flash.


Transferred from the Adobe Open Source Subversion Repository

Revision: 23247
Author:   cframpto@adobe.com
Date:     2011-12-20T19:21:13.134833Z

Log Message:
-----------
Remove ADOBE SYSTEMS license and replace with Apache license in headers - frameworks.  A 2nd pass will be needed to get the files not handled up by the scripts.

Modified Paths:
--------------
4959 paths were modified

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

--- frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewDescriptor.as
+++ frameworks/projects/mobilecomponents/src/spark/components/supportClasses/ViewDescriptor.as
@@ -1,11 +1,19 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2010 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.
+//  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.
 //
 ////////////////////////////////////////////////////////////////////////////////


Transferred from the Adobe Open Source Subversion Repository

Revision: 23247
Author:   cframpto@adobe.com
Date:     2011-12-20T19:21:13.134833Z

Log Message:
-----------
Remove ADOBE SYSTEMS license and replace with Apache license in headers - frameworks.  A 2nd pass will be needed to get the files not handled up by the scripts.

Modified Paths:
--------------
4959 paths were modified

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

--- frameworks/projects/spark/src/spark/primitives/supportClasses/StrokedElement.as
+++ frameworks/projects/spark/src/spark/primitives/supportClasses/StrokedElement.as
@@ -1,11 +1,19 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2008 Adobe Systems Incorporated
-//  All Rights Reserved.
+//  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
 //
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
+//      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.
 //
 ////////////////////////////////////////////////////////////////////////////////


Transferred from the Adobe Open Source Subversion Repository

Revision: 23243
Author:   cframpto@adobe.com
Date:     2011-12-20T00:59:57.384047Z

Log Message:
-----------
In frameworks, remove Adobe headers from all files except xml/mxml file types.  There are also a few .txt files that are license files that I didn't touch yet.

Modified Paths:
--------------
2361 paths were modified

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

--- frameworks/projects/advancedgrids/src/mx/styles/metadata/PaddingStyles.as
+++ frameworks/projects/advancedgrids/src/mx/styles/metadata/PaddingStyles.as
@@ -1,25 +1,4 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2009 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.
-//
-////////////////////////////////////////////////////////////////////////////////

-/**
- *  Number of pixels between the control's left border
- *  and the left edge of its content area.
- *
- *  @default 2
- *
- *  @langversion 3.0
- *  @playerversion Flash 9
- *  @playerversion AIR 1.1
- *  @productversion Flex 3
- */
 [Style(name="paddingLeft", type="Number", format="Length", inherit="no")]

 /**


Transferred from the Adobe Open Source Subversion Repository

Revision: 23247
Author:   cframpto@adobe.com
Date:     2011-12-20T19:21:13.134833Z

Log Message:
-----------
Remove ADOBE SYSTEMS license and replace with Apache license in headers - frameworks.  A 2nd pass will be needed to get the files not handled up by the scripts.

Modified Paths:
--------------
4959 paths were modified

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

--- frameworks/projects/spark/src/spark/accessibility/ButtonBarBaseAccImpl.as
+++ frameworks/projects/spark/src/spark/accessibility/ButtonBarBaseAccImpl.as
@@ -1,11 +1,19 @@
 ////////////////////////////////////////////////////////////////////////////////
 //
-//  ADOBE SYSTEMS INCORPORATED
-//  Copyright 2009 Adobe Systems Incorporated
-//  All Rights Reserved.
+//  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
 //
-//  NOTICE: Adobe permits you to use, modify, and distribute this file
-//  in accordance with the terms of the license agreement accompanying it.
+//      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.
 //
 ////////////////////////////////////////////////////////////////////////////////


Transferred from the Adobe Open Source Subversion Repository

Revision: 19758
Author:   aharui@adobe.com
Date:     2011-01-14T00:58:13.969259Z

Log Message:
-----------
reverting svn 19330 as it relied on svn 18635

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/DataGroup.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/layouts/TileLayout.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/layouts/supportClasses/LayoutBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/layouts/HorizontalLayout.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/spark/src/spark/layouts/VerticalLayout.as</path>

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

--- frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as
+++ frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as
@@ -287,7 +287,47 @@
      */
     override public function get baselinePosition():Number
     {
-        return getBaselinePositionForPart(dataGroup);
+        if (!validateBaselinePosition())
+            return NaN;
+
+        // Fabricate temporary data provider if necessary.
+        var isNull:Boolean = dataProvider == null;
+        var isEmpty:Boolean = dataProvider != null && dataProvider.length == 0;
+
+        if (isNull || isEmpty)
+        {
+            var originalProvider:IList = isEmpty ? dataProvider : null;
+            dataProvider = new mx.collections.ArrayList([ new Object() ]);
+            validateNow();
+        }
+
+        if (!dataGroup || dataGroup.numElements == 0)
+            return super.baselinePosition;
+
+        // Obtain reference to newly generated item element which will be used
+        // to compute the baseline.
+        var listItem:Object = dataGroup ? dataGroup.getElementAt(0) : undefined;
+        if (!listItem)
+            return super.baselinePosition;
+
+        // Compute baseline position of item relative to our list component.
+        if ("baselinePosition" in listItem)
+            var result:Number = getSkinPartPosition(IVisualElement(listItem)).y + listItem.baselinePosition;
+        else
+            super.baselinePosition;
+
+        // Restore the previous state of our list.
+        if (isNull || isEmpty)
+        {
+            if (isNull)
+                dataProvider = null;
+            else if (isEmpty)
+                dataProvider = originalProvider;
+
+            validateNow();
+        }
+
+        return result;
     }

     //----------------------------------
@@ -1605,6 +1645,7 @@
                 //These cases are handled by the DataGroup skinpart
             }
         }
+
     }
 }


Transferred from the Adobe Open Source Subversion Repository

Revision: 3689
Author:   mhorn@adobe.com
Date:     2008-10-16T18:32:34.424944Z

Log Message:
-----------
asdoc updates

Modified Paths:
--------------
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/styles/metadata/AdvancedCharacterFormatTextStyles.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/styles/metadata/BasicContainerFormatTextStyles.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/graphics/graphicsClasses/TextGraphicElement.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/styles/metadata/BasicParagraphFormatTextStyles.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/styles/metadata/AdvancedContainerFormatTextStyles.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/styles/metadata/AdvancedParagraphFormatTextStyles.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/graphics/TextGraphic.as</path>
<path kind="file" action="M">/flex/sdk/trunk/frameworks/projects/flex4/src/mx/styles/metadata/BasicCharacterFormatTextStyles.as</path>

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


FLEX-34625 Correcting package name.

FLEX-34625 Correcting package name.

--- frameworks/projects/spark/src/tests/spark/skins/spark/FLEX_34625_Tests.as
+++ frameworks/projects/spark/src/tests/spark/skins/spark/FLEX_34625_Tests.as
@@ -17,7 +17,7 @@
 //
 ////////////////////////////////////////////////////////////////////////////////

-package spark.skins.spark {
+package tests.spark.skins.spark {
     import flash.events.Event;
     import flash.events.EventDispatcher;