                 vsbVisible = false;
         }
 
-        // Shrink the viewport's width,height for the visible scrollbars
-        
-        viewportH = h - minViewportInset;
-        if (hsbVisible)
-            viewportH -= Math.max(minViewportInset, hsb.getPreferredBoundsHeight());
-            
-        viewportW = w - minViewportInset;
-        if (vsbVisible)
-            viewportW -= Math.max(minViewportInset, vsb.getPreferredBoundsWidth());
-        
+        // Reset the viewport's width,height to account for the visible scrollbars, unless
+        // the viewport's size was explicitly set, then we just use that. 
+        
+        if (isNaN(explicitViewportW))
+            viewportW = w - ((vsbVisible) ? (minViewportInset + vsbRequiredWidth()) : (minViewportInset * 2));
+        else 
+            viewportW = explicitViewportW;
+        
+        if (isNaN(explicitViewportH))
+            viewportH = h - ((hsbVisible) ? (minViewportInset + hsbRequiredHeight()) : (minViewportInset * 2));
+        else 
+            viewportH = explicitViewportH;
+
         // If the scrollBarPolicy is auto, and we're only showing one scrollbar, 
         // the viewport may have shrunk enough to require showing the other one.
-
+        
+        var hsbIsDependent:Boolean = false;
+        var vsbIsDependent:Boolean = false;
+    
         if (vsbVisible && !hsbVisible && hAuto && (contentW > viewportW))
-        {
-            hsbVisible = true;
-            viewportH -= Math.max(minViewportInset, hsb.getPreferredBoundsHeight());
-        }
+            hsbVisible = hsbIsDependent = true;
         else if (!vsbVisible && hsbVisible && vAuto && (contentH > viewportH))
-        {
-            vsbVisible = true;
-            viewportW -= Math.max(minViewportInset, vsb.getPreferredBoundsWidth());
-        }
-
-        // Factor in scrollBar-side viewportInsets where there aren't scrollbars
-
-        if (!hsbVisible) 
-            viewportH -= minViewportInset;
-
-        if (!vsbVisible) 
-            viewportW -= minViewportInset;
-        
+            vsbVisible = vsbIsDependent = true;
+
         // If the HSB doesn't fit, hide it and give the space back.   Likewise for VSB.
         // If both scrollbars are supposed to be visible but they don't both fit, 
-        // then prefer to show just a VSB over just a HSB.
-    
-        if (hsbVisible && vsbVisible)
-        {
-            var hsbPreferredH:Number = hsb.getPreferredBoundsHeight();  
-            var vsbPreferredW:Number = vsb.getPreferredBoundsWidth();
-
-            if (!hsbFits(w, h))
+        // then prefer to show the "non-dependent" auto scrollbar if we added the second
+        // "dependent" auto scrollbar because of the space consumed by the first.
+        
+        if (hsbVisible && vsbVisible) 
+        {
+            if (hsbFits(w, h) && vsbFits(w, h))
+            {
+                // Both scrollbars fit, we're done.
+            }
+            else if (!hsbFits(w, h, false) && !vsbFits(w, h, false))
+            {
+                // Neither scrollbar would fit, even if the other scrollbar wasn't visible.
                 hsbVisible = false;
-
-            if (!vsbFits(w, h))
+                vsbVisible = false;
+            }
+            else
             {
-                vsbVisible = false;
-                hsbVisible = true;
-                if (!hsbFits(w, h))
+                // Only one of the scrollbars will fit.  If we're showing a second "dependent"
+                // auto scrollbar because the first scrollbar consumed enough space to
+                // require it, if the first scrollbar doesn't fit, don't show either of them.
+
+                if (hsbIsDependent)
+                {
+                    if (vsbFits(w, h, false))  // VSB will fit if HSB isn't shown   
+                        hsbVisible = false;
+                    else 
+                        vsbVisible = hsbVisible = false;
+  
+                }
+                else if (vsbIsDependent)
+                {
+                    if (hsbFits(w, h, false)) // HSB will fit if VSB isn't shown
+                        vsbVisible = false;
+                    else
+                        hsbVisible = vsbVisible = false; 
+                }
+                else if (vsbFits(w, h, false)) // VSB will fit if HSB isn't shown
                     hsbVisible = false;
+                else // hsbFits(w, h, false)   // HSB will fit if VSB isn't shown
+                    vsbVisible = false;
             }
-
-            if (!hsbVisible)
-                viewportH += Math.max(minViewportInset, hsbPreferredH);
-            if (!vsbVisible)
-                viewportW += Math.max(minViewportInset, vsbPreferredW);
-        }
-        else if (hsbVisible && !hsbFits(w, h))
-        {
-            viewportH += Math.max(minViewportInset, hsb.getPreferredBoundsHeight());
+        }
+        else if (hsbVisible && !hsbFits(w, h))  // just trying to show HSB, but it doesn't fit
             hsbVisible = false;
-        }
-        else if (vsbVisible && !vsbFits(w, h))
-        {
-            viewportW += Math.max(minViewportInset, vsb.getPreferredBoundsWidth());
+        else if (vsbVisible && !vsbFits(w, h))  // just trying to show VSB, but it doesn't fit
             vsbVisible = false;
-        }
-        
-        // Special case: viewport's size is explicitly set
-
-        if (!isNaN(explicitViewportW)) 
+        
+        // Reset the viewport's width,height to account for the visible scrollbars, unless
+        // the viewport's size was explicitly set, then we just use that.
+        
+        if (isNaN(explicitViewportW))
+            viewportW = w - ((vsbVisible) ? (minViewportInset + vsbRequiredWidth()) : (minViewportInset * 2));
+        else 
             viewportW = explicitViewportW;
 
-        if (!isNaN(explicitViewportH)) 
+        if (isNaN(explicitViewportH))
+            viewportH = h - ((hsbVisible) ? (minViewportInset + hsbRequiredHeight()) : (minViewportInset * 2));
+        else 
             viewportH = explicitViewportH;
         
-        // Layout the viewport scrollbars.
+        // Layout the viewport and scrollbars.
 
         if (viewport)
         {


    /**
     *  @private
     *  Return true if the specified dimensions provide enough space to layout 
     *  the vertical scrollbar (vsb) at its minimum size.   The VSB is assumed 
     *  to be non-null and visible.
     */
    private function vsbFits(w:Number, h:Number):Boolean
    {
        if (hsbVisible)
        {
            var hsb:ScrollBar = getScroller().horizontalScrollBar;            
            w -= hsb.getMinBoundsWidth();

                if (hsb && viewport)
                {
                    hAuto = true;
                    hsbVisible = (contentW > viewportW);
                } 
                break;
