Integral with DiracDelta. Can Mathematica be made to solve this?

You need to give Integrate assumptions:

Integrate[DiracDelta[Sin[θ]^2-x], {θ, 0, 2 π}, Assumptions -> 0<x<1]

2/Sqrt[-(-1 + x) x]

Unfortunately, Integrate is not quite smart enough to use the assumption x ∈ Reals:

Integrate[DiracDelta[Sin[θ]^2-x], {θ, 0, 2 π}, Assumptions -> x ∈ Reals]

Integrate[DiracDelta[-x + Sin[θ]^2], {θ, 0, 2 π}, Assumptions -> x ∈ Reals]


f[θ_, x_] := Sin[θ]^2 - x
Derivative[1, 0][f][θ, x] /. Solve[{f[θ, x] == 0, 0 < θ < 2 π}, θ, Reals]
Integrate[DiracDelta[x - θ]/Abs[%], {θ, 0, 2 π}] // Total

enter image description here

This code should also work for other functions $f$, presumably.