Minecraft wiki entry for Vines, associated text: If the air block in the target direction has something vines could be placed on above it, spread to the top side of the air block.
If the block in the target direction is opaque and fills its whole cube, spread to that side of the ticked vine block.