Bug 379424. grabFocus() on form controls should remove focus from other items on the page. r=surkov

This commit is contained in:
aaronleventhal@moonset.net 2007-05-07 12:02:57 -07:00
Родитель 6884212abd
Коммит 02877c0c54
1 изменённых файлов: 7 добавлений и 0 удалений

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

@ -41,6 +41,7 @@
#include "nsIAccessibleDocument.h"
#include "nsIDocument.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMNSHTMLElement.h"
#include "nsIImageDocument.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
@ -1414,6 +1415,12 @@ NS_IMETHODIMP nsAccessible::TakeSelection()
/* void takeFocus (); */
NS_IMETHODIMP nsAccessible::TakeFocus()
{
nsCOMPtr<nsIDOMNSHTMLElement> htmlElement(do_QueryInterface(mDOMNode));
if (htmlElement) {
// HTML Elements also set the caret position
// in order to affect tabbing order
return htmlElement->Focus();
}
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
if (!content) {
return NS_ERROR_FAILURE;