Merge "Move grid checking into the layout algorithm." into nyc-mr2-dev
am: c87fcb0963

Change-Id: I5f2a91b5f52f2dd3ebc564c127a1f939a4bc20a4