gfx: Clip the background properly when `border-radius` is used, and clean up some painting stuff.

Together these improve a large number of sites: GitHub, Reddit, etc.

r? @glennw