On Tue, 2005-12-06 at 15:58 -0500, Anthony Balkissoon wrote:
> I reverted this patch because it caused a Mauve regression.  I'll have
> to write more tests and figure out what was wrong.
> 
> regression: gnu.testlet.javax.swing.BoxLayout.maximumLayoutSize
> 

Okay, here's the new patch.  It doesn't cause the regression and also
makes us pass the new test:
gnu.testlet.javax.swing.BoxLayout.maximumLayoutSize2

Patch simply involves checking for overflow.

2005-12-06  Anthony Balkissoon  <[EMAIL PROTECTED]> 

* javax/swing/BoxLayout.java:
(maximumLayoutSize): Add Insets to Dimension and then check for 
overflow.

--Tony
Index: javax/swing/BoxLayout.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/BoxLayout.java,v
retrieving revision 1.26
diff -u -r1.26 BoxLayout.java
--- javax/swing/BoxLayout.java	6 Dec 2005 19:50:23 -0000	1.26
+++ javax/swing/BoxLayout.java	6 Dec 2005 21:25:01 -0000
@@ -334,8 +334,16 @@
           throw new AWTError("BoxLayout can't be shared");
 
         checkTotalRequirements();
-        return new Dimension(xTotal.maximum,
-                             yTotal.maximum);
+        Insets i = container.getInsets();
+        int xDim = xTotal.maximum + i.left + i.right;
+        int yDim = yTotal.maximum + i.top + i.bottom;
+        
+        // Check for overflow
+        if (xDim < xTotal.maximum)
+          xDim = Integer.MAX_VALUE;
+        if (yDim < yTotal.maximum)
+          yDim = Integer.MAX_VALUE;
+        return new Dimension(xDim, yDim);
       }
   }
 
_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to