fixing build bustage. enabling text fields to work

git-svn-id: svn://10.0.0.236/trunk@221276 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dougt%meer.net
2007-03-04 08:54:50 +00:00
parent d754e08ed9
commit 34bb3570fb
2 changed files with 51 additions and 24 deletions

View File

@@ -68,12 +68,6 @@ nsSpatialNavigation::HandleEvent(nsIDOMEvent* aEvent)
return NS_OK;
}
NS_IMETHODIMP
nsSpatialNavigation::KeyDown(nsIDOMEvent* aEvent)
{
return NS_OK;
}
NS_IMETHODIMP
nsSpatialNavigation::KeyUp(nsIDOMEvent* aEvent)
{
@@ -82,6 +76,12 @@ nsSpatialNavigation::KeyUp(nsIDOMEvent* aEvent)
NS_IMETHODIMP
nsSpatialNavigation::KeyPress(nsIDOMEvent* aEvent)
{
return NS_OK;
}
NS_IMETHODIMP
nsSpatialNavigation::KeyDown(nsIDOMEvent* aEvent)
{
nsCOMPtr<nsIPrefBranch> prefBranch = do_GetService(NS_PREFSERVICE_CONTRACTID);
PRBool enabled;
@@ -125,7 +125,7 @@ nsSpatialNavigation::KeyPress(nsIDOMEvent* aEvent)
nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(targetContent));
formControlType = formControl->GetType();
if (!mService->mIgnoreTextFields)
if (mService->mIgnoreTextFields)
{
if (formControlType == NS_FORM_TEXTAREA ||
formControlType == NS_FORM_INPUT_TEXT ||
@@ -219,11 +219,22 @@ nsSpatialNavigation::KeyPress(nsIDOMEvent* aEvent)
// based on the selected position we decide to nav. or
// not.
if (formControlType == NS_FORM_SELECT)
return NS_OK;
// ************************************************************************************
// NS_FORM_SELECT cases:
// * if it is a select form of 'size' attr != than '1' then we do as above.
// * if it is a select form of 'size' attr == than '1', snav can take care of it.
// if (formControlType == NS_FORM_SELECT)
// return NS_OK;
// ************************************************************************************
// NS_FORM_TEXTAREA cases:
// ************************************************************************************
// NS_FORM_INPUT_TEXT | NS_FORM_INPUT_PASSWORD | NS_FORM_INPUT_FILE cases
aEvent->StopPropagation();
aEvent->PreventDefault();
aEvent->PreventDefault();
return Up();
}
@@ -237,11 +248,22 @@ nsSpatialNavigation::KeyPress(nsIDOMEvent* aEvent)
// based on the selected position we decide to nav. or
// not.
if (formControlType == NS_FORM_SELECT)
return NS_OK;
// ************************************************************************************
// NS_FORM_SELECT cases:
// * if it is a select form of 'size' attr != than '1' then we do as above.
// * if it is a select form of 'size' attr == than '1', snav can take care of it.
// if (formControlType == NS_FORM_SELECT)
// return NS_OK;
// ************************************************************************************
// NS_FORM_TEXTAREA cases:
// ************************************************************************************
// NS_FORM_INPUT_TEXT | NS_FORM_INPUT_PASSWORD | NS_FORM_INPUT_FILE cases
aEvent->StopPropagation(); // We're using this key, no one else should
aEvent->PreventDefault();
aEvent->PreventDefault();
return Down();
}
@@ -544,9 +566,13 @@ nsSpatialNavigation::handleMove(int direction)
nsCOMPtr<nsIContent> focusedContent;
getFocusedContent(direction, getter_AddRefs(focusedContent));
if (!focusedContent)
return NS_OK;
// there are some websites which have no focusable elements,
// only text, for example. In these cases, scrolling have to be
// performed by snav.
if (!focusedContent) {
ScrollWindow(direction, getContentWindow());
return NS_OK;
}
nsPresContext* presContext = getPresContext(focusedContent);
if(!presContext)
return NS_ERROR_NULL_POINTER;
@@ -580,7 +606,7 @@ nsSpatialNavigation::handleMove(int direction)
if (!doc)
return NS_ERROR_FAILURE;
nsIPresShell *presShell = doc->GetShellAt(0);
/* nsIPresShell *presShell = doc->GetShellAt(0);
nsIFrame* cframe = presShell->GetPrimaryFrameFor(c);
@@ -589,9 +615,10 @@ nsSpatialNavigation::handleMove(int direction)
if (b)
setFocusedContent(c);
else
ScrollWindow(direction, getContentWindow());
ScrollWindow(direction, getContentWindow());*/
return NS_OK;
setFocusedContent(c);
return NS_OK;
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -733,8 +760,9 @@ nsSpatialNavigation::setFocusedContent(nsIContent* c)
nsCOMPtr<nsIDOMWindow> contentWindow;
if (mService->mDisableJSWhenFocusing)
contentWindow = getContentWindow();
DisableJSScope foopy (contentWindow);
// We do not want to have JS disable at anytime - see bug 51075
// DisableJSScope foopy (contentWindow);
//#ifdef OLDER_LAYOUT
nsPresContext* presContext = getPresContext(c);