-webkit-border-radius
Instead of generating rounded corners dynamically, use -webkit-border-image and specify an image with rounded corners.
-webkit-gradient
Instead of generating a gradient dynamically, create an image gradient and set it as the background of your body or div.