[OpenLayers-Dev] safari bug on window resize

Christopher Schmidt crschmidt at metacarta.com
Tue Oct 30 17:19:32 EDT 2007

On Tue, Oct 30, 2007 at 04:45:56PM -0400, Paul Spencer wrote:
> Devs,
> there seems to be a bug in Safari 3 (not sure about 2) with trunk  
> where a window resize causes the tiles to disappear.  Zak and I  
> tracked this down to the fact that Safari does not trigger an onload  
> event on the image when you set the .src of the image and it is not  
> different from the current src.

Yes, I've discussed this on the list before, a couple weeks ago:

> But all this leads me to question what is happening if we are setting  
> the source to the same image?
> It appears that a window resize is causing the map to redraw as if  
> the zoom level has changed.  This causes all the tiles to get  
> cleared.  I don't understand why this is necessary.  There is code in  
> setCenter to just move the layer container if the zoom hasn't changed  
> and this seems like a reasonable thing, so why is updateSize forcing  
> the zoom to change?
> I am willing to put together a patch if I can get some feedback on  
> what the right solution would be:
> 1. clear src just before setting it
> 2. clear src in the clear function when we hide the imgDiv
> 3. only set the src if the new url is different from the old url,  
> otherwise just show the imgDiv again
> 4. change updateSize in Map to not force a zoom level change

This won't fix the problem in its entirity -- base layer switching will
still cause the problem. 

Christopher Schmidt

More information about the Dev mailing list