// Copyright 2004 Adam Megacz, see the COPYING file for licensing [GPL]
package org.ibex;
-// FEATURE: reflow before allowing js to read from width/height
-// FEATURE: fastpath for rows=1/cols=1
// FEATURE: mark to reflow starting with a certain child
-// FEATURE: separate mark_for_reflow and mark_for_resize
-// FEATURE: make all methods final
-// FEATURE: use a linked list for the "frontier" when packing
-// FEATURE: or else have a way to mark a column "same as last one"?
// FEATURE: reintroduce surface.abort
import java.util.*;
public void perform() throws JSExn {
if (texture == null) { Log.warn(Box.class, "perform() called with null texture"); return; }
if (texture.isLoaded) {
- setMinWidth(max(texture.width, maxwidth));
- setMinHeight(max(texture.height, maxheight));
+ setMinWidth(max(texture.width, minwidth));
+ setMinHeight(max(texture.height, minheight));
DIRTY; }
else { JS res = texture.stream; texture = null; throw new JSExn("image not found: "+res.unclone()); }
}
// Reflow ////////////////////////////////////////////////////////////////////////////////////////
+ /** should only be invoked on the root box */
+ void reflow() { pack(); resize(x, y, maxwidth, maxheight); place(); }
+
private static Box[] frontier = new Box[65535];
/** pack the boxes into rows and columns, compute contentwidth */
void pack() {
case "rows": return test(FIXED) == ROWS ? N(rows) : N(0);
case "colspan": return N(colspan);
case "rowspan": return N(rowspan);
- case "width": return N(width);
- case "height": return N(height);
+ case "width": getRoot().reflow(); return N(width);
+ case "height": getRoot().reflow(); return N(height);
case "minwidth": return N(minwidth);
case "maxwidth": return N(maxwidth);
case "minheight": return N(minheight);