API call to replace parts in html

Carsten Burghardt carsten at cburghardt.com
Sun Jun 20 13:44:21 BST 2004


On Monday 10 May 2004 09:40, Kevin Krammer wrote:
> On Monday 10 May 2004 00:09, Carsten Burghardt wrote:
> > On Sunday 09 May 2004 12:37, Kevin Krammer wrote:
> > > On Friday 07 May 2004 19: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.
> > >
> > > Hmm, how is this handled in Konqueror?
> > > KHTML loads images one-by-one as well when being used as the browser.
> >
> > But it doesn't reload them, doesn't it?
>
> No, don' think so.
> But it sounds like a similar situation: at the time the page is loaded the
> images are not available yet, but they get displayed once they are.
> Perhaps this only works if the page loading and the image loading uses the
> same IO slave.

The difference is that konq loads the images once. In my case they're already 
there but broken at first.

> > > > 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).
> > >
> > > DOM::Node::applyChanges() might work.

This doesn't seem to do anything. Is there any precondition so that 
applyChanges actually does something?

> > OK, but how to get the changes into the page? I think I need something to
> > either tell khtml to update the complete page or even better to only
> > reload one part.
>
> Maybe DOM::Document::updateRendering() helps.

This seems to load ...something. I have an html page that contains images that 
refer to local files. When this page (the mail) is loaded the first time 
these images have a 0 size so they appear broken. Now I replace these images 
with the correct ones and call updateRendering(). Some of the images are 
loaded correctly, some not. And when I switch to a different email and then 
back they all remain broken.

Perhaps I can reload the complete page. It's constructed with begin() and 
several write(), is there a way to reload?

> Hmm, how about skipping the img elements on page creation and inserting
> them once the respective image becomes available?

This is not an option as I can't produce new html.


Carsten




More information about the kfm-devel mailing list