Have the layout validated before running scripts when loading a GUI file.

This change allows scripts to have access to layout information when executing.
Fix a bug where the size of a parent element would sometimes be incorrectly calculated.

This only happened when the parent was invisible, but an auto-sized child was visible.