[TIMOB-12037] 2_1_X Ensure size and position flags are cleared on layout

Cherry Pick PR #3652 into 2_1_X