[webkit-dev] Most methods in WebUIDelegate are not getting called

Geoffrey Garen ggaren at apple.com
Fri Jul 27 13:24:38 PDT 2007


setContentRect: is only called when opening a new window through  
JavaScript, and only with Safari 2.

In general, these methods are not notifications -- they are requests.  
So, for example, a user resize of the window may change the WebView's  
contentRect but, because the user  -- not WebKit -- requested the  
change, you will not receive a setContentRect: call.

NSView has notifications about frame and bounds changes. Perhaps  
those will solve your problem. See, for example, +[NSView  
setPostsFrameChangedNotifications:].

Geoff

On Jul 27, 2007, at 12:37 PM, piet wrote:

> I need to know when the contentRect of a WebView changes so I added  
> a  WebUIDelegate listening to setContentRect:.
>
> Problem: setContentRect: is never called.
>
> I added more methods to the WebUIDelegate, listening to show/close,  
> focus/unfocus, set status text, set frame/content and mouse-move,  
> but none of them gets called except for mouse-move  
> (mouseDidMoveOverElement:).
>
> Is there anything wrong with my code? I tested with both Safari 2  
> and Safari 3. For a minimal testcase, you can add the following  
> code to /Developer/Examples/WebKit/MiniBrowser/MyDocument.m, line  
> 263. The only output to the console comes from the NSLog() in  
> mouseDidMoveOverElement:
>
> - (void)webViewClose:(WebView *)sender
> {
>     NSLog(@"WebView UI delegate:webViewClose");
> }
>
> - (void)webViewFocus:(WebView *)sender
> {
>     NSLog(@"WebView UI delegate:webViewFocus");
> }
>
> - (void)webViewUnfocus:(WebView *)sender
> {
>     NSLog(@"WebView UI delegate:webViewUnfocus");
> }
>
> - (void)webView:(WebView *)sender setStatusText:(NSString *)text
> {
>     NSLog(@"WebView UI delegate:setStatusText %@", text);
> }
>
> - (void)webView:(WebView *)sender setFrame:(NSRect)frame
> {
>     NSLog(@"WebView UI delegate:setFrame w=%f h=%f",  
> frame.size.width, frame.size.height);
> }
>
> - (void)webView:(WebView *)sender setContentRect:(NSRect)contentRect
> {
>     NSLog(@"WebView UI delegate:setContentRect w=%f h=%f",  
> contentRect.size.width, contentRect.size.height);
> }
>
> - (void)webView:(WebView *)sender mouseDidMoveOverElement: 
> (NSDictionary *)elementInformation modifierFlags:(unsigned int) 
> modifierFlags
> {
>     NSLog(@"WebView UI delegate:mouseDidMoveOverElement");
> }
>
>
> Get the free Yahoo! toolbar and rest assured with the added  
> security of spyware protection.
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo/webkit-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/webkit-dev/attachments/20070727/05e7db08/attachment.html


More information about the webkit-dev mailing list