mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 91716. MSAA Events for focus/selection changes to HTML <select> objects. Also supports focus state for options. r=jgaunt, sr=brendan
This commit is contained in:
parent
39f0e0f79e
commit
f3b32fcf7a
@ -48,6 +48,7 @@
|
||||
#include "nsILink.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
|
||||
// IFrame
|
||||
#include "nsIDocShell.h"
|
||||
@ -637,6 +638,24 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessibleFor(nsIDOMNode *aNode,
|
||||
}
|
||||
}
|
||||
|
||||
// ---- If <select> option, create select option accessible
|
||||
if (!newAcc) {
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> optionElement(do_QueryInterface(aNode));
|
||||
if (optionElement) {
|
||||
// nsHTMLSelectionOptionAccessible's must be created via the parent
|
||||
nsCOMPtr<nsIDOMNode> parentNode;
|
||||
aNode->GetParentNode(getter_AddRefs(parentNode));
|
||||
if (parentNode) {
|
||||
nsCOMPtr<nsIAccessible> parentAccessible;
|
||||
GetAccessibleFor(parentNode, getter_AddRefs(parentAccessible));
|
||||
if (parentAccessible) {
|
||||
nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(shell));
|
||||
newAcc = new nsHTMLSelectOptionAccessible(parentAccessible, aNode, weakShell);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!newAcc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -44,10 +44,13 @@
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIDOMNSHTMLSelectElement.h"
|
||||
#include "nsIAccessibleSelectable.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsHTMLSelectListAccessible.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsRootAccessible)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAccessibleDocument)
|
||||
@ -65,7 +68,8 @@ NS_IMPL_RELEASE_INHERITED(nsRootAccessible, nsAccessible);
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsRootAccessible::nsRootAccessible(nsIWeakReference* aShell):nsAccessible(nsnull,aShell), nsDocAccessibleMixin(aShell)
|
||||
nsRootAccessible::nsRootAccessible(nsIWeakReference* aShell):nsAccessible(nsnull,aShell),
|
||||
nsDocAccessibleMixin(aShell), mAccService(do_GetService("@mozilla.org/accessibilityService;1"))
|
||||
{
|
||||
mListener = nsnull;
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
@ -240,69 +244,63 @@ NS_IMETHODIMP nsRootAccessible::RemoveAccessibleEventListener(nsIAccessibleEvent
|
||||
NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (mListener) {
|
||||
nsCOMPtr<nsIDOMEventTarget> t;
|
||||
aEvent->GetOriginalTarget(getter_AddRefs(t));
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(t));
|
||||
if (!content)
|
||||
return NS_OK;
|
||||
// optionTargetNode is set to current option for HTML selects
|
||||
nsCOMPtr<nsIDOMNode> targetNode, optionTargetNode;
|
||||
nsresult rv = GetTargetNode(aEvent, targetNode);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
// Check to see if it's a select element. If so, need the currently focused option
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> selectElement(do_QueryInterface(targetNode));
|
||||
if (selectElement) // ----- Target Node is an HTML <select> element ------
|
||||
nsHTMLSelectOptionAccessible::GetFocusedOptionNode(mPresShell, targetNode, optionTargetNode);
|
||||
|
||||
nsAutoString eventType;
|
||||
aEvent->GetType(eventType);
|
||||
|
||||
// the "focus" type is pulled from nsDOMEvent.cpp
|
||||
if ( eventType.EqualsIgnoreCase("focus") ) {
|
||||
if (mCurrentFocus == content)
|
||||
return NS_OK;
|
||||
mCurrentFocus = content;
|
||||
}
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
if (!frame)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIAccessible> a;
|
||||
frame->GetAccessible(getter_AddRefs(a));
|
||||
if (!a)
|
||||
a = do_QueryInterface(content);
|
||||
|
||||
if (!a) {
|
||||
// is it a link?
|
||||
nsCOMPtr<nsILink> link(do_QueryInterface(content));
|
||||
if (link) {
|
||||
#ifdef DEBUG
|
||||
printf("focus link!\n");
|
||||
#endif
|
||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
|
||||
if (node)
|
||||
a = new nsHTMLLinkAccessible(node, mPresShell);
|
||||
}
|
||||
}
|
||||
|
||||
if (a) {
|
||||
if (NS_SUCCEEDED(mAccService->GetAccessibleFor(targetNode, getter_AddRefs(accessible)))) {
|
||||
if ( eventType.EqualsIgnoreCase("focus") ) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_FOCUS, a);
|
||||
if (mCurrentFocus != targetNode) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_FOCUS, accessible);
|
||||
mCurrentFocus = targetNode;
|
||||
}
|
||||
}
|
||||
else if ( eventType.EqualsIgnoreCase("change") ) {
|
||||
nsCOMPtr<nsIDOMNSHTMLSelectElement> select(do_QueryInterface(content));
|
||||
if ( select ) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_SELECTION, a);
|
||||
if (optionTargetNode) { // Set to current option only for HTML selects
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_SELECTION, accessible);
|
||||
if (mCurrentFocus != optionTargetNode &&
|
||||
NS_SUCCEEDED(mAccService->GetAccessibleFor(optionTargetNode, getter_AddRefs(accessible)))) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_FOCUS, accessible);
|
||||
mCurrentFocus = optionTargetNode;
|
||||
}
|
||||
}
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, a);
|
||||
else
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, accessible);
|
||||
}
|
||||
else if ( eventType.EqualsIgnoreCase("CheckboxStateChange") ) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, a);
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, accessible);
|
||||
}
|
||||
else if ( eventType.EqualsIgnoreCase("RadiobuttonStateChange") ) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, a);
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, accessible);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetTargetNode(nsIDOMEvent *aEvent, nsCOMPtr<nsIDOMNode>& aTargetNode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMEventTarget> domEventTarget;
|
||||
aEvent->GetOriginalTarget(getter_AddRefs(domEventTarget));
|
||||
|
||||
nsresult rv;
|
||||
aTargetNode = do_QueryInterface(domEventTarget, &rv);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
// ------- nsIDOMFocusListener Methods (1) -------------
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::Focus(nsIDOMEvent* aEvent)
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "nsIDOMFormListener.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
|
||||
class nsDocAccessibleMixin
|
||||
{
|
||||
@ -89,6 +90,7 @@ class nsRootAccessible : public nsAccessible,
|
||||
NS_DECL_NSIACCESSIBLEDOCUMENT
|
||||
|
||||
protected:
|
||||
NS_IMETHOD GetTargetNode(nsIDOMEvent *aEvent, nsCOMPtr<nsIDOMNode>& aTargetNode);
|
||||
virtual void GetBounds(nsRect& aRect, nsIFrame** aRelativeFrame);
|
||||
virtual nsIFrame* GetFrame();
|
||||
|
||||
@ -96,7 +98,8 @@ class nsRootAccessible : public nsAccessible,
|
||||
// it is the callers responsibility to remove the listener
|
||||
// otherwise we will get into circular referencing problems
|
||||
nsIAccessibleEventListener* mListener;
|
||||
nsCOMPtr<nsIContent> mCurrentFocus;
|
||||
nsCOMPtr<nsIDOMNode> mCurrentFocus;
|
||||
nsCOMPtr<nsIAccessibilityService> mAccService;
|
||||
};
|
||||
|
||||
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "nsILink.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
|
||||
// IFrame
|
||||
#include "nsIDocShell.h"
|
||||
@ -637,6 +638,24 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessibleFor(nsIDOMNode *aNode,
|
||||
}
|
||||
}
|
||||
|
||||
// ---- If <select> option, create select option accessible
|
||||
if (!newAcc) {
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> optionElement(do_QueryInterface(aNode));
|
||||
if (optionElement) {
|
||||
// nsHTMLSelectionOptionAccessible's must be created via the parent
|
||||
nsCOMPtr<nsIDOMNode> parentNode;
|
||||
aNode->GetParentNode(getter_AddRefs(parentNode));
|
||||
if (parentNode) {
|
||||
nsCOMPtr<nsIAccessible> parentAccessible;
|
||||
GetAccessibleFor(parentNode, getter_AddRefs(parentAccessible));
|
||||
if (parentAccessible) {
|
||||
nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(shell));
|
||||
newAcc = new nsHTMLSelectOptionAccessible(parentAccessible, aNode, weakShell);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!newAcc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -32,6 +32,8 @@
|
||||
#include "nsISelectControlFrame.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIListControlFrame.h"
|
||||
|
||||
/** ----- nsHTMLSelectListAccessible ----- */
|
||||
|
||||
@ -125,14 +127,11 @@ NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccFirstChild(nsIAccessible **_retv
|
||||
* As a nsHTMLSelectListAccessible we can have the following states:
|
||||
* STATE_MULTISELECTABLE
|
||||
* STATE_EXTSELECTABLE
|
||||
* STATE_FOCUSED
|
||||
* STATE_FOCUSABLE
|
||||
* no STATE_FOCUSED! -- can't be focused, options are focused instead
|
||||
* no STATE_FOCUSABLE! -- can't be focused, options are focused instead
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// this sets either STATE_FOCUSED or 0
|
||||
nsAccessible::GetAccState(_retval);
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> select (do_QueryInterface(mDOMNode));
|
||||
if ( select ) {
|
||||
PRBool multiple;
|
||||
@ -141,7 +140,6 @@ NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccState(PRUint32 *_retval)
|
||||
*_retval |= STATE_MULTISELECTABLE | STATE_EXTSELECTABLE;
|
||||
}
|
||||
|
||||
*_retval |= STATE_FOCUSABLE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -246,8 +244,13 @@ NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccName(nsAWritableString& _retva
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccState(PRUint32 *_retval)
|
||||
{
|
||||
// this sets either STATE_FOCUSED or 0
|
||||
nsAccessible::GetAccState(_retval);
|
||||
// this sets either STATE_FOCUSED or 0 (nsAccessible::GetAccState() doesn't know about list options)
|
||||
*_retval = 0;
|
||||
nsCOMPtr<nsIDOMNode> focusedOptionNode, parentNode;
|
||||
mParent->AccGetDOMNode(getter_AddRefs(parentNode));
|
||||
GetFocusedOptionNode(mPresShell, parentNode, focusedOptionNode);
|
||||
if (focusedOptionNode == mDOMNode)
|
||||
*_retval |= STATE_FOCUSED;
|
||||
|
||||
// Are we selected?
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> option (do_QueryInterface(mDOMNode));
|
||||
@ -263,4 +266,47 @@ NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccState(PRUint32 *_retval)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsHTMLSelectOptionAccessible::GetFocusedOptionNode(nsIWeakReference *aPresShell,
|
||||
nsIDOMNode *aListNode,
|
||||
nsCOMPtr<nsIDOMNode>& aFocusedOptionNode)
|
||||
{
|
||||
NS_ASSERTION(aListNode, "Called GetFocusedOptionNode without a valid list node");
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(aPresShell));
|
||||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIFrame *frame = nsnull;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aListNode));
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIListControlFrame> listFrame(do_QueryInterface(frame, &rv));
|
||||
if (NS_FAILED(rv))
|
||||
return rv; // How can list content not have a list frame?
|
||||
NS_ASSERTION(listFrame, "We don't have a list frame, but rv returned a success code.");
|
||||
|
||||
// Get what's focused by asking frame for "selected item".
|
||||
// Don't use DOM method of getting selected item, which instead gives *first* selected option
|
||||
PRInt32 focusedOptionIndex = 0;
|
||||
rv = listFrame->GetSelectedIndex(&focusedOptionIndex);
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLCollection> options;
|
||||
|
||||
// Get options
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> selectElement(do_QueryInterface(aListNode));
|
||||
NS_ASSERTION(selectElement, "No select element where it should be");
|
||||
rv = selectElement->GetOptions(getter_AddRefs(options));
|
||||
}
|
||||
|
||||
// Either use options and focused index, or default to list node itself
|
||||
if (NS_SUCCEEDED(rv) && options && focusedOptionIndex >= 0) // Something is focused
|
||||
rv = options->Item(focusedOptionIndex, getter_AddRefs(aFocusedOptionNode));
|
||||
else { // If no options in list or focusedOptionIndex <0, then we are not focused on an item
|
||||
aFocusedOptionNode = aListNode; // return normal target content
|
||||
rv = NS_OK;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -69,6 +69,7 @@ public:
|
||||
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
|
||||
NS_IMETHOD GetAccName(nsAWritableString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
static nsresult GetFocusedOptionNode(nsIWeakReference *aPresShell, nsIDOMNode *aListNode, nsCOMPtr<nsIDOMNode>& aFocusedOptionNode);
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -44,10 +44,13 @@
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIDOMNSHTMLSelectElement.h"
|
||||
#include "nsIAccessibleSelectable.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsString.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsHTMLSelectListAccessible.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsRootAccessible)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAccessibleDocument)
|
||||
@ -65,7 +68,8 @@ NS_IMPL_RELEASE_INHERITED(nsRootAccessible, nsAccessible);
|
||||
//-----------------------------------------------------
|
||||
// construction
|
||||
//-----------------------------------------------------
|
||||
nsRootAccessible::nsRootAccessible(nsIWeakReference* aShell):nsAccessible(nsnull,aShell), nsDocAccessibleMixin(aShell)
|
||||
nsRootAccessible::nsRootAccessible(nsIWeakReference* aShell):nsAccessible(nsnull,aShell),
|
||||
nsDocAccessibleMixin(aShell), mAccService(do_GetService("@mozilla.org/accessibilityService;1"))
|
||||
{
|
||||
mListener = nsnull;
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
@ -240,69 +244,63 @@ NS_IMETHODIMP nsRootAccessible::RemoveAccessibleEventListener(nsIAccessibleEvent
|
||||
NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
if (mListener) {
|
||||
nsCOMPtr<nsIDOMEventTarget> t;
|
||||
aEvent->GetOriginalTarget(getter_AddRefs(t));
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(t));
|
||||
if (!content)
|
||||
return NS_OK;
|
||||
// optionTargetNode is set to current option for HTML selects
|
||||
nsCOMPtr<nsIDOMNode> targetNode, optionTargetNode;
|
||||
nsresult rv = GetTargetNode(aEvent, targetNode);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
// Check to see if it's a select element. If so, need the currently focused option
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> selectElement(do_QueryInterface(targetNode));
|
||||
if (selectElement) // ----- Target Node is an HTML <select> element ------
|
||||
nsHTMLSelectOptionAccessible::GetFocusedOptionNode(mPresShell, targetNode, optionTargetNode);
|
||||
|
||||
nsAutoString eventType;
|
||||
aEvent->GetType(eventType);
|
||||
|
||||
// the "focus" type is pulled from nsDOMEvent.cpp
|
||||
if ( eventType.EqualsIgnoreCase("focus") ) {
|
||||
if (mCurrentFocus == content)
|
||||
return NS_OK;
|
||||
mCurrentFocus = content;
|
||||
}
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
|
||||
nsIFrame* frame = nsnull;
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
if (!frame)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIAccessible> a;
|
||||
frame->GetAccessible(getter_AddRefs(a));
|
||||
if (!a)
|
||||
a = do_QueryInterface(content);
|
||||
|
||||
if (!a) {
|
||||
// is it a link?
|
||||
nsCOMPtr<nsILink> link(do_QueryInterface(content));
|
||||
if (link) {
|
||||
#ifdef DEBUG
|
||||
printf("focus link!\n");
|
||||
#endif
|
||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
|
||||
if (node)
|
||||
a = new nsHTMLLinkAccessible(node, mPresShell);
|
||||
}
|
||||
}
|
||||
|
||||
if (a) {
|
||||
if (NS_SUCCEEDED(mAccService->GetAccessibleFor(targetNode, getter_AddRefs(accessible)))) {
|
||||
if ( eventType.EqualsIgnoreCase("focus") ) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_FOCUS, a);
|
||||
if (mCurrentFocus != targetNode) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_FOCUS, accessible);
|
||||
mCurrentFocus = targetNode;
|
||||
}
|
||||
}
|
||||
else if ( eventType.EqualsIgnoreCase("change") ) {
|
||||
nsCOMPtr<nsIDOMNSHTMLSelectElement> select(do_QueryInterface(content));
|
||||
if ( select ) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_SELECTION, a);
|
||||
if (optionTargetNode) { // Set to current option only for HTML selects
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_SELECTION, accessible);
|
||||
if (mCurrentFocus != optionTargetNode &&
|
||||
NS_SUCCEEDED(mAccService->GetAccessibleFor(optionTargetNode, getter_AddRefs(accessible)))) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_FOCUS, accessible);
|
||||
mCurrentFocus = optionTargetNode;
|
||||
}
|
||||
}
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, a);
|
||||
else
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, accessible);
|
||||
}
|
||||
else if ( eventType.EqualsIgnoreCase("CheckboxStateChange") ) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, a);
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, accessible);
|
||||
}
|
||||
else if ( eventType.EqualsIgnoreCase("RadiobuttonStateChange") ) {
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, a);
|
||||
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_STATE_CHANGE, accessible);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::GetTargetNode(nsIDOMEvent *aEvent, nsCOMPtr<nsIDOMNode>& aTargetNode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMEventTarget> domEventTarget;
|
||||
aEvent->GetOriginalTarget(getter_AddRefs(domEventTarget));
|
||||
|
||||
nsresult rv;
|
||||
aTargetNode = do_QueryInterface(domEventTarget, &rv);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
// ------- nsIDOMFocusListener Methods (1) -------------
|
||||
|
||||
NS_IMETHODIMP nsRootAccessible::Focus(nsIDOMEvent* aEvent)
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "nsIDOMFormListener.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
|
||||
class nsDocAccessibleMixin
|
||||
{
|
||||
@ -89,6 +90,7 @@ class nsRootAccessible : public nsAccessible,
|
||||
NS_DECL_NSIACCESSIBLEDOCUMENT
|
||||
|
||||
protected:
|
||||
NS_IMETHOD GetTargetNode(nsIDOMEvent *aEvent, nsCOMPtr<nsIDOMNode>& aTargetNode);
|
||||
virtual void GetBounds(nsRect& aRect, nsIFrame** aRelativeFrame);
|
||||
virtual nsIFrame* GetFrame();
|
||||
|
||||
@ -96,7 +98,8 @@ class nsRootAccessible : public nsAccessible,
|
||||
// it is the callers responsibility to remove the listener
|
||||
// otherwise we will get into circular referencing problems
|
||||
nsIAccessibleEventListener* mListener;
|
||||
nsCOMPtr<nsIContent> mCurrentFocus;
|
||||
nsCOMPtr<nsIDOMNode> mCurrentFocus;
|
||||
nsCOMPtr<nsIAccessibilityService> mAccService;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user