migrate prepareForDraw to enterDocument