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.
My first instinct is that textResult.textFits should encapsulate the addition of code here.  Why is this not the case?