Allow layers to mask children to their boundaries

This allows preventing iframes from overlowing their boundaries. We
also ensure that buffer requests are made for child layers, even when
their parents don't overlap the window rect. This is because children
can lie completely outside the bounds of their parents.
I think the best thing to do here would be to improve the helper methods on Rect so that this can be done in one simple line. I'll look into doing that.