float fwidth = size.width(), fheight = size.height();
if (fwidth > 0 && fheight > 0) return size;
// if either forced width or height is zero, use preferred size in that dimension
IDimension psize = layout.preferredSize(elem, fwidth, fheight);
if (fwidth > 0) return new Dimension(fwidth, psize.height());
else if (fheight > 0) return new Dimension(psize.width(), fheight);
else return psize;
}
public IPoint pos (float width, float height, IDimension prefSize) {
Point position = this.position.resolve(0, 0, width, height, new Point());