Improve static analysis problems in layout-utils.js