 			var marginBottom:Object;
 			var margin:Object;
 			var maxHeight:Number = 0;
-            // asking for contentView.width can result in infinite loop if host isn't sized already
+            // asking for contentView.height can result in infinite loop if host isn't sized already
             var h:Number = hostSizedToContent ? 0 : contentView.height;
+            var w:Number = contentView.width;
 			var verticalMargins:Array = [];
 			
 			for (var i:int = 0; i < n; i++)

	import org.apache.flex.events.IEventDispatcher;
	import org.apache.flex.geom.Rectangle;
	import org.apache.flex.utils.dbg.DOMPathUtil;
    import org.apache.flex.utils.CSSContainerUtils;

    /**

				if (child == null || !child.visible) continue;
                var top:Number = ValuesManager.valuesImpl.getValue(child, "top");
                var bottom:Number = ValuesManager.valuesImpl.getValue(child, "bottom");
                margin = ValuesManager.valuesImpl.getValue(child, "margin");
                marginLeft = ValuesManager.valuesImpl.getValue(child, "margin-left");
                marginTop = ValuesManager.valuesImpl.getValue(child, "margin-top");
                marginRight = ValuesManager.valuesImpl.getValue(child, "margin-right");
                marginBottom = ValuesManager.valuesImpl.getValue(child, "margin-bottom");
                var ml:Number = CSSUtils.getLeftValue(marginLeft, margin, w);
                var mr:Number = CSSUtils.getRightValue(marginRight, margin, w);
                var mt:Number = CSSUtils.getTopValue(marginTop, margin, h);
                var mb:Number = CSSUtils.getBottomValue(marginBottom, margin, h);
                
                ilc = child as ILayoutChild;
				var lastmr:Number;
				if (marginLeft == "auto")
					ml = 0;
				if (marginRight == "auto")
					mr = 0;
                var xx:Number;
                if (i == 0)
                {
