Introduce a phantom type to prevent script from unsafely accessing the layout data

See the explanation on the commit for more detail.

r? @metajack