Created by: fred-wang
I've extracted these changes and verified that the rendering issues are fixed on my test case.