I have a webview that shows some animated boxes, but it slows down and lags horribly when I put a drop shadow in the view. Without the shadow, the webview contents animate smoothly.
I achieved a similar effect as safari/chrome when you do a elastic scroll with the touchpad. Looks nice! But doesnt run as smooth as in my inspirations.
Here is the snippet of the shadow setting:
NSShadow *dropShadow = [[NSShadow alloc] init];
[dropShadow setShadowColor:[NSColor blackColor]];
[dropShadow setShadowOffset:NSMakeSize(0, 0)];
[dropShadow setShadowBlurRadius:5.0];
[webview setWantsLayer: YES];
[webview setShadow: dropShadow];
[dropShadow release];
—
My question is: How can I work around this problem?
You should not call
setWantsLayer:YESon aWebView. Layer-backed web views are unsupported. This was actually pointed out in the 10.5 release notes and has not changed, unfortunately. You’ll need to come up with an alternative solution.