Improved handling of anchors in wxHTML: scroll to better position (patch #11406).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62674 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2009-11-17 20:20:48 +00:00
parent fde702ea51
commit 8e6c2840b4
3 changed files with 21 additions and 5 deletions

View File

@@ -657,6 +657,16 @@ bool wxHtmlWindow::ScrollToAnchor(const wxString& anchor)
}
else
{
// Go to next visible cell in current container, if it exists. This
// yields a bit better (even though still imperfect) results in that
// there's better chance of using a suitable cell for upper Y
// coordinate value. See bug #11406 for additional discussion.
const wxHtmlCell *c_save = c;
while ( c && c->IsFormattingCell() )
c = c->GetNext();
if ( !c )
c = c_save;
int y;
for (y = 0; c != NULL; c = c->GetParent()) y += c->GetPosY();