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, Wikipedia, etc.

r? @glennw