Bug 343953, @ nsGenericHTMLElement::PostHandleEventForAnchors, r=bryner, sr=jst, p=mh+mozilla@glandium.org

This commit is contained in:
Olli.Pettay%helsinki.fi 2006-09-06 09:17:24 +00:00
parent 2ba1526c57
commit b7137c1ce5
3 changed files with 28 additions and 21 deletions

View File

@ -1499,13 +1499,15 @@ nsGenericHTMLElement::PostHandleEventForAnchors(nsEventChainPostVisitor& aVisito
if (win) {
nsIFocusController *focusController =
win->GetRootFocusController();
PRBool isActive = PR_FALSE;
focusController->GetActive(&isActive);
if (!isActive) {
nsCOMPtr<nsIDOMElement> domElement = do_QueryInterface(this);
if(domElement)
focusController->SetFocusedElement(domElement);
break;
if (focusController) {
PRBool isActive = PR_FALSE;
focusController->GetActive(&isActive);
if (!isActive) {
nsCOMPtr<nsIDOMElement> domElement = do_QueryInterface(this);
if(domElement)
focusController->SetFocusedElement(domElement);
break;
}
}
}

View File

@ -1169,13 +1169,15 @@ nsHTMLInputElement::SetFocus(nsPresContext* aPresContext)
nsCOMPtr<nsPIDOMWindow> win = doc->GetWindow();
if (win) {
nsIFocusController *focusController = win->GetRootFocusController();
PRBool isActive = PR_FALSE;
focusController->GetActive(&isActive);
if (!isActive) {
focusController->SetFocusedWindow(win);
focusController->SetFocusedElement(this);
if (focusController) {
PRBool isActive = PR_FALSE;
focusController->GetActive(&isActive);
if (!isActive) {
focusController->SetFocusedWindow(win);
focusController->SetFocusedElement(this);
return;
return;
}
}
}
@ -1215,13 +1217,15 @@ nsHTMLInputElement::Select()
nsPIDOMWindow *win = doc->GetWindow();
if (win) {
nsIFocusController *focusController = win->GetRootFocusController();
PRBool isActive = PR_FALSE;
focusController->GetActive(&isActive);
if (!isActive) {
focusController->SetFocusedWindow(win);
focusController->SetFocusedElement(this);
SelectAll(presContext);
return NS_OK;
if (focusController) {
PRBool isActive = PR_FALSE;
focusController->GetActive(&isActive);
if (!isActive) {
focusController->SetFocusedWindow(win);
focusController->SetFocusedElement(this);
SelectAll(presContext);
return NS_OK;
}
}
}

View File

@ -1612,7 +1612,8 @@ nsGlobalWindow::SetDocShell(nsIDocShell* aDocShell)
nsIFocusController *focusController =
nsGlobalWindow::GetRootFocusController();
PRBool isActive = PR_FALSE;
focusController->GetActive(&isActive);
if (focusController)
focusController->GetActive(&isActive);
// only restore OS chrome if the closing window was active
if (isActive) {