Backing out experimental TakeFocus() changes which weren't supposed to be part of previous checkin

This commit is contained in:
aaronleventhal@moonset.net 2007-04-19 08:14:41 -07:00
Родитель 1c75de153d
Коммит 4f68d839f7
1 изменённых файлов: 11 добавлений и 27 удалений

Просмотреть файл

@ -251,34 +251,18 @@ NS_IMETHODIMP nsDocAccessible::GetFocusedChild(nsIAccessible **aFocusedChild)
NS_IMETHODIMP nsDocAccessible::TakeFocus() NS_IMETHODIMP nsDocAccessible::TakeFocus()
{ {
NS_ENSURE_TRUE(mDocument, NS_ERROR_FAILURE); nsCOMPtr<nsIDOMWindow> domWin;
PRUint32 state; GetWindow(getter_AddRefs(domWin));
GetState(&state, nsnull); nsCOMPtr<nsPIDOMWindow> privateDOMWindow(do_QueryInterface(domWin));
if (0 == (state & nsIAccessibleStates::STATE_FOCUSABLE)) { NS_ENSURE_TRUE(privateDOMWindow, NS_ERROR_FAILURE);
return NS_ERROR_FAILURE; // Not focusable nsIFocusController *focusController =
privateDOMWindow->GetRootFocusController();
if (focusController) {
nsCOMPtr<nsIDOMElement> ele(do_QueryInterface(mDOMNode));
focusController->SetFocusedElement(ele);
return NS_OK;
} }
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDocShellTreeItem> treeItem = GetDocShellTreeItemFor(mDOMNode);
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(treeItem);
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
nsCOMPtr<nsIPresShell> shell(GetPresShell());
nsIEventStateManager *esm = shell->GetPresContext()->EventStateManager();
NS_ENSURE_TRUE(esm, NS_ERROR_FAILURE);
nsresult rv = esm->SetContentState(nsnull, NS_EVENT_STATE_FOCUS);
NS_ENSURE_SUCCESS(rv, rv);
rv = docShell->SetHasFocus(PR_TRUE);
NS_ENSURE_SUCCESS(rv, rv);
rv = docShell->SetCanvasHasFocus(PR_TRUE);
NS_ENSURE_SUCCESS(rv, rv);
nsIContent *content = mDocument->GetRootContent();
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
content->SetFocus(shell->GetPresContext());
esm->SetFocusedContent(content);
esm->MoveCaretToFocus();
esm->SetFocusedContent(nsnull);
return NS_OK;
} }
// ------- nsIAccessibleDocument Methods (5) --------------- // ------- nsIAccessibleDocument Methods (5) ---------------