Re: WebView in a layer view hierarchy - not working on Snow Leopard
Re: WebView in a layer view hierarchy - not working on Snow Leopard
- Subject: Re: WebView in a layer view hierarchy - not working on Snow Leopard
- From: Mike Abdullah <email@hidden>
- Date: Sun, 25 Oct 2009 10:30:07 +0000
That's because it's a private method. Have a look at the WebKit source
– WebUIDelegatePrivate.h
It's been there since WebKit 3.0 so will probably be around for a
while to come. And at worst, WebKit will just stop calling your method
and you'll have to find something else (or include a custom build of
WebKit).
Final option is to use an overlay window.
On 24 Oct 2009, at 20:27, Luke Evans wrote:
Oh-oh. OK, 'tis as I feared then - I was living on a wing and a
prayer with Leopard (which did work perfectly in this regard to my
use of WebView in a layer-backed view hierarchy - i.e. at the bottom
of the stack).
I took a look at WebUIDelegate (as I think I had done a long while
back, while playing with how to draw over the top of web content).
I can't see from the docs how to use such a delegate to draw over
the web content. The delegate seems to be empowered to control a
lot of the expected user interactions, but I'm not sure how you
would draw with it.
BTW, I tried subclassing WebView when I was playing with it, way
back, but couldn't get the subclass to draw the web content before
my annotations. At the time I just called the superclass draw
method and then attempted to draw the annotations. Maybe I was
being too simplistic about it, and that having my own graphics
context or something would have made that work.
On 2009-10-24, at 3:36 AM, Mike Abdullah wrote:
WebView's don't support being layer-backed. But there is a private
WebUIDelegate method that will let you achieve what you want:
- (void)webView:(WebView *)sender didDrawRect:(NSRect)rect;
On 24 Oct 2009, at 00:53, Luke Evans wrote:
I have an app that plain stopped working between Leopard and Snow
Leopard.
This app relies on placing a WebView component in a Core Animation
layer view hierarchy (i.e. "Needs Core Animation Layer" flag is
turned on for this view and its superviews), so that I can draw
annotations over the web content with a mostly-transparent 'glass
view' in a layer above.
What I've found so far is that if I turn off the "Needs Layer"
flag on the WebView and all its superviews, then the web content
is visible. If I leave this flag on however, then all I get is a
plain white area, with no web content visible (though this
continues to be loaded).
I have logged this as a bug already - mostly because its a
behaviour change between Leopard and Snow Leopard, and I have not
found any documentation that indicate this is an intentional change.
However, it _might_ be intentional, or possibly I was already
flying by the seat of my pants to have it working in the first
place. In any case, perhaps somebody has some concrete knowledge
on the subject...?
Cheers
-- Luke
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden