- if (child.absolute || child.invisible) continue;
- int diff;
-
- //#repeat x/y y/x width/height col/row cols/rows colspan/rowspan colWidth/rowHeight maxwidth/maxheight minwidth/minheight contentwidth/contentheight colMaxWidth/rowMaxHeight hshrink/vshrink marginWidth/marginHeight
- child.width = 0; for(int i=child.col; i<child.colspan; i++) child.width += colWidth[i];
- diff = bound(child.contentwidth, child.width, child.hshrink ? child.contentwidth : child.maxwidth) - child.width;
- child.x = marginWidth / 2; for(int i=0; i<child.col; i++) child.x += colWidth[i];
- if (diff < 0) child.x += -1 * (diff / 2);
- //#end
-
- child.resize(child.x, child.y, child.width, child.height);
+ if (child.invisible) continue;
+ int child_x = 0, child_y = 0, child_width = 0, child_height = 0;
+ if (child.absolute) {
+ child_x = child.x;
+ child_y = child.y;
+ child_width = child.hshrink ? child.contentwidth : min(child.maxwidth, width - child.x - hpad);
+ child_height = child.vshrink ? child.contentheight : min(child.maxheight, height - child.y - vpad);
+ } else {
+ int diff;
+ //#repeat x/y y/x width/height col/row cols/rows colspan/rowspan colWidth/rowHeight maxwidth/maxheight minwidth/minheight contentwidth/contentheight colMaxWidth/rowMaxHeight hshrink/vshrink marginWidth/marginHeight hpad/vpad child_x/child_y child_width/child_height
+ child_width = 0; for(int i=child.col; i<child.col+child.colspan && i<colWidth.length; i++) child_width += colWidth[i];
+ diff = bound(child.contentwidth, child_width, child.hshrink ? child.contentwidth : child.maxwidth) - child_width;
+ child_x = max(hpad, marginWidth / 2); for(int i=0; i<child.col; i++) child_x += colWidth[i];
+ if (diff < 0) child_x += -1 * (diff / 2);
+ child_width += diff;
+ //#end
+ }
+ child.resize(child_x, child_y, child_width, child_height);