From: megacz Date: Fri, 30 Jan 2004 07:41:21 +0000 (+0000) Subject: 2003/11/13 10:23:10 X-Git-Tag: RC3~352 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=679661c1f27b31d928d20edf698cb22adb086b17;p=org.ibex.core.git 2003/11/13 10:23:10 darcs-hash:20040130074121-2ba56-66926936fbd0575d2f399b3cc1fa6775f5f68f51.gz --- diff --git a/src/org/xwt/Box.java b/src/org/xwt/Box.java index 2f6a322..60f1fbd 100644 --- a/src/org/xwt/Box.java +++ b/src/org/xwt/Box.java @@ -179,10 +179,11 @@ public abstract class Box extends JSScope implements JSTrap.JSTrappable { // static stuff so we don't have to keep reallocating private static int[] numRowsInCol = new int[65535]; - private LENGTH[] colWidth = new LENGTH[65535]; - private LENGTH[] colMaxWidth = new LENGTH[65535]; - private LENGTH[] rowHeight = new LENGTH[65535]; - private LENGTH[] rowMaxHeight = new LENGTH[65535]; + private static LENGTH[] colWidth = new LENGTH[65535]; + private static LENGTH[] colMaxWidth = new LENGTH[65535]; + private static LENGTH[] rowHeight = new LENGTH[65535]; + private static LENGTH[] rowMaxHeight = new LENGTH[65535]; + static { for(int i=0; i 0) resize_children(); } private void resize_children() { int slack; - //#repeat col/row colspan/rowspan contentwidth/contentheight x/y width/height \ - // HSHRINK/VSHRINK maxwidth/maxheight cols/rows minwidth/minheight + //#repeat col/row colspan/rowspan contentwidth/contentheight x/y width/height colMaxWidth/rowMaxHeight \ + // HSHRINK/VSHRINK maxwidth/maxheight cols/rows minwidth/minheight colWidth/rowHeight // PHASE 1: compute column min/max sizes slack = 0; for(Box child = firstPackedChild(); child != null; child = child.nextPackedSibling()) @@ -272,29 +269,37 @@ public abstract class Box extends JSScope implements JSTrap.JSTrappable { colWidth[col] += diff; } } + //#end - for(Box child = getChild(0); child != null; child = child.nextPackedSibling()) { - int unbounded = 0; + // Phase 3: assign childrens' actual sizes + for(Box child = getChild(0); child != null; child = child.nextSibling()) { + if (!child.test(VISIBLE)) continue; + if (!child.test(PACKED)) { + child.resize(child.x, child.y, + child.test(HSHRINK) ? child.contentwidth : min(child.maxwidth, width - child.x), + child.test(VSHRINK) ? child.contentheight : min(child.maxheight, height - child.y)); + continue; + } + int unbounded; + //#repeat col/row colspan/rowspan contentwidth/contentheight width/height colMaxWidth/rowMaxHeight child_x/child_y \ + // x/y HSHRINK/VSHRINK maxwidth/maxheight cols/rows minwidth/minheight colWidth/rowHeight child_width/child_height + unbounded = 0; for(int i = child.col; i < child.col + child.colspan; i++) unbounded += colWidth[i]; - child.width = bound(child.contentwidth, unbounded, child.test(HSHRINK) ? child.contentwidth : child.maxwidth); - child.x = test(ALIGN_RIGHT) ? slack : test(ALIGN_LEFT) ? slack / 2 : 0; - for(int i=0; i < child.col; i++) child.x += colWidth[i]; - if (child.width < unbounded) child.x += (child.width - unbounded) / 2; + int child_width = bound(child.contentwidth, unbounded, child.test(HSHRINK) ? child.contentwidth : child.maxwidth); + int child_x = test(ALIGN_RIGHT) ? slack : test(ALIGN_LEFT) ? slack / 2 : 0; + for(int i=0; i < child.col; i++) child_x += colWidth[i]; + if (child_width < unbounded) child_x += (child_width - unbounded) / 2; + //#end + child.resize(child_x, child_y, child_width, child_height); } // cleanup - for(int i=0; i diff --git a/src/org/xwt/js/JSFunction.java b/src/org/xwt/js/JSFunction.java index 11f8031..0aabebf 100644 --- a/src/org/xwt/js/JSFunction.java +++ b/src/org/xwt/js/JSFunction.java @@ -327,13 +327,9 @@ public class JSFunction extends JSCallable implements ByteCodes, Tokens { method = o; if (method == null) throw new JS.Exn("cannot call the null method"); o = cx.stack.pop(); - System.out.println("o == " + o); - System.out.println("method == " + method); if(o instanceof String || o instanceof Number || o instanceof Boolean) { arguments = new JSArray(); for(int j=numArgs - 1; j >= 0; j--) arguments.setElementAt(cx.stack.pop(), j); - System.out.println(cx.f.dump()); - System.out.println(cx.pc); ret = Internal.callMethodOnPrimitive(o, method, arguments); cx.stack.push(ret); cx.pc += 2; // skip the GET and CALL