Bug in KHMTLPart::gotoAnchor, RenderBox x and y are not right
Germain Garand
germain at ebooksfrance.org
Mon Jan 7 23:28:24 GMT 2008
Hi,
Le Lundi 07 Janvier 2008 20:51, Eeli Kaikkonen a écrit :
> I suspected that this happens because we use KHTMLPart
> begin()/write()/end(). Probably I hit the bullseye because this kind of
> simple application reproduces the problem. (testiView is the main widget
> for a simple application made with a KDevelop wizard.)
[...]
> m_part->end();
> m_part->gotoAnchor(QString(m_lineEdit->text()));
end() is not an all synchronous operation making sure the rendering is done,
it just makes sure any remaining buffer is flushed and parsed.
For instance, it does not guarantee that any scheduled layout/repaint
operation is done, just that it will be done asap (i.e. after a return to the
event loop).
Here your problem is that the node you are looking for simply hasn't received
a layout yet.
You should use KPart's completed() or completed(bool) signal to make sure the
layout is final before calling gotoAnchor.
Another possibility is to use the finishedLayout() signal, which is triggered
everytime a layout pass (not necessarily final) has finished. Useful if you
want the jump to be attempted several time during progressive loading.
This should probably made clearer in the documentation though (patches
welcome!). And gotoAnchor should arguably return false in such case.. hmm.
Greetings,
Germain
More information about the kfm-devel
mailing list