Move grid checking into the layout algorithm.

We move grid layout checking into the layout algorithm, so that we can
hide more computation from the views.

Bug: 32101881

Change-Id: I174fe33ef7ed3c04987771dbb42d831a4b9bdab2
5 files changed