[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    Re: key navigation and visible area of the page
From:       Tobias Anton <TA () ESC-Electronics ! de>
Date:       2004-07-09 17:50:58
Message-ID: 200407091950.58419.TA () ESC-Electronics ! de
[Download RAW message or body]

On Dienstag, 25. Mai 2004 10:37, Tobias Anton wrote:
> > 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.

Hi Lubos, 
attached is a patch that saves one call to ensureVisible(), which should 
reduce flickering.

Cheers
-- Tobias
["single-ensure-visible-for-focusing.diff" (text/x-diff)]

Index: khtmlview.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/khtmlview.cpp,v
retrieving revision 1.640
diff -u -3 -p -r1.640 khtmlview.cpp
--- khtmlview.cpp	30 Jun 2004 16:20:34 -0000	1.640
+++ khtmlview.cpp	9 Jul 2004 18:47:46 -0000
@@ -1713,8 +1713,8 @@ bool KHTMLView::focusNextPrevNode(bool n
 		(focusNodeRect.top() > contentsY()) && (focusNodeRect.bottom() < contentsY() + visibleHeight())) {
 		{
 		    QRect r = toFocus->getRect();
-		    ensureVisible( r.right(), r.bottom());
-		    ensureVisible( r.left(), r.top());
+		    ensureVisible(r.center().x(), r.center().y(), r.width()/2, r.height()/2);
+
 		    d->scrollBarMoved = false;
 		    d->tabMovePending = false;
 		    d->lastTabbingDirection = next;
@@ -1858,8 +1858,7 @@ bool KHTMLView::focusNodeWithAccessKey( 
 #endif // KHTML_NO_CARET
 
     QRect r = node->getRect();
-    ensureVisible( r.right(), r.bottom());
-    ensureVisible( r.left(), r.top());
+    ensureVisible(r.center().x(), r.center().y(), r.width()/2, r.height()/2);
 
     Node guard( node );
     if( node->isSelectable()) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic