Two ways come to mind.
1. Draw x, then y objects. Then check all the pixels to see if any of x is still visible.
2. Subtract the y shapes from the x shape. It's then covered if the resultant shape has no area.
Both aren't too easy. The first one could be done using the third party canvas object, but it would be slow to check all the pixels, and you'd want to make the objects have only one color.
The second idea can get rather complex, but it can be made simpler if you limit the objects to unrotated boxes.