Yes, there's no specific rule against it but then again, neither is there a rule aginst getting married during a changeover or playing a guitar solo. I presume the doper Williams did it partly to break the concentration of the other doper, Pennetta, having just been trounced six love. It certainly worked.
To me, the real significance of this incident is just how sloppy the professional game has become, the women's game in particular. What with: towelling down (another cheat, particularly when a receiver does it to slow the server); fake medical timeouts; contrived exchanges over umpiring decisions; blatent disregard for 'play shall be continuous' - now known as the 20 second rule; the blind eye paid to the ridiculous level of screaming that goes on in WTA matches plus of course their celebrity coaches who come on to administer 'advice' during changeovers, the game is slowly morphing into a rather faux extension of showbiz. Under the cloak of this casual, cavalier attitude of players, smilingly overlooked by tolerant, obliging officials, comes the dark side, the doping that goes on underneath, the bit the public are never allowed to see.
If I want real showmanship I'd rather pay fifty quid to go and watch Muse perform live. When it comes to tennis I want to watch players who perform and suffer for their money rather then the kind of indulgent 'stuff' thrown up by Williams and her fellow dopers.