My friend R’ Chaim Markowitz recently posted on the topic of fasting a ta’anis chalom on Shabbos. Rishonim explain that the ta’anis is permissible because the issur of fasting is based on a consideration for oneg shabbos; where one feels so distressed that sitting down for a meal would cause discomfort, a meal is no longer oneg. I added in a comment to his discussion that the Ohr Sameich quotes a chiddush of the Mabi”t that the issur of fasting on Shabbos only applies (m’divrei kabbalah) if one fasts the entire day, sundown to sundown. A ta’anis chalom requires fasting only from morning to night.
This chiddush, as the Ohr Sameich explains, sheds light on the gemara (meg 5b) which tells us that Rebbi wanted to abolish the fast 9 Av when it fell on Shabbos – since the fast must be nidche anyway, it can (in Rebbi’s view) be completely done away with. The same issue should have come up with respect to 17 Tamuz which would also have fallen on Shabbos three weeks earlier, but we have no record of Rebbi wanting to abolish that fast (see R’ Y. Emden on the daf). The O.C. writes that there is a crucial distinction – the fast of 9 Av cannot be done on Shabbos, as a 24 hour fast is prohibited m’divrei kabbalah; the fast of 17 Tamuz could theoretically could be fulfilled on Shabbos as it does not prohibit eating at night.
This also explains the famous opinion of the Avudraham that should 10 Teves fall on Shabbos (which it never does) there would be an obligation to fast. Again, since eating would be permitted on Friday night, the fast would not violate the issur of ta’anis on Shabbos. (I am not sure that the O.C. makes of the Avudraham’s statement that since the fast of 10 Teves is defined as “etzem hayom hazeh” it must be done even on Shabbos – the derasha seems to have little to do with the logic he is suggesting).