Bug 82123 -- enable embeddors to alter the focus traversal so that the document itself receives focus first instead of last. r=saari, adamlock, sr=jst, a=chofmann.

git-svn-id: svn://10.0.0.236/trunk@97913 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bryner%uiuc.edu
2001-06-26 01:19:11 +00:00
parent acadd08545
commit c859fec205
6 changed files with 71 additions and 36 deletions

View File

@@ -179,11 +179,12 @@ nsDocShell::nsDocShell():
mItemType(typeContent),
mCurrentScrollbarPref(-1, -1),
mDefaultScrollbarPref(-1, -1),
mAllowSubframes(PR_TRUE),
mAllowPlugins(PR_TRUE),
mAllowJavascript(PR_TRUE),
mAllowMetaRedirects(PR_TRUE),
mAllowSubframes(PR_TRUE),
mAllowImages(PR_TRUE),
mFocusDocFirst(PR_FALSE),
mAppType(nsIDocShell::APP_TYPE_UNKNOWN),
mBusyFlags(BUSY_FLAGS_NONE),
mEODForCurrentDocument(PR_FALSE),
@@ -1209,6 +1210,22 @@ NS_IMETHODIMP nsDocShell::SetAllowImages(PRBool aAllowImages)
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetFocusDocBeforeContent(PRBool* aDocFirst)
{
NS_ENSURE_ARG_POINTER(aDocFirst);
*aDocFirst = mFocusDocFirst;
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::SetFocusDocBeforeContent(PRBool aDocFirst)
{
mFocusDocFirst = aDocFirst;
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetDocShellEnumerator(PRInt32 aItemType, PRInt32 aDirection, nsISimpleEnumerator **outEnum)
{
@@ -2680,6 +2697,9 @@ nsDocShell::SetFocus()
doFocusDoc = type == nsIDocShellTreeItem::typeContent;
}
if (mFocusDocFirst)
doFocusDoc = PR_TRUE;
// Tell itself (and the DocShellFocusController) who has focus
// this way focus gets removed from the currently focused DocShell
SetHasFocus(PR_TRUE);
@@ -2881,6 +2901,7 @@ nsDocShell::FocusAvailable(nsIBaseWindow * aCurrentFocus,
// For DocShell's not implemented by this class
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(chromeFocus));
MakeSureOfSetFocus(nsnull, docShell);
*aTookFocus = PR_TRUE;
return ret;
} else {
// If the embeddor does not implement FocusNext/PrevElement,