Correctly resolve document selection into a set of layers