Correctly handle groups as clipping masks.

Closes #370.