[webkit-dev] Background-image problems in iOS 4.3 (was: Matching iOS versions to webkit build numbers)

Sam Gentle sgentle at gmail.com
Sun Mar 13 07:32:50 PDT 2011


Alright. Now that the NDA is lifted, I'll give a bit more detail:

My app is an interactive book using a UIWebView inside a native app. The use
case is a series of pages, one displayed at a time. Each page has a
background image approximately 1MB in size and a number of smaller
(10-500kB) images displayed on top.

Since iOS Webkit has a (6MB? 10MB? - reports vary) memory limit on
<img>/Image()s, and never releases them, I'm using a workaround where I
maintain and recycle a pool of Image objects and assign them to a div using
background-image when they're loaded, similar to what's described here:
http://stackoverflow.com/questions/2986039/ipad-iphone-browser-crashing-when-loading-images-in-javascript

That was working fine under 4.2, except that in 4.3 background-image doesn't
work sometimes. I see the following behaviour during high memory use:

1. Sometimes a background-image will not load at all
2. Sometimes a background-image that has already been loaded will unload
3. Sometimes a background-image will half-load and then disappear
4. Sometimes a background-image will fully load, but then won't repaint if
an element above it moves (ie, the area that should be repainted is
transparent instead)

My theory is that somewhere between the two releases background-images have
been made a weak ref and they're being GCed. Is that possible? Is it
expected behaviour?

I'll attempt to put together a useful reduction soon (since at least the
non-repainting seems like a bug), but I'd like to get the app working again
and at this point I'm not sure how to. Is there a canonical way to load
images such that you are guaranteed that they'll be loaded? It seems that
canvas might be the right way forward, but I'd love if someone with a bit
more backend knowledge could give me some guidance.

Thanks very much,

Sam

On Tue, Mar 8, 2011 at 2:46 PM, Matt Lilek <mlilek at apple.com> wrote:

> iOS 4.3 is also still under NDA.  You should either file a bug at
> https://bugreport.apple.com and/or ask in the iOS 4.3 section of Apple's
> developer forums (https://devforums.apple.com).
>
> - Matt
>
> On Mar 7, 2011, at 7:33 PM, Sam Gentle wrote:
>
> Hi,
>
> I'm trying to hunt down a nasty image corruption bug that showed up on my
> web app in the iOS 4.3 GM. Is there a way to find out what webkit build it's
> using so I can try to reproduce it? The best reference I can find is
> http://en.wikipedia.org/wiki/Safari_version_history#iOS, but it has no
> information about 4.3.
>
> Thanks,
>
> Sam
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20110314/891ee972/attachment.html>


More information about the webkit-dev mailing list