API call to replace parts in html

Carsten Burghardt carsten at cburghardt.com
Sun Jun 27 12:20:46 BST 2004


On Tuesday 22 June 2004 00:32, Zack Rusin wrote:
> On Friday 07 May 2004 13:53, Carsten Burghardt wrote:
> > Hi,
> >
> > when an email (html page in this case) is displayed in kmail that
> > contains images and you selected an inline attachment style those
> > images are displayed. They reference a tmp file (<img
> > src="file://...>). Now if you use imap and activate load-on-demand
> > those images exist but are empty. They get loaded one by one and with
> > each image the email is completely repainted which is extremely ugly.
> > So I want khtml to repaint the page once the image is complete so
> > that it doesn't flicker that much. Is there anything that could be
> > used for this? Replace the image, tell the node to repaint, tell the
> > complete page to repaint, ...? A generic approach would be very good
> > as this might also be used for other parts e.g. text attachments
> > (<div> or <p> in this case AFAIK).
>
> Well, the simplest and most effective solution would be to simply cache
> the email contents somewhere and when the images are there post a
> reload request to the KHTMLPart browserextension:)
>
> Otherwise you can:
> 1) disable autoloading images before constructing any img elements but
> after constructing the document itself with
> m_part->setAutoloadImages( false );
> 2) when you have all images call m_part->setAutoloadImages( true );
> 3) call m_part->htmlDocument().updateRendering(); and
> m_part->view()->layout(); to relayout the document.

Thanks Zack. It seems I found a khtml bug that is preventing all this. As it 
didn't work with kmail I created some small test cases with testkhtml.
If you load an html page that contains broken images with open() and then 
update each of them with Node.applyChanges() and afterwards do 
htmlDocument().updateRendering() the page is updated correctly.
If you do the same with a document that is created with begin() - write() - 
end() it doesn't update. I even tried to disable autoloading like you 
proposed but it doesn't change anything.
I don't know if it flickers less when I do a reload request - compared to a 
new construction of the page. But even then I don't know how to reload a page 
that was created with write() requests.


Carsten




More information about the kfm-devel mailing list