We can treat one variable delta function as
$$\delta(f(x)) = \sum_i\frac{1}{|\frac{df}{dx}|_{x=x_i}} \delta(x-x_i).$$
Then how do we treat two variable delta function, such as $\delta(f(x,y))$?
for example, how calculate $\int\int \delta(x-y)$ ?
I first thought using $\int f(x)\delta(x-y)dx = f(y)$
$$\int\int \delta(x-y)dxdy = \int\int1 * \delta(x-y)dx dy = \int dy.$$
but this is nonsense, since we can also think it as $\int\int \delta(x-y)dxdy = \int dx$
The simplest way to start is to think about how the delta function is defined in 1D, $$\int_{-\infty}^{\infty} f(x)\delta(x-a)dx = f(a)$$ which you correctly identified above. This is saying that some function $f(x)$ multiplied by the a shifted delta function $\delta(x-a)$ and integrated everywhere returns the same function evaluated at the value given by the shift, $f(a)$. We want the same sort of definition to apply when we integrate everywhere in 2D, so we have to have a 2-variable function $f(x,y)$ and it has to have a 2-variable delta function $\delta(x,y)$. (Notice that $\delta(x-y)\neq \delta(x,y)$ in general.) Applying it to the 2D case in this way we should give $$\int_{-\infty}^{\infty} \int_{-\infty}^{\infty} f(x,y)\delta(x-a,y-b) \ dx dy = f(a,b)$$
which should be true whether you integrate either $x$ or $y$ first as shown below.
$$\int_{-\infty}^{\infty} \int_{-\infty}^{\infty} f(x,y)\delta(x-a,y-b) \ dx dy = \int_{-\infty}^{\infty} f(a,y)\delta(y-b) \ dy = f(a,b)$$
$$\int_{-\infty}^{\infty} \int_{-\infty}^{\infty} f(x,y)\delta(x-a,y-b) \ dx dy = \int_{-\infty}^{\infty} f(x,b)\delta(x-a) \ dx = f(a,b)$$
These are easiest to solve when $f(x,y)$ is a separable function like $f(x,y)=g(x) h(y)$, but some harder functions are still quite doable.