mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 363214 grabFocus to document frame doesn't remove focus from text entry
patch by Nian.Liu at sun.com r=aaronleventhal
This commit is contained in:
parent
bd884ad4e0
commit
9d32decf77
@ -67,6 +67,7 @@
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsIFocusController.h"
|
||||
#ifdef MOZ_XUL
|
||||
#include "nsIXULDocument.h"
|
||||
#endif
|
||||
@ -243,6 +244,22 @@ NS_IMETHODIMP nsDocAccessible::GetFocusedChild(nsIAccessible **aFocusedChild)
|
||||
return accService->GetAccessibleFor(gLastFocusedNode, aFocusedChild);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessible::TakeFocus()
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindow> domWin;
|
||||
GetWindow(getter_AddRefs(domWin));
|
||||
nsCOMPtr<nsPIDOMWindow> privateDOMWindow(do_QueryInterface(domWin));
|
||||
NS_ENSURE_TRUE(privateDOMWindow, NS_ERROR_FAILURE);
|
||||
nsIFocusController *focusController =
|
||||
privateDOMWindow->GetRootFocusController();
|
||||
if (focusController) {
|
||||
nsCOMPtr<nsIDOMElement> ele(do_QueryInterface(mDOMNode));
|
||||
focusController->SetFocusedElement(ele);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// ------- nsIAccessibleDocument Methods (5) ---------------
|
||||
|
||||
NS_IMETHODIMP nsDocAccessible::GetURL(nsAString& aURL)
|
||||
|
@ -80,6 +80,7 @@ class nsDocAccessible : public nsHyperTextAccessible,
|
||||
NS_IMETHOD GetState(PRUint32 *aState);
|
||||
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
|
||||
NS_IMETHOD GetParent(nsIAccessible **aParent);
|
||||
NS_IMETHOD TakeFocus(void);
|
||||
|
||||
// ----- nsIScrollPositionListener ---------------------------
|
||||
NS_IMETHOD ScrollPositionWillChange(nsIScrollableView *aView, nscoord aX, nscoord aY);
|
||||
|
Loading…
Reference in New Issue
Block a user