Fix layout engine issues.

Right now, layout engine will not stop iterating after everybody is
satisfied. Termination will occur only after 5 iterations or there are
no space left. This apporach fixes issue with compotent, which can be
wrapped.

Category axis didn't took into account offered width/hight when checking
if it fits.

Close #936, #1207.
ok this makes sense, looks like a straightforward bugfix