key navigation and visible area of the page

Tobias Anton TA at ESC-Electronics.de
Tue May 25 09:37:08 BST 2004


On Samstag, 22. Mai 2004 13:18, Simon Hausmann wrote:
> On Saturday 22 May 2004 13:05, Lubos Lunak wrote:
> > Dne út 18. května 2004 22:23 Tobias Anton napsal(a):
> > > On Dienstag, 18. Mai 2004 10:17, Lubos Lunak wrote:
> > > >  I would, if you show me that right way. Open the attached page in
> > > > your Konqy and press accesskeys 9 or 0 (i.e. Ctrl+Alt+9/0). With
> > > > ensureVisible() the results are (in some cases noticeably) worse.
> > >
> > > Index: khtmlview.cpp
> > > ===================================================================
> > > RCS file: /home/kde/kdelibs/khtml/khtmlview.cpp,v
> > > retrieving revision 1.634
> > > diff -u -3 -p -u -w -B -r1.634 khtmlview.cpp
> > > --- khtmlview.cpp       17 May 2004 20:24:28 -0000      1.634
> > > +++ khtmlview.cpp       18 May 2004 21:21:47 -0000
> > > @@ -1803,8 +1803,8 @@ bool KHTMLView::focusNodeWithAccessKey(
> > >      }
> > >  #endif // KHTML_NO_CARET
> > >
> > > -    if (!scrollTo(node->getRect()))
> > > -       return true;
> > > +    ensureVisible(node->getRect().right(), node->getRect().bottom());
> > > +    ensureVisible(node->getRect().left(), node->getRect().top());
> > >
> > >      Node guard( node );
> > >      if( node->isSelectable()) {
> > >
> > > How is this worse?
> >
> >  Ok, the idea to do two ensureVisible() calls didn't occur to me. I'll
> > revert the scrollTo() changes then.
>
> I guess it could also be done using one call, with the ensureVisible
> overload that lets you specify a margin.

You're right. We could pass the center of the focused box as x/y coordinates 
and use half of the box's width/height, increased by about 20 pixels, as the 
xmargin/ymargin size. I admit that this is a bit more complicated than it 
should be, but that's the fault of the QT API.

Besides I noticed some flickering with current CVS, but I'm not 100% sure 
about it. It flickers if the view is too small for the widget to fit in the 
visible area. This could be avoided with the proposed optimization.

Cheers,
Tobias




More information about the kfm-devel mailing list