                 childX = left;
             else if (!isNaN(right))
                 childX = unscaledWidth - elementWidth - right;
-            else // since setting actual size might have moved the actual position, we need to reset here            
-            	childX = layoutElement.getLayoutBoundsX();
+            else
+                childX = layoutElement.getLayoutBoundsX();
 
             // Vertical position
             if (!isNaN(vCenter))
                 childY = Math.round((unscaledHeight - elementHeight) / 2 + vCenter);
+            else if (!isNaN(baseline))
+                childY = baseline - IVisualElement(layoutElement).baselinePosition;
             else if (!isNaN(top))
                 childY = top;
             else if (!isNaN(bottom))
                 childY = unscaledHeight - elementHeight - bottom;
-           	else  // since setting actual size might have moved the actual position, we need to reset here
-           		childY = layoutElement.getLayoutBoundsY();
+            else
+                childY = layoutElement.getLayoutBoundsY();
 
             // Set position
             layoutElement.setLayoutBoundsPosition(childX, childY);

            if (!layoutElement || !layoutElement.includeInLayout)
                continue;

            var left:Number      = LayoutElementHelper.parseConstraintValue(layoutElement.left);
            var right:Number     = LayoutElementHelper.parseConstraintValue(layoutElement.right);
            var top:Number       = LayoutElementHelper.parseConstraintValue(layoutElement.top);
            var bottom:Number    = LayoutElementHelper.parseConstraintValue(layoutElement.bottom);

            var extX:Number = 0;
            var extY:Number = 0;

            if (isNaN(left) && isNaN(right) &&
                isNaN(LayoutElementHelper.parseConstraintValue(layoutElement.horizontalCenter)))
            {
                extX += layoutElement.getLayoutBoundsX();
            }
            else
            {
                extX += isNaN(left) ? 0 : left;
                extX += isNaN(right) ? 0 : right;
            }

            if (isNaN(top) && isNaN(bottom) &&
                isNaN(LayoutElementHelper.parseConstraintValue(layoutElement.verticalCenter)))
            {
                extY += layoutElement.getLayoutBoundsY();
            }
            else
            {
                extY += isNaN(top) ? 0 : top;
                extY += isNaN(bottom) ? 0 : bottom;
            }

            width = Math.max(width, extX + layoutElement.getPreferredBoundsWidth());
            height = Math.max(height, extY + layoutElement.getPreferredBoundsHeight());

            var elementMinWidth:Number = constraintsDetermineWidth(layoutElement) ? layoutElement.getMinBoundsWidth() : layoutElement.getPreferredBoundsWidth();
            var elementMinHeight:Number = constraintsDetermineHeight(layoutElement) ? layoutElement.getMinBoundsHeight() : layoutElement.getPreferredBoundsHeight();

            minWidth = Math.max(minWidth, extX + elementMinWidth);
            minHeight = Math.max(minHeight, extY + elementMinHeight);

            if (!layoutElement || !layoutElement.includeInLayout)
                continue;

            var hCenter:Number       = LayoutElementHelper.parseConstraintValue(layoutElement.horizontalCenter);
            var vCenter:Number       = LayoutElementHelper.parseConstraintValue(layoutElement.verticalCenter);
            var baseline:Number      = LayoutElementHelper.parseConstraintValue(layoutElement.baseline);
            var left:Number          = LayoutElementHelper.parseConstraintValue(layoutElement.left);
            var right:Number         = LayoutElementHelper.parseConstraintValue(layoutElement.right);
            var top:Number           = LayoutElementHelper.parseConstraintValue(layoutElement.top);
            var bottom:Number        = LayoutElementHelper.parseConstraintValue(layoutElement.bottom);
            var percentWidth:Number  = layoutElement.percentWidth;
            var percentHeight:Number = layoutElement.percentHeight;
            
            var elementMaxWidth:Number = layoutElement.getMaxBoundsWidth();
            var elementMaxHeight:Number = layoutElement.getMaxBoundsHeight();

            // Calculate size
            var childWidth:Number = NaN;
            var childHeight:Number = NaN;

            if (!isNaN(percentWidth))
            {
                var availableWidth:Number = unscaledWidth;
                if (!isNaN(left))
                    availableWidth -= left;
                if (!isNaN(right))
                     availableWidth -= right;

                childWidth = availableWidth * Math.min(percentWidth * 0.01, 1);
                elementMaxWidth = Math.min(elementMaxWidth,
                    maxSizeToFitIn(unscaledWidth, hCenter, left, right, layoutElement.getLayoutBoundsX()));
            }
            else if (!isNaN(left) && !isNaN(right))
            {
                childWidth = unscaledWidth - right - left;
            }

            if (!isNaN(percentHeight))
            {
                var availableHeight:Number = unscaledHeight;
                if (!isNaN(top))
                    availableHeight -= top;
                if (!isNaN(bottom))
                    availableHeight -= bottom;    
                    
                childHeight = availableHeight * Math.min(percentHeight * 0.01, 1);
                elementMaxHeight = Math.min(elementMaxHeight,
                    maxSizeToFitIn(unscaledHeight, vCenter, top, bottom, layoutElement.getLayoutBoundsY()));
            }
            else if (!isNaN(top) && !isNaN(bottom))
            {
                childHeight = unscaledHeight - bottom - top;
            }

            // Apply min and max constraints, make sure min is applied last. In the cases
