WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
14623
Need drawRect called on WebView subclass
https://bugs.webkit.org/show_bug.cgi?id=14623
Summary
Need drawRect called on WebView subclass
Jim Casper
Reported
2007-07-14 22:23:37 PDT
I have found (along with others in the past) that drawRect is not called on subclasses of WebView because the normal AppKit view drawing is bypassed. I would like to request that drawRect be called on WebView subclasses or a replacement method introduced so that drawing on top of a WebView can be done. My needs in this case are pretty simple - I just want to draw a highlighting frame around the view borders indicating that the view is a drop target for drag and drop.
Attachments
Minimal test app demonstrating drawRect not getting called in WebView subclass
(30.68 KB, application/octet-stream)
2007-07-15 15:39 PDT
,
Jim Casper
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Mark Rowe (bdash)
Comment 1
2007-07-15 09:45:22 PDT
A very simple workaround would be to use an overlay window, similar to how the web inspector highlights the "active" node in a document. Looking at the WebView implementation, it doesn't implement drawRect: itself nor does it appear to prevent it from being called. The real drawing work is done by subviews such as WebFrameView and WebHTMLView. It's not clear from my quick flick through the code why what you describe would not work.
Jim Casper
Comment 2
2007-07-15 14:14:23 PDT
(In reply to
comment #1
)
> A very simple workaround would be to use an overlay window, similar to how the > web inspector highlights the "active" node in a document. Looking at the > WebView implementation, it doesn't implement drawRect: itself nor does it > appear to prevent it from being called. The real drawing work is done by > subviews such as WebFrameView and WebHTMLView. It's not clear from my quick > flick through the code why what you describe would not work. >
I don't pretend to understand the inner workings of WebKit, but I did find on Google someone who mentioned WebKit bypassing the normal AppKit flow. I found in the file WebHTMLView.mm the following: // Don't let AppKit even draw subviews. We take care of that. - (void)_recursiveDisplayRectIfNeededIgnoringOpacity: I did not find anything that would prevent WebView's drawRect from being called, but in a small test project I again found it to not be called. I'll give your overlay method a try. Thanks for your quick reply.
Mark Rowe (bdash)
Comment 3
2007-07-15 15:07:42 PDT
WebHTMLView is a subview of the WebView, so I don't think it's trickery using _recursiveDisplayRectIfNeededIgnoringOpacity can interfere with the rendering of WebView itself. It'd be great if you could attach a minimal application demonstrating an attempt to override drawRect: so we're both looking at the same situation.
Jim Casper
Comment 4
2007-07-15 15:39:18 PDT
Created
attachment 15525
[details]
Minimal test app demonstrating drawRect not getting called in WebView subclass
Jim Casper
Comment 5
2007-07-15 15:41:40 PDT
Comment on
attachment 15525
[details]
Minimal test app demonstrating drawRect not getting called in WebView subclass After thinking about it more, drawRect probably won't help me anyway since I need to draw on top of subviews, not under them. I will go with your overlay window method.
Mark Rowe (bdash)
Comment 6
2007-09-16 02:48:10 PDT
<
rdar://problem/5484863
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug