Fixes #12564 (HorizontalLayout breaks w/ alignment & error indicator)

Removed some obsolete (hopefully!?) code doing some odd things with caption height calculation  and some refactoring to make that part of code slightly more readable. 

Change-Id: I960e4a9eba0388281868f18a182c8788cedf08f9