[OpenLayers-Dev] safari bug on window resize
Paul Spencer
pspencer at dmsolutions.ca
Tue Oct 30 20:29:00 EDT 2007
Chris,
On 30-Oct-07, at 5:19 PM, Christopher Schmidt wrote:
> 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:
>
> http://trac.openlayers.org/ticket/758
I've added a note to the ticket to the effect that the bug also
occurs on resize since the ticket only talks about baseLayer switching
>
>>
>> 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.
Right. The patch in the above ticket implements option 2 above.
Assuming that the patch is eventually reviewed and committed to
trunk, this will fix the problem that I am observing. However, it
doesn't answer the broader question of why we force a redraw of the
layers on a window resize.
On Safari, the resize event is emitted continuously. The cost of a
redraw is high enough that the window really chunks along during a
resize (at least on my machine).
If the reason for doing a redraw of the layers is to catch the case
where the window grows and the grid has to expand, then I think there
could be a lighter weight test that is done on resize before forcing
a redraw.
Is there another reason for the current behaviour?
Cheers
Paul
+-----------------------------------------------------------------+
|Paul Spencer pspencer at dmsolutions.ca |
+-----------------------------------------------------------------+
|Chief Technology Officer |
|DM Solutions Group Inc http://www.dmsolutions.ca/ |
+-----------------------------------------------------------------+
More information about the Dev
mailing list