When is KHTMLView done with rendering?

Jeroen Wijnhout Jeroen.Wijnhout at kdemail.net
Wed Jun 16 13:50:18 BST 2004


Hi,


I would like to tackle:
[Bug 57360] URLs with anchor - sometimes the position is not moved to the 
anchor

AFAICS the problem lies in KHTMLPart::checkCompleted. In this method a check 
is done for html refs and gotoAnchor is called. However, if the document is 
not rendered completely, the position of the anchor is not known, causing 
KHTML to jump to the wrong position (usually this is position (0,0), so 
nothing happens, but in principle the behavior is random).

So instead of (line 2036 of khtml_part.cpp):
 if ( !m_url.encodedHtmlRef().isEmpty() )
    if ( !gotoAnchor( m_url.encodedHtmlRef()) )
       gotoAnchor( m_url.htmlRef() );

we should do something like (in pseudo-code):
 if ( !m_url.encodedHtmlRef().isEmpty() )
{
	if ( m_view->done() )
		gotoAnchor();
	else
		connect(m_view, SIGNAL(doneRendering()), this, SLOT(gotoAnchor()));

}

void KHTMLPart::gotoAnchor()
{
  if ( !gotoAnchor( m_url.encodedHtmlRef()) )
       gotoAnchor( m_url.htmlRef() );
}

The problem is, is there a signal that can notify KHTMLPart when rendering is 
finished? I got completely lost in the KHTML code.

best,
Jeroen
-- 
Kile - KDE Integrated LaTeX Editor
http://kile.sourceforge.net




More information about the kfm-devel mailing list