fixed bug 521
authoradam <adam@megacz.com>
Mon, 5 Apr 2004 06:37:11 +0000 (06:37 +0000)
committeradam <adam@megacz.com>
Mon, 5 Apr 2004 06:37:11 +0000 (06:37 +0000)
darcs-hash:20040405063711-5007d-21f91a15feca8ed58e1806481fbdd218b0f65ff3.gz

src/org/ibex/Box.java

index 3c3b868..f889d6e 100644 (file)
@@ -299,7 +299,7 @@ public final class Box extends JSScope implements Scheduler.Task {
 
     void place_children() {
         int numkids = 0; for(Box c = firstPackedChild(); c != null; c = c.nextPackedSibling()) numkids++;
-        //#repeat col/row colspan/rowspan contentwidth/contentheight width/height \
+        //#repeat col/row colspan/rowspan contentwidth/contentheight width/height HSHRINK/VSHRINK \
         //        maxwidth/maxheight cols/rows minwidth/minheight lp_h/lp_v lp_h/lp_v
         do {
             int nc = numkids * 2 + cols * 3 + 1 + 2;
@@ -326,11 +326,12 @@ public final class Box extends JSScope implements Scheduler.Task {
                 for(int i=0; i<coeff.length; i++)
                     coeff[i] = (i>=child.col && i<min(child.colspan+child.col, cols)) ? (float)1.0 : (float)0.0;
                 lp_h.add_constraint(coeff, LinearProgramming.GE, (float)child.contentwidth);
-                if (child.maxwidth < Integer.MAX_VALUE) {
+                int child_maxwidth = child.test(HSHRINK) ? min(child.maxwidth, child.contentwidth) : child.maxwidth;
+                if (child_maxwidth < Integer.MAX_VALUE) {
                     for(int i=0; i<coeff.length; i++)
                         coeff[i] = (i>=child.col && i<min(child.colspan+child.col, cols)) ? (float)1.0 : (float)0.0;
                     coeff[cols*2+childnum] = (float)-1.0;
-                    lp_h.add_constraint(coeff, LinearProgramming.EQ, (float)child.maxwidth);
+                    lp_h.add_constraint(coeff, LinearProgramming.EQ, (float)child_maxwidth);
                 }
                 for(int j=0; j<coeff.length; j++) coeff[j] = (float)0.0;
                 childnum++;