         {
             if (measuredSizeIncludesScrollBars)
             {
+                var contentSize:Point = getLayoutContentSize(viewport);
+    
                 var viewportPreferredW:Number =  viewport.getPreferredBoundsWidth();
-                measuredW += Math.max(viewportPreferredW, (showHSB) ? hsb.getMinBoundsWidth() : 0);
+                var viewportContentW:Number = contentSize.x;
+                var viewportW:Number = viewport.getLayoutBoundsWidth();  // "current" size
+                var currentSizeNoHSB:Boolean = !isNaN(viewportW) && ((viewportW + SDT) > viewportContentW);
+                if (hAuto && !showHSB && ((viewportPreferredW + SDT) <= viewportContentW) && currentSizeNoHSB)
+                    measuredW += viewportW;
+                else
+                    measuredW += Math.max(viewportPreferredW, (showHSB) ? hsb.getMinBoundsWidth() : 0);
     
                 var viewportPreferredH:Number = viewport.getPreferredBoundsHeight();
-                measuredH += Math.max(viewportPreferredH, (showVSB) ? vsb.getMinBoundsHeight() : 0);
+                var viewportContentH:Number = contentSize.y;
+                var viewportH:Number = viewport.getLayoutBoundsHeight();  // "current" size
+                var currentSizeNoVSB:Boolean = !isNaN(viewportH) && ((viewportH + SDT) > viewportContentH);
+                if (vAuto && !showVSB && ((viewportPreferredH + SDT) <= viewportContentH) && currentSizeNoVSB)
+                    measuredH += viewportH;
+                else
+                    measuredH += Math.max(viewportPreferredH, (showVSB) ? vsb.getMinBoundsHeight() : 0);
             }
             else
             {

			
			vsb.setLayoutBoundsPosition(w - vsbW, 0);
        }
        
		var viewportGroup:GroupBase;
        if (FlexVersion.compatibilityVersion < FlexVersion.VERSION_4_5)
        {
            // If we've added an auto scrollbar, then the measured size is likely to have been wrong.
            // There's a risk of looping here, so we count.  
            if ((invalidationCount < 2) && (((vsbVisible != oldShowVSB) && vAuto) || ((hsbVisible != oldShowHSB) && hAuto)))
            {
                target.invalidateSize();
                
                // If the viewport's layout is virtual, it's possible that its
                // measured size changed as a consequence of laying it out,
                // so we invalidate its size as well.
                viewportGroup = viewport as GroupBase;
                if (viewportGroup && viewportGroup.layout && viewportGroup.layout.useVirtualLayout)
                    viewportGroup.invalidateSize();
                
                invalidationCount += 1; 
            }
            else
                invalidationCount = 0;
        }
		else
		{
			if (((vsbVisible != oldShowVSB) && vAuto) || ((hsbVisible != oldShowHSB) && hAuto))
			{
				const measuredSizeIncludesScrollBars:Boolean = scroller.measuredSizeIncludesScrollBars && (scroller.getStyle("interactionMode") == InteractionMode.MOUSE);
				if (measuredSizeIncludesScrollBars)
				{
					target.invalidateSize();
					
					// If the viewport's layout is virtual, it's possible that its
					// measured size changed as a consequence of laying it out,
					// so we invalidate its size as well.
					viewportGroup = viewport as GroupBase;
					if (viewportGroup && viewportGroup.layout && viewportGroup.layout.useVirtualLayout)
						viewportGroup.invalidateSize();
				}
			}
		}
        
        target.setContentSize(w, h);
    }


    //  Overidden Methods
    //
    //--------------------------------------------------------------------------
    
    /**
     * @private
