If we find that nothing else is targetable in the direction of navigation, we will simply scroll the window. NPODB

git-svn-id: svn://10.0.0.236/trunk@177341 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dougt%meer.net 2005-08-08 18:29:13 +00:00
parent ab3519a637
commit d5d12a2ef3

View File

@ -38,6 +38,7 @@
PRInt32 gRectFudge = 20;
PRInt32 gDirectionalBias = 3;
PRInt32 gScrollOffset = 26;
NS_INTERFACE_MAP_BEGIN(nsSpatialNavigation)
NS_INTERFACE_MAP_ENTRY(nsISpatialNavigation)
@ -608,6 +609,24 @@ nsSpatialNavigation::handleMove(int direction)
// if everything fails, default is to move the focus just as if the user hit tab.
// presContext->EventStateManager()->ShiftFocus(PR_TRUE, focusedContent);
// how about this, if we find anything, we just scroll the
// page in the direction of the navigation??
{
nsCOMPtr<nsIDOMWindow> contentWindow = getContentWindow();
if (!contentWindow)
return NS_OK;
if (direction == eNavLeft)
contentWindow->ScrollBy(-1* gScrollOffset, 0);
else if (direction == eNavRight)
contentWindow->ScrollBy(gScrollOffset, 0);
else if (direction == eNavUp)
contentWindow->ScrollBy(0, -1 * gScrollOffset);
else
contentWindow->ScrollBy(0, gScrollOffset);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
return NS_OK;