Allow layers to mask children to their boundaries

This allows preventing iframes from overlowing their boundaries.
Add a helper method for setting root layer size

This will be used by the compositor so that the top-level root layer
can track window size.