25 Feb 2006

subclassing WebView

here's something i learned today after an hour of fiddling around with subclassing WebView (from WebKit) and by looking at the code inside open source webkit project.

to subclass WebView and draw stuff on top of it, you can't just override drawRect: because WebView (more specifically WebHTMLView) uses this NSView private function to prevent NSView iterating through the WebFrame hierarchy:

- (void)_recursiveDisplayRectIfNeededIgnoringOpacity:(NSRect)rect 
rectIsVisibleRectForView:(NSView *)visibleView

(read: WebKit/WebKit/WebView/WebHTMLView.m)

probably some people already know this, like the shiira or adium people, but i couldn't for the life of me get google to tell me. trawling the apple mailing lists didn't help at all either. there were some people suggesting that it would work on the lists, but no follow-up was ever made.

now i'll continue with my evil plans ..

You can reply to me about this on Twitter: