You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jm...@apache.org on 2014/02/17 23:48:17 UTC

[3/3] git commit: [flex-sdk] [refs/heads/release4.12.0] - fix for endless loop and RTE 1502 when resizing text

fix for endless loop and RTE 1502 when resizing text


Project: http://git-wip-us.apache.org/repos/asf/flex-sdk/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-sdk/commit/6605f323
Tree: http://git-wip-us.apache.org/repos/asf/flex-sdk/tree/6605f323
Diff: http://git-wip-us.apache.org/repos/asf/flex-sdk/diff/6605f323

Branch: refs/heads/release4.12.0
Commit: 6605f32341818bfd8652674dc9e9ded2dad5dc23
Parents: cf660e8
Author: Justin Mclean <jm...@apache.org>
Authored: Tue Feb 18 09:47:32 2014 +1100
Committer: Justin Mclean <jm...@apache.org>
Committed: Tue Feb 18 09:47:32 2014 +1100

----------------------------------------------------------------------
 .../components/supportClasses/ScrollerLayout.as | 64 ++++++++++++--------
 1 file changed, 40 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-sdk/blob/6605f323/frameworks/projects/spark/src/spark/components/supportClasses/ScrollerLayout.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/spark/src/spark/components/supportClasses/ScrollerLayout.as b/frameworks/projects/spark/src/spark/components/supportClasses/ScrollerLayout.as
index a6725c7..b085f24 100644
--- a/frameworks/projects/spark/src/spark/components/supportClasses/ScrollerLayout.as
+++ b/frameworks/projects/spark/src/spark/components/supportClasses/ScrollerLayout.as
@@ -72,12 +72,18 @@ public class ScrollerLayout extends LayoutBase
     //
     //--------------------------------------------------------------------------   
 
-    /**
-     *  @private
-     *  Used by updateDisplayList() to prevent looping.
-     */
-    private var invalidationCount:int = 0;
-    
+	/**
+	 *  @private
+	 *  Used by updateDisplayList() to prevent looping.
+	 */
+	private var invalidationCount:int = 0;
+	
+	/**
+	 *  @private
+	 *  Used by updateDisplayList() to prevent looping.
+	 */
+	private var removeCount:int = 0;
+	
     /**
      *  @private
      */
@@ -224,7 +230,7 @@ public class ScrollerLayout extends LayoutBase
      *  the horizontal scrollbar (hsb) at its minimum size.   The HSB is assumed 
      *  to be non-null and visible.
      * 
-     *  If includeVSB is false we check to see if the HSB woudl fit if the 
+     *  If includeVSB is false we check to see if the HSB would fit if the 
      *  VSB wasn't visible.
      */
     private function hsbFits(w:Number, h:Number, includeVSB:Boolean=true):Boolean
@@ -347,6 +353,8 @@ public class ScrollerLayout extends LayoutBase
         const scroller:Scroller = getScroller();
         if (!scroller) 
             return;
+		
+		removeCount = 0;
             
         const minViewportInset:Number = scroller.minViewportInset;
         const measuredSizeIncludesScrollBars:Boolean = scroller.measuredSizeIncludesScrollBars && (scroller.getStyle("interactionMode") == InteractionMode.MOUSE);
@@ -450,6 +458,7 @@ public class ScrollerLayout extends LayoutBase
         g.measuredMinHeight = Math.ceil(minH);
     }
 
+
     /** 
      *  @private
      *  Arrange the viewport and scrollbars conventionally within
@@ -607,18 +616,28 @@ public class ScrollerLayout extends LayoutBase
 
                 if (hsbIsDependent)
                 {
-                    if (vsbFits(w, h, false))  // VSB will fit if HSB isn't shown   
+                    if (removeCount < 2 && vsbFits(w, h, false))  // VSB will fit if HSB isn't shown
+					{
+						removeCount++;
                         hsbVisible = false;
-                    else 
+					}
+                    else
+					{
                         vsbVisible = hsbVisible = false;
+					}
   
                 }
                 else if (vsbIsDependent)
                 {
-                    if (hsbFits(w, h, false)) // HSB will fit if VSB isn't shown
+                    if (removeCount < 2 && hsbFits(w, h, false)) // HSB will fit if VSB isn't shown
+					{
+						removeCount++;
                         vsbVisible = false;
+					}
                     else
+					{
                         hsbVisible = vsbVisible = false; 
+					}	
                 }
                 else if (vsbFits(w, h, false)) // VSB will fit if HSB isn't shown
                     hsbVisible = false;
@@ -652,20 +671,18 @@ public class ScrollerLayout extends LayoutBase
         else 
             viewportH = explicitViewportH;
         
-        // Layout the viewport and scrollbars.
-
-        if (viewport)
-        {
-            viewport.setLayoutBoundsSize(viewportW, viewportH);
-            viewport.setLayoutBoundsPosition(minViewportInset, minViewportInset);
-        }
-        
+		// Layout the viewport and scrollbars.
+		if (viewport)
+		{
+			viewport.setLayoutBoundsSize(viewportW, viewportH);
+			viewport.setLayoutBoundsPosition(minViewportInset, minViewportInset);
+		}
+		
         if (hsbVisible)
         {
 			var hsbH:Number = hsb.getPreferredBoundsHeight();
             var hsbW:Number = vsbVisible ? w - vsb.getPreferredBoundsWidth() : w;
-            hsb.setLayoutBoundsSize(Math.max(hsb.getMinBoundsWidth(), hsbW), hsbH);
-            
+            hsb.setLayoutBoundsSize(Math.max(hsb.getMinBoundsWidth(), hsbW), hsbH);           
 			hsb.setLayoutBoundsPosition(0, h - hsbH);
         }
 
@@ -673,8 +690,7 @@ public class ScrollerLayout extends LayoutBase
         {
             var vsbW:Number = vsb.getPreferredBoundsWidth(); 
             var vsbH:Number = hsbVisible ? h - hsb.getPreferredBoundsHeight() : h;
-			vsb.setLayoutBoundsSize(vsbW, Math.max(vsb.getMinBoundsHeight(), vsbH));
-			
+			vsb.setLayoutBoundsSize(vsbW, Math.max(vsb.getMinBoundsHeight(), vsbH));		
 			vsb.setLayoutBoundsPosition(w - vsbW, 0);
         }
 
@@ -691,11 +707,11 @@ public class ScrollerLayout extends LayoutBase
             if (viewportGroup && viewportGroup.layout && viewportGroup.layout.useVirtualLayout)
                 viewportGroup.invalidateSize();
             
-            invalidationCount += 1; 
+            invalidationCount++; 
         }
         else
             invalidationCount = 0;
-             
+        
         target.setContentSize(w, h);
     }