diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index 21674d577cc9..4f4ffb2c830d 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -465,6 +465,19 @@ nsFocusManager::SetFocus(nsIDOMElement* aElement, PRUint32 aFlags) return NS_OK; } +NS_IMETHODIMP +nsFocusManager::ElementIsFocusable(nsIDOMElement* aElement, PRUint32 aFlags, + bool* aIsFocusable) +{ + NS_ENSURE_TRUE(aElement, NS_ERROR_INVALID_ARG); + + nsCOMPtr aContent = do_QueryInterface(aElement); + + *aIsFocusable = CheckIfFocusable(aContent, aFlags) != nsnull; + + return NS_OK; +} + NS_IMETHODIMP nsFocusManager::MoveFocus(nsIDOMWindow* aWindow, nsIDOMElement* aStartElement, PRUint32 aType, PRUint32 aFlags, nsIDOMElement** aElement) diff --git a/dom/interfaces/base/nsIFocusManager.idl b/dom/interfaces/base/nsIFocusManager.idl index 6de2b32bc25c..89ff9043334b 100644 --- a/dom/interfaces/base/nsIFocusManager.idl +++ b/dom/interfaces/base/nsIFocusManager.idl @@ -166,6 +166,11 @@ interface nsIFocusManager : nsISupports */ void moveCaretToFocus(in nsIDOMWindow aWindow); + /*** + * Check if given element is focusable. + */ + boolean elementIsFocusable(in nsIDOMElement aElement, in unsigned long aFlags); + /* * Raise the window when switching focus */