Reload doesn't keep scroll position

David Faure faure at kde.org
Fri Jun 18 20:32:34 BST 2004


On Friday 18 June 2004 20:50, Leo Savernik wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hello,
> 
> As there are some movements wrt to correctly jump to an anchor, I thought I 
> could tackle bug 32639: jump on right place in page on reload. But it's not 
> as easy as it seems.
> 
> Though within KHTMLPart::openURL and the related slots the URLArgs can be used 
> for testing whether a page is to be reloaded, it's unclear how to save the 
> coordinates from the old rendering to the new one.

It works in KonqListView. 

Here's what it does in openURL:

   KParts::URLArgs args = extension()->urlArgs();
   if ( args.reload )
   {
      args.xOffset = contentsX();
      args.yOffset = contentsY();
      extension()->setURLArgs( args );
   }
   <then open the url>

and when rendering is done:

      if ( m_restored || extension()->urlArgs().reload )
         setContentsPos( extension()->urlArgs().xOffset, extension()->urlArgs().yOffset );

(m_restored is set by restoreState(), this bit might be different in khtml)

Hope this helps.

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kfm-devel mailing list