2002/08/21 00:11:42
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 06:50:15 +0000 (06:50 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 06:50:15 +0000 (06:50 +0000)
darcs-hash:20040130065015-2ba56-147077ded627ca0fba829518349c1926b33e5c4c.gz

CHANGES
src/org/xwt/Box.java

diff --git a/CHANGES b/CHANGES
index 36b6ba7..4c85a7f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
 
 17-Aug megacz Template.java: fixed a bug that was keeping retheme() from working
 
 
 17-Aug megacz Template.java: fixed a bug that was keeping retheme() from working
 
+20-Aug megacz Box.java: fixed rounding error
+
 
 
index 1a1f672..c0891f5 100644 (file)
@@ -830,10 +830,10 @@ public final class Box extends JSObject {
 
         // arbitrarily distribute out any leftovers resulting from rounding errors
         int last = 0;
 
         // arbitrarily distribute out any leftovers resulting from rounding errors
         int last = 0;
-        while(goal > total && total != last) {
+        while(goal != total && total != last) {
             last = total;
             for(Box bt = getChild(0); bt != null; bt = bt.nextSibling()) {
             last = total;
             for(Box bt = getChild(0); bt != null; bt = bt.nextSibling()) {
-                int newsize = bound(bt.cmin(o), bt.size(o) + 1, bt.dmax(o));
+                int newsize = bound(bt.cmin(o), bt.size(o) + (goal > total ? 1 : -1), bt.dmax(o));
                 total += newsize - bt.size(o);
                 bt.set(size, o, newsize);
             }
                 total += newsize - bt.size(o);
                 bt.set(size, o, newsize);
             }