measure sizes before rendering (fixed issue on Chrome)