In the case of Bowers vs. Hardwick being reversed in Lawrence vs. Texas, changing public attitudes had nothing to do with it. After the 2004 election the Wall Street Journal had an excellent editorial "The Blue State Court", noting how 11 states had public questions on their ballots regarding prohibiting
same sex marriage and affirming the traditional definition, in all 11 states- both Red and Blue- the voters approved consitutional amendments so doing. Rather too much of the work of the SCOTUS is actually done by the law clerks who are drawn too heavily from the elite law schools where homosexuals are over represented and have more clout. The liberals honked and whined and worked to reverse Bowers before the ink was dry on the opinion.