[webkit-help] Forcing image reload in WebKit

Seweryn Pływaczyk s.plywaczyk at gmail.com
Fri Mar 5 07:42:14 PST 2010


Maybe it is not directly answer for your question but maybe it will help :)

I had a similar problem I mean I didn't want to load whole page but I wanted
to split loading process to two steps:
1. Load body and css
2. After it load only images

It is usefull in case of slow Internet connection you can stop loading when
you want read just text.

Anyway in order to do that I had to set


In my WebFrame client in postProgressFinishedNotification (it is a
notification sent when whole page is loaded) I call

DocLoader::setAutoLoadImages(true); - it causes that every image on the page
is loaded

and then after all I call DocLoader::setAutoLoadImages(false); to prevent
auto loading images.

Of course I have some logic but it is my solution dependent.

You have to remember that DocLoader::setAutoLoadImages should be called per
every loaded frame for example:

          while (frame)
                if (frame->tree())
                    if (frame->document() && frame->document()->docLoader())

                    frame =

So you could use similar mechanism. Notice that images can be get from

Look at the implementation of DocLoader::setAutoLoadImages and see how
images are get and you can then just load them by using Frame loader instead
of Cache loade.

Good luck

On 5 March 2010 13:06, MT <mt at theescapers.com> wrote:

> Hi,
> I use a WebView that loads a HTML file that uses various resources like
> images, CSS files etc...
> Sometimes, the images can change, and I want the WebView to reflect that,
> but I don't want to refresh the entire page, just let a DOMHTMLImageElement
> to reload the image.
> At the moment, I'm changing the 'src' attribute of the DOMHTMLImageElement
> to nothing, then changing it back using an NSTimer to the correct URL. This,
> in principle, works, but is unreliable, often crashing.
> #1  0x0097d840 in WebCore::CSSParser::parseValue (this=0xbfffe354,
> declaration=0x161d0900, id=1005, string=@0xbfffe484, important=false) at
> /Users/mt/Downloads/WebKit-r53845/WebCore/css/CSSParser.cpp:253
> #2  0x00974d33 in WebCore::CSSMutableStyleDeclaration::setProperty
> (this=0x161d0900, propertyID=1005, value=@0xbfffe484, important=<value
> temporarily unavailable, due to optimizations>, notifyChanged=true) at
> /Users/mt/Downloads/WebKit-r53845/WebCore/css/CSSMutableStyleDeclaration.cpp:534
> #3  0x00a1e4e7 in ~RefPtr [inlined] () at
> /Users/mt/Downloads/WebKit-r53845/WebKitBuild/Release/DerivedSources/WebCore/DOMCSSStyleDeclaration.mm:118
> #4  ~String [inlined] () at text/PlatformString.h:53
> #5  ~String [inlined] () at
> /Users/mt/Downloads/WebKit-r53845/WebCore/platform/text/PlatformString.h:66
> #6  0x00a1e4e7 in -[DOMCSSStyleDeclaration setProperty:value:priority:]
> (self=0xfb76790, _cmd=0x918f7781, propertyName=0x183e88, value=0x13f78e18,
> priority=0x1815c8) at
> /Users/mt/Downloads/WebKit-r53845/WebKitBuild/Release/DerivedSources/WebCore/DOMCSSStyleDeclaration.mm:118
> #7  0x00035b55 in -[WindowController putImageInDivBack:] (self=0x29dd200,
> _cmd=0x152af9, bits=0xf8b5e50) at
> /Volumes/test/WorkingCopy2/WindowController.m:1550
> Is there a better, cleaner way to do this?
> Thanks for any ideas.
> MT
> _______________________________________________
> webkit-help mailing list
> webkit-help at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20100305/f6784a39/attachment.html>

More information about the webkit-help mailing list