issue #4861. cleanup some code of UILayout and UIWidget