No, it is illegal because the people of California, as far as I am concerned had voted a low to make marriage to be something between a man and a woman. If there was no such law, then what the mayor of San Francisco is doing would no be illegal. However, because there is such a law that defines marriage for man and woman, it is illegal.