Let $\mathbf{w}(t)$ be the trajectory of a moving charge. Let the observation event be $(\mathbf{r},t)$.
The scalar potential is:
$$\varphi = \frac{q}{4\pi\epsilon_0}\int \frac{\delta\left(\mathbf{r'} - \mathbf{w}\left(t - \frac{|\mathbf{r} - \mathbf{r'}|}{c}\right)\right)}{|\mathbf{r'}-\mathbf{r}|} \mathrm d^3\mathbf{r'}$$
It can be shown that at most only ONE event on the trajectory of the charge produces the potential at the observation event. This is the event $(\mathbf{w}(t_r),t_r)$, where $t_r$ is such that $|\mathbf{r}-\mathbf{w}(t_r)| = c(t-t_r)$.
Because the delta function is 0 apart from at one point, it seems to make sense that $\mathbf{w}(t_r)$ must be the point that it picks out. Is it then legitimate to write the scalar potential as:
$$\varphi = \frac{q}{4\pi\epsilon_0|\mathbf{r} - \mathbf{w}(t_r)|}\int \delta\left(\mathbf{r'} - \mathbf{w}\left(t - \frac{|\mathbf{r} - \mathbf{r'}|}{c}\right)\right) \mathrm d^3\mathbf{r'}\;?$$
If not, why not? And what is the best way to calculate the remaining delta function integral?