Recursively build up a layout stack.