2002/09/15 23:36:01
[org.ibex.core.git] / src / org / xwt / Box.java
index f89e998..4c2e1b4 100644 (file)
@@ -414,7 +414,6 @@ public final class Box extends JSObject {
 
     /** loads the image described by string str, possibly blocking for a network load */
     static ImageDecoder getImage(String str, final Function callback) {
-        ImageDecoder ret = null;
         boolean ispng = false;
 
         if (str.indexOf(':') == -1) {
@@ -830,10 +829,10 @@ public final class Box extends JSObject {
 
         // 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()) {
-                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);
             }
@@ -881,7 +880,6 @@ public final class Box extends JSObject {
             int y1 = max(y, pos(1) + bh);
             int x2 = min(x + w, pos(0) + size(0) - bw);
             int y2 = min(y + h, pos(1) + size(1) - bh);
-            buf.setClip(0, 0, buf.getWidth(), buf.getHeight());
             if (y2 - y1 > 0 && x2 - x1 > 0)
                 buf.fillRect(x1,y1,x2,y2,(color & 0xFF000000) != 0 ? color : SpecialBoxProperty.lightGray);
         }
@@ -1107,7 +1105,7 @@ public final class Box extends JSObject {
                 }
 
             if (numKids > 15 && children == null) convert_to_array();
-            if (newnode.parent != null) newnode.remove();
+            newnode.remove();
             newnode.parent = this;
             
             if (children == null) {
@@ -1315,7 +1313,7 @@ public final class Box extends JSObject {
     /** remove this node from its parent; INVARIANT: whenever the parent of a node is changed, remove() gets called. */
     public void remove() {
         if (parent == null) {
-            if (surface != null) surface.dispose();
+            if (surface != null) surface.dispose(true);
             return;
         }
         Box oldparent = getParent();