mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-05-13 08:57:27 +00:00
Bug 589145 - dexpcom accessible event classes, r=davidb, sr=neil, a=davidb
--HG-- rename : accessible/src/base/nsAccEvent.cpp => accessible/src/base/AccEvent.cpp rename : accessible/src/base/nsAccEvent.h => accessible/src/base/AccEvent.h
This commit is contained in:
parent
65aaf4b5e1
commit
ce66c7964f
@ -59,6 +59,7 @@ LOCAL_INCLUDES = -I$(srcdir)/../src
|
||||
SHARED_LIBRARY_LIBS = \
|
||||
../src/base/$(LIB_PREFIX)accessibility_base_s.$(LIB_SUFFIX) \
|
||||
../src/html/$(LIB_PREFIX)accessibility_html_s.$(LIB_SUFFIX) \
|
||||
../src/xpcom/$(LIB_PREFIX)accessibility_xpcom_s.$(LIB_SUFFIX) \
|
||||
../src/$(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
|
@ -59,7 +59,7 @@ interface nsIDOMNode;
|
||||
* if (NS_SUCCEEDED(rv))
|
||||
* rv = observerService->AddObserver(this, "accessible-event", PR_TRUE);
|
||||
*/
|
||||
[scriptable, uuid(c68b4386-dca7-4b88-8988-7a95ce7be92f)]
|
||||
[scriptable, uuid(fd1378c5-c606-4a5e-a321-8e7fc107e5cf)]
|
||||
interface nsIAccessibleEvent : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -476,7 +476,7 @@ interface nsIAccessibleEvent : nsISupports
|
||||
* Returns true if the event was caused by explicit user input,
|
||||
* as opposed to purely originating from a timer or mouse movement
|
||||
*/
|
||||
attribute boolean isFromUserInput;
|
||||
readonly attribute boolean isFromUserInput;
|
||||
};
|
||||
|
||||
|
||||
|
@ -62,6 +62,7 @@ DIRS += $(PLATFORM_DIR)
|
||||
DIRS += \
|
||||
base \
|
||||
html \
|
||||
xpcom \
|
||||
$(null)
|
||||
|
||||
ifdef MOZ_XUL
|
||||
|
@ -1050,7 +1050,7 @@ nsAccessibleWrap *GetAccessibleWrap(AtkObject *aAtkObj)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
|
||||
nsAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
|
||||
{
|
||||
nsresult rv = nsAccessible::HandleAccEvent(aEvent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -1059,7 +1059,7 @@ nsAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
|
||||
nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
|
||||
{
|
||||
nsAccessible *accessible = aEvent->GetAccessible();
|
||||
NS_ENSURE_TRUE(accessible, NS_ERROR_FAILURE);
|
||||
@ -1097,10 +1097,10 @@ nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
|
||||
if (rootAccWrap && rootAccWrap->mActivated) {
|
||||
atk_focus_tracker_notify(atkObj);
|
||||
// Fire state change event for focus
|
||||
nsRefPtr<nsAccEvent> stateChangeEvent =
|
||||
new nsAccStateChangeEvent(accessible,
|
||||
nsIAccessibleStates::STATE_FOCUSED,
|
||||
PR_FALSE, PR_TRUE);
|
||||
nsRefPtr<AccEvent> stateChangeEvent =
|
||||
new AccStateChangeEvent(accessible,
|
||||
nsIAccessibleStates::STATE_FOCUSED,
|
||||
PR_FALSE, PR_TRUE);
|
||||
return FireAtkStateChangeEvent(stateChangeEvent, atkObj);
|
||||
}
|
||||
} break;
|
||||
@ -1130,7 +1130,7 @@ nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_CARET_MOVED\n"));
|
||||
|
||||
nsAccCaretMoveEvent *caretMoveEvent = downcast_accEvent(aEvent);
|
||||
AccCaretMoveEvent* caretMoveEvent = downcast_accEvent(aEvent);
|
||||
NS_ASSERTION(caretMoveEvent, "Event needs event data");
|
||||
if (!caretMoveEvent)
|
||||
break;
|
||||
@ -1159,7 +1159,7 @@ nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
|
||||
case nsIAccessibleEvent::EVENT_TABLE_ROW_INSERT:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_INSERT\n"));
|
||||
nsAccTableChangeEvent *tableEvent = downcast_accEvent(aEvent);
|
||||
AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
|
||||
NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
|
||||
|
||||
PRInt32 rowIndex = tableEvent->GetIndex();
|
||||
@ -1176,7 +1176,7 @@ nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
|
||||
case nsIAccessibleEvent::EVENT_TABLE_ROW_DELETE:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_DELETE\n"));
|
||||
nsAccTableChangeEvent *tableEvent = downcast_accEvent(aEvent);
|
||||
AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
|
||||
NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
|
||||
|
||||
PRInt32 rowIndex = tableEvent->GetIndex();
|
||||
@ -1200,7 +1200,7 @@ nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
|
||||
case nsIAccessibleEvent::EVENT_TABLE_COLUMN_INSERT:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_INSERT\n"));
|
||||
nsAccTableChangeEvent *tableEvent = downcast_accEvent(aEvent);
|
||||
AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
|
||||
NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
|
||||
|
||||
PRInt32 colIndex = tableEvent->GetIndex();
|
||||
@ -1217,7 +1217,7 @@ nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
|
||||
case nsIAccessibleEvent::EVENT_TABLE_COLUMN_DELETE:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_DELETE\n"));
|
||||
nsAccTableChangeEvent *tableEvent = downcast_accEvent(aEvent);
|
||||
AccTableChangeEvent* tableEvent = downcast_accEvent(aEvent);
|
||||
NS_ENSURE_TRUE(tableEvent, NS_ERROR_FAILURE);
|
||||
|
||||
PRInt32 colIndex = tableEvent->GetIndex();
|
||||
@ -1320,12 +1320,12 @@ nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAccessibleWrap::FireAtkStateChangeEvent(nsAccEvent *aEvent,
|
||||
nsAccessibleWrap::FireAtkStateChangeEvent(AccEvent* aEvent,
|
||||
AtkObject *aObject)
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_STATE_CHANGE\n"));
|
||||
|
||||
nsAccStateChangeEvent *event = downcast_accEvent(aEvent);
|
||||
AccStateChangeEvent* event = downcast_accEvent(aEvent);
|
||||
NS_ENSURE_TRUE(event, NS_ERROR_FAILURE);
|
||||
|
||||
PRUint32 state = event->GetState();
|
||||
@ -1356,12 +1356,12 @@ nsAccessibleWrap::FireAtkStateChangeEvent(nsAccEvent *aEvent,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAccessibleWrap::FireAtkTextChangedEvent(nsAccEvent *aEvent,
|
||||
nsAccessibleWrap::FireAtkTextChangedEvent(AccEvent* aEvent,
|
||||
AtkObject *aObject)
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_REMOVED/INSERTED\n"));
|
||||
|
||||
nsAccTextChangeEvent *event = downcast_accEvent(aEvent);
|
||||
AccTextChangeEvent* event = downcast_accEvent(aEvent);
|
||||
NS_ENSURE_TRUE(event, NS_ERROR_FAILURE);
|
||||
|
||||
PRInt32 start = event->GetStartOffset();
|
||||
@ -1379,7 +1379,7 @@ nsAccessibleWrap::FireAtkTextChangedEvent(nsAccEvent *aEvent,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAccessibleWrap::FireAtkShowHideEvent(nsAccEvent *aEvent,
|
||||
nsAccessibleWrap::FireAtkShowHideEvent(AccEvent* aEvent,
|
||||
AtkObject *aObject, PRBool aIsAdded)
|
||||
{
|
||||
if (aIsAdded)
|
||||
|
@ -100,7 +100,7 @@ public:
|
||||
|
||||
// return the atk object for this nsAccessibleWrap
|
||||
NS_IMETHOD GetNativeInterface(void **aOutAccessible);
|
||||
virtual nsresult HandleAccEvent(nsAccEvent *aEvent);
|
||||
virtual nsresult HandleAccEvent(AccEvent* aEvent);
|
||||
|
||||
AtkObject * GetAtkObject(void);
|
||||
static AtkObject * GetAtkObject(nsIAccessible * acc);
|
||||
@ -118,11 +118,11 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual nsresult FirePlatformEvent(nsAccEvent *aEvent);
|
||||
virtual nsresult FirePlatformEvent(AccEvent* aEvent);
|
||||
|
||||
nsresult FireAtkStateChangeEvent(nsAccEvent *aEvent, AtkObject *aObject);
|
||||
nsresult FireAtkTextChangedEvent(nsAccEvent *aEvent, AtkObject *aObject);
|
||||
nsresult FireAtkShowHideEvent(nsAccEvent *aEvent, AtkObject *aObject,
|
||||
nsresult FireAtkStateChangeEvent(AccEvent* aEvent, AtkObject *aObject);
|
||||
nsresult FireAtkTextChangedEvent(AccEvent* aEvent, AtkObject *aObject);
|
||||
nsresult FireAtkShowHideEvent(AccEvent* aEvent, AtkObject *aObject,
|
||||
PRBool aIsAdded);
|
||||
|
||||
AtkObject *mAtkObject;
|
||||
|
@ -20,7 +20,8 @@
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Original Author: Aaron Leventhal (aaronl@netscape.com)
|
||||
* Aaron Leventhal <aaronl@netscape.com> <original author>
|
||||
* Alexander Surkov <surkov.alexander@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
@ -36,7 +37,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAccEvent.h"
|
||||
#include "AccEvent.h"
|
||||
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccUtils.h"
|
||||
@ -46,6 +47,7 @@
|
||||
#ifdef MOZ_XUL
|
||||
#include "nsXULTreeAccessible.h"
|
||||
#endif
|
||||
#include "nsAccEvent.h"
|
||||
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
@ -55,44 +57,24 @@
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccEvent
|
||||
// AccEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccEvent. nsISupports
|
||||
// AccEvent constructors
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsAccEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsAccEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mAccessible)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsAccEvent)
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mAccessible");
|
||||
cb.NoteXPCOMChild(static_cast<nsIAccessible*>(tmp->mAccessible));
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsAccEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIAccessibleEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsAccEvent)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsAccEvent)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccEvent. Constructors
|
||||
|
||||
nsAccEvent::nsAccEvent(PRUint32 aEventType, nsAccessible *aAccessible,
|
||||
PRBool aIsAsync, EIsFromUserInput aIsFromUserInput,
|
||||
EEventRule aEventRule) :
|
||||
AccEvent::AccEvent(PRUint32 aEventType, nsAccessible* aAccessible,
|
||||
PRBool aIsAsync, EIsFromUserInput aIsFromUserInput,
|
||||
EEventRule aEventRule) :
|
||||
mEventType(aEventType), mEventRule(aEventRule), mIsAsync(aIsAsync),
|
||||
mAccessible(aAccessible)
|
||||
{
|
||||
CaptureIsFromUserInput(aIsFromUserInput);
|
||||
}
|
||||
|
||||
nsAccEvent::nsAccEvent(PRUint32 aEventType, nsINode *aNode,
|
||||
PRBool aIsAsync, EIsFromUserInput aIsFromUserInput,
|
||||
EEventRule aEventRule) :
|
||||
AccEvent::AccEvent(PRUint32 aEventType, nsINode* aNode,
|
||||
PRBool aIsAsync, EIsFromUserInput aIsFromUserInput,
|
||||
EEventRule aEventRule) :
|
||||
mEventType(aEventType), mEventRule(aEventRule), mIsAsync(aIsAsync),
|
||||
mNode(aNode)
|
||||
{
|
||||
@ -100,68 +82,10 @@ nsAccEvent::nsAccEvent(PRUint32 aEventType, nsINode *aNode,
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccEvent: nsIAccessibleEvent
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccEvent::GetIsFromUserInput(PRBool *aIsFromUserInput)
|
||||
{
|
||||
*aIsFromUserInput = mIsFromUserInput;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccEvent::SetIsFromUserInput(PRBool aIsFromUserInput)
|
||||
{
|
||||
mIsFromUserInput = aIsFromUserInput;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccEvent::GetEventType(PRUint32 *aEventType)
|
||||
{
|
||||
*aEventType = mEventType;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccEvent::GetAccessible(nsIAccessible **aAccessible)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAccessible);
|
||||
*aAccessible = nsnull;
|
||||
|
||||
NS_IF_ADDREF(*aAccessible = GetAccessible());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccEvent::GetDOMNode(nsIDOMNode **aDOMNode)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDOMNode);
|
||||
*aDOMNode = nsnull;
|
||||
|
||||
if (!mNode)
|
||||
mNode = GetNode();
|
||||
|
||||
if (mNode)
|
||||
CallQueryInterface(mNode, aDOMNode);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccEvent::GetAccessibleDocument(nsIAccessibleDocument **aDocAccessible)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDocAccessible);
|
||||
|
||||
NS_IF_ADDREF(*aDocAccessible = GetDocAccessible());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccEvent: public methods
|
||||
// AccEvent public methods
|
||||
|
||||
nsAccessible *
|
||||
nsAccEvent::GetAccessible()
|
||||
AccEvent::GetAccessible()
|
||||
{
|
||||
if (!mAccessible)
|
||||
mAccessible = GetAccessibleForNode();
|
||||
@ -170,7 +94,7 @@ nsAccEvent::GetAccessible()
|
||||
}
|
||||
|
||||
nsINode*
|
||||
nsAccEvent::GetNode()
|
||||
AccEvent::GetNode()
|
||||
{
|
||||
if (!mNode && mAccessible)
|
||||
mNode = mAccessible->GetNode();
|
||||
@ -179,7 +103,7 @@ nsAccEvent::GetNode()
|
||||
}
|
||||
|
||||
nsDocAccessible*
|
||||
nsAccEvent::GetDocAccessible()
|
||||
AccEvent::GetDocAccessible()
|
||||
{
|
||||
nsINode *node = GetNode();
|
||||
if (node)
|
||||
@ -188,11 +112,36 @@ nsAccEvent::GetDocAccessible()
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
already_AddRefed<nsAccEvent>
|
||||
AccEvent::CreateXPCOMObject()
|
||||
{
|
||||
nsAccEvent* event = new nsAccEvent(this);
|
||||
NS_IF_ADDREF(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccEvent: protected methods
|
||||
// AccEvent cycle collection
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(AccEvent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_NATIVE(AccEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mAccessible)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_BEGIN(AccEvent)
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mAccessible");
|
||||
cb.NoteXPCOMChild(static_cast<nsIAccessible*>(tmp->mAccessible));
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AccEvent, AddRef)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AccEvent, Release)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// AccEvent protected methods
|
||||
|
||||
nsAccessible *
|
||||
nsAccEvent::GetAccessibleForNode() const
|
||||
AccEvent::GetAccessibleForNode() const
|
||||
{
|
||||
if (!mNode)
|
||||
return nsnull;
|
||||
@ -227,7 +176,7 @@ nsAccEvent::GetAccessibleForNode() const
|
||||
}
|
||||
|
||||
void
|
||||
nsAccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
|
||||
AccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
|
||||
{
|
||||
nsINode *targetNode = GetNode();
|
||||
|
||||
@ -269,29 +218,26 @@ nsAccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccReorderEvent
|
||||
// AccReorderEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsAccReorderEvent, nsAccEvent)
|
||||
|
||||
nsAccReorderEvent::nsAccReorderEvent(nsAccessible *aAccTarget,
|
||||
PRBool aIsAsynch,
|
||||
PRBool aIsUnconditional,
|
||||
nsINode *aReasonNode) :
|
||||
nsAccEvent(::nsIAccessibleEvent::EVENT_REORDER, aAccTarget,
|
||||
aIsAsynch, eAutoDetect, nsAccEvent::eCoalesceFromSameSubtree),
|
||||
AccReorderEvent::
|
||||
AccReorderEvent(nsAccessible* aAccTarget, PRBool aIsAsynch,
|
||||
PRBool aIsUnconditional, nsINode* aReasonNode) :
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_REORDER, aAccTarget,
|
||||
aIsAsynch, eAutoDetect, AccEvent::eCoalesceFromSameSubtree),
|
||||
mUnconditionalEvent(aIsUnconditional), mReasonNode(aReasonNode)
|
||||
{
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsAccReorderEvent::IsUnconditionalEvent()
|
||||
AccReorderEvent::IsUnconditionalEvent()
|
||||
{
|
||||
return mUnconditionalEvent;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsAccReorderEvent::HasAccessibleInReasonSubtree()
|
||||
AccReorderEvent::HasAccessibleInReasonSubtree()
|
||||
{
|
||||
if (!mReasonNode)
|
||||
return PR_FALSE;
|
||||
@ -302,37 +248,34 @@ nsAccReorderEvent::HasAccessibleInReasonSubtree()
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccStateChangeEvent
|
||||
// AccStateChangeEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccStateChangeEvent, nsAccEvent,
|
||||
nsIAccessibleStateChangeEvent)
|
||||
|
||||
// Note: we pass in eAllowDupes to the base class because we don't currently
|
||||
// support correct state change coalescence (XXX Bug 569356). Also we need to
|
||||
// decide how to coalesce events created via accessible (instead of node).
|
||||
nsAccStateChangeEvent::
|
||||
nsAccStateChangeEvent(nsAccessible *aAccessible,
|
||||
PRUint32 aState, PRBool aIsExtraState,
|
||||
PRBool aIsEnabled, PRBool aIsAsynch,
|
||||
EIsFromUserInput aIsFromUserInput):
|
||||
nsAccEvent(nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible, aIsAsynch,
|
||||
aIsFromUserInput, eAllowDupes),
|
||||
AccStateChangeEvent::
|
||||
AccStateChangeEvent(nsAccessible* aAccessible,
|
||||
PRUint32 aState, PRBool aIsExtraState,
|
||||
PRBool aIsEnabled, PRBool aIsAsynch,
|
||||
EIsFromUserInput aIsFromUserInput):
|
||||
AccEvent(nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible, aIsAsynch,
|
||||
aIsFromUserInput, eAllowDupes),
|
||||
mState(aState), mIsExtraState(aIsExtraState), mIsEnabled(aIsEnabled)
|
||||
{
|
||||
}
|
||||
|
||||
nsAccStateChangeEvent::
|
||||
nsAccStateChangeEvent(nsINode *aNode, PRUint32 aState, PRBool aIsExtraState,
|
||||
PRBool aIsEnabled):
|
||||
nsAccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode),
|
||||
AccStateChangeEvent::
|
||||
AccStateChangeEvent(nsINode* aNode, PRUint32 aState, PRBool aIsExtraState,
|
||||
PRBool aIsEnabled):
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode),
|
||||
mState(aState), mIsExtraState(aIsExtraState), mIsEnabled(aIsEnabled)
|
||||
{
|
||||
}
|
||||
|
||||
nsAccStateChangeEvent::
|
||||
nsAccStateChangeEvent(nsINode *aNode, PRUint32 aState, PRBool aIsExtraState) :
|
||||
nsAccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode),
|
||||
AccStateChangeEvent::
|
||||
AccStateChangeEvent(nsINode* aNode, PRUint32 aState, PRBool aIsExtraState) :
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode),
|
||||
mState(aState), mIsExtraState(aIsExtraState)
|
||||
{
|
||||
// Use GetAccessibleForNode() because we do not want to store an accessible
|
||||
@ -348,37 +291,19 @@ nsAccStateChangeEvent::
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccStateChangeEvent::GetState(PRUint32 *aState)
|
||||
already_AddRefed<nsAccEvent>
|
||||
AccStateChangeEvent::CreateXPCOMObject()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aState);
|
||||
*aState = mState;
|
||||
return NS_OK;
|
||||
nsAccEvent* event = new nsAccStateChangeEvent(this);
|
||||
NS_IF_ADDREF(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccStateChangeEvent::IsExtraState(PRBool *aIsExtraState)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsExtraState);
|
||||
*aIsExtraState = mIsExtraState;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccStateChangeEvent::IsEnabled(PRBool *aIsEnabled)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsEnabled);
|
||||
*aIsEnabled = mIsEnabled;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccTextChangeEvent
|
||||
// AccTextChangeEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccTextChangeEvent, nsAccEvent,
|
||||
nsIAccessibleTextChangeEvent)
|
||||
|
||||
// Note: we pass in eAllowDupes to the base class because we don't support text
|
||||
// events coalescence. We fire delayed text change events in nsDocAccessible but
|
||||
// we continue to base the event off the accessible object rather than just the
|
||||
@ -387,49 +312,26 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsAccTextChangeEvent, nsAccEvent,
|
||||
// if the node was removed from the document. Either way, the AT won't work with
|
||||
// a defunct accessible so the behaviour should be equivalent.
|
||||
// XXX revisit this when coalescence is faster (eCoalesceFromSameSubtree)
|
||||
nsAccTextChangeEvent::
|
||||
nsAccTextChangeEvent(nsAccessible *aAccessible, PRInt32 aStart,
|
||||
nsAString& aModifiedText, PRBool aIsInserted,
|
||||
PRBool aIsAsynch, EIsFromUserInput aIsFromUserInput)
|
||||
: nsAccEvent(aIsInserted ?
|
||||
static_cast<PRUint32>(nsIAccessibleEvent::EVENT_TEXT_INSERTED) :
|
||||
static_cast<PRUint32>(nsIAccessibleEvent::EVENT_TEXT_REMOVED),
|
||||
aAccessible, aIsAsynch, aIsFromUserInput, eAllowDupes)
|
||||
AccTextChangeEvent::
|
||||
AccTextChangeEvent(nsAccessible* aAccessible, PRInt32 aStart,
|
||||
nsAString& aModifiedText, PRBool aIsInserted,
|
||||
PRBool aIsAsynch, EIsFromUserInput aIsFromUserInput)
|
||||
: AccEvent(aIsInserted ?
|
||||
static_cast<PRUint32>(nsIAccessibleEvent::EVENT_TEXT_INSERTED) :
|
||||
static_cast<PRUint32>(nsIAccessibleEvent::EVENT_TEXT_REMOVED),
|
||||
aAccessible, aIsAsynch, aIsFromUserInput, eAllowDupes)
|
||||
, mStart(aStart)
|
||||
, mIsInserted(aIsInserted)
|
||||
, mModifiedText(aModifiedText)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccTextChangeEvent::GetStart(PRInt32 *aStart)
|
||||
already_AddRefed<nsAccEvent>
|
||||
AccTextChangeEvent::CreateXPCOMObject()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aStart);
|
||||
*aStart = mStart;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccTextChangeEvent::GetLength(PRUint32 *aLength)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLength);
|
||||
*aLength = GetLength();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccTextChangeEvent::IsInserted(PRBool *aIsInserted)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsInserted);
|
||||
*aIsInserted = mIsInserted;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccTextChangeEvent::GetModifiedText(nsAString& aModifiedText)
|
||||
{
|
||||
aModifiedText = mModifiedText;
|
||||
return NS_OK;
|
||||
nsAccEvent* event = new nsAccTextChangeEvent(this);
|
||||
NS_IF_ADDREF(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
|
||||
@ -440,8 +342,8 @@ nsAccTextChangeEvent::GetModifiedText(nsAString& aModifiedText)
|
||||
AccHideEvent::
|
||||
AccHideEvent(nsAccessible* aTarget, nsINode* aTargetNode,
|
||||
PRBool aIsAsynch, EIsFromUserInput aIsFromUserInput) :
|
||||
nsAccEvent(nsIAccessibleEvent::EVENT_HIDE, aTarget, aIsAsynch,
|
||||
aIsFromUserInput, eCoalesceFromSameSubtree)
|
||||
AccEvent(nsIAccessibleEvent::EVENT_HIDE, aTarget, aIsAsynch,
|
||||
aIsFromUserInput, eCoalesceFromSameSubtree)
|
||||
{
|
||||
mNode = aTargetNode;
|
||||
mParent = mAccessible->GetCachedParent();
|
||||
@ -451,65 +353,50 @@ AccHideEvent::
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccCaretMoveEvent
|
||||
// AccCaretMoveEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccCaretMoveEvent, nsAccEvent,
|
||||
nsIAccessibleCaretMoveEvent)
|
||||
|
||||
nsAccCaretMoveEvent::
|
||||
nsAccCaretMoveEvent(nsAccessible *aAccessible, PRInt32 aCaretOffset) :
|
||||
nsAccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aAccessible, PR_TRUE), // Currently always asynch
|
||||
AccCaretMoveEvent::
|
||||
AccCaretMoveEvent(nsAccessible* aAccessible, PRInt32 aCaretOffset) :
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aAccessible, PR_TRUE), // Currently always asynch
|
||||
mCaretOffset(aCaretOffset)
|
||||
{
|
||||
}
|
||||
|
||||
nsAccCaretMoveEvent::
|
||||
nsAccCaretMoveEvent(nsINode *aNode) :
|
||||
nsAccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aNode, PR_TRUE), // Currently always asynch
|
||||
AccCaretMoveEvent::
|
||||
AccCaretMoveEvent(nsINode* aNode) :
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aNode, PR_TRUE), // Currently always asynch
|
||||
mCaretOffset(-1)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccCaretMoveEvent::GetCaretOffset(PRInt32* aCaretOffset)
|
||||
already_AddRefed<nsAccEvent>
|
||||
AccCaretMoveEvent::CreateXPCOMObject()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCaretOffset);
|
||||
|
||||
*aCaretOffset = mCaretOffset;
|
||||
return NS_OK;
|
||||
nsAccEvent* event = new nsAccCaretMoveEvent(this);
|
||||
NS_IF_ADDREF(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccTableChangeEvent
|
||||
// AccTableChangeEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccTableChangeEvent, nsAccEvent,
|
||||
nsIAccessibleTableChangeEvent)
|
||||
|
||||
nsAccTableChangeEvent::
|
||||
nsAccTableChangeEvent(nsAccessible *aAccessible, PRUint32 aEventType,
|
||||
PRInt32 aRowOrColIndex, PRInt32 aNumRowsOrCols, PRBool aIsAsynch):
|
||||
nsAccEvent(aEventType, aAccessible, aIsAsynch),
|
||||
AccTableChangeEvent::
|
||||
AccTableChangeEvent(nsAccessible* aAccessible, PRUint32 aEventType,
|
||||
PRInt32 aRowOrColIndex, PRInt32 aNumRowsOrCols,
|
||||
PRBool aIsAsynch) :
|
||||
AccEvent(aEventType, aAccessible, aIsAsynch),
|
||||
mRowOrColIndex(aRowOrColIndex), mNumRowsOrCols(aNumRowsOrCols)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccTableChangeEvent::GetRowOrColIndex(PRInt32* aRowOrColIndex)
|
||||
already_AddRefed<nsAccEvent>
|
||||
AccTableChangeEvent::CreateXPCOMObject()
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRowOrColIndex);
|
||||
|
||||
*aRowOrColIndex = mRowOrColIndex;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccTableChangeEvent::GetNumRowsOrCols(PRInt32* aNumRowsOrCols)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNumRowsOrCols);
|
||||
|
||||
*aNumRowsOrCols = mNumRowsOrCols;
|
||||
return NS_OK;
|
||||
nsAccEvent* event = new nsAccTableChangeEvent(this);
|
||||
NS_IF_ADDREF(event);
|
||||
return event;
|
||||
}
|
||||
|
@ -38,13 +38,12 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsAccEvent_H_
|
||||
#define _nsAccEvent_H_
|
||||
|
||||
#include "nsIAccessibleEvent.h"
|
||||
#ifndef _AccEvent_H_
|
||||
#define _AccEvent_H_
|
||||
|
||||
#include "nsAccessible.h"
|
||||
|
||||
class nsAccEvent;
|
||||
class nsDocAccessible;
|
||||
|
||||
// Constants used to point whether the event is from user input.
|
||||
@ -61,7 +60,7 @@ enum EIsFromUserInput
|
||||
/**
|
||||
* Generic accessible event.
|
||||
*/
|
||||
class nsAccEvent: public nsIAccessibleEvent
|
||||
class AccEvent
|
||||
{
|
||||
public:
|
||||
|
||||
@ -90,22 +89,17 @@ public:
|
||||
};
|
||||
|
||||
// Initialize with an nsIAccessible
|
||||
nsAccEvent(PRUint32 aEventType, nsAccessible *aAccessible,
|
||||
PRBool aIsAsynch = PR_FALSE,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect,
|
||||
EEventRule aEventRule = eRemoveDupes);
|
||||
AccEvent(PRUint32 aEventType, nsAccessible* aAccessible,
|
||||
PRBool aIsAsynch = PR_FALSE,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect,
|
||||
EEventRule aEventRule = eRemoveDupes);
|
||||
// Initialize with an nsIDOMNode
|
||||
nsAccEvent(PRUint32 aEventType, nsINode *aNode, PRBool aIsAsynch = PR_FALSE,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect,
|
||||
EEventRule aEventRule = eRemoveDupes);
|
||||
virtual ~nsAccEvent() {}
|
||||
AccEvent(PRUint32 aEventType, nsINode* aNode, PRBool aIsAsynch = PR_FALSE,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect,
|
||||
EEventRule aEventRule = eRemoveDupes);
|
||||
virtual ~AccEvent() {}
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsAccEvent)
|
||||
|
||||
NS_DECL_NSIACCESSIBLEEVENT
|
||||
|
||||
// nsAccEvent
|
||||
// AccEvent
|
||||
PRUint32 GetEventType() const { return mEventType; }
|
||||
EEventRule GetEventRule() const { return mEventRule; }
|
||||
PRBool IsAsync() const { return mIsAsync; }
|
||||
@ -115,6 +109,14 @@ public:
|
||||
nsDocAccessible* GetDocAccessible();
|
||||
nsINode* GetNode();
|
||||
|
||||
/**
|
||||
* Create and return an XPCOM object for accessible event object.
|
||||
*/
|
||||
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
|
||||
|
||||
/**
|
||||
* Down casting.
|
||||
*/
|
||||
enum EventGroup {
|
||||
eGenericEvent,
|
||||
eReorderEvent,
|
||||
@ -131,6 +133,12 @@ public:
|
||||
return 1U << eGenericEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reference counting and cycle collection.
|
||||
*/
|
||||
NS_INLINE_DECL_REFCOUNTING(AccEvent)
|
||||
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(AccEvent)
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Get an accessible from event target node.
|
||||
@ -144,7 +152,6 @@ protected:
|
||||
void CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput);
|
||||
|
||||
PRBool mIsFromUserInput;
|
||||
|
||||
PRUint32 mEventType;
|
||||
EEventRule mEventRule;
|
||||
PRPackedBool mIsAsync;
|
||||
@ -158,22 +165,20 @@ protected:
|
||||
/**
|
||||
* Accessible reorder event.
|
||||
*/
|
||||
class nsAccReorderEvent : public nsAccEvent
|
||||
class AccReorderEvent : public AccEvent
|
||||
{
|
||||
public:
|
||||
nsAccReorderEvent(nsAccessible *aAccTarget, PRBool aIsAsynch,
|
||||
PRBool aIsUnconditional, nsINode *aReasonNode);
|
||||
AccReorderEvent(nsAccessible* aAccTarget, PRBool aIsAsynch,
|
||||
PRBool aIsUnconditional, nsINode* aReasonNode);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsAccEvent
|
||||
// AccEvent
|
||||
static const EventGroup kEventGroup = eReorderEvent;
|
||||
virtual unsigned int GetEventGroups() const
|
||||
{
|
||||
return nsAccEvent::GetEventGroups() | (1U << eReorderEvent);
|
||||
return AccEvent::GetEventGroups() | (1U << eReorderEvent);
|
||||
}
|
||||
|
||||
// nsAccReorderEvent
|
||||
// AccReorderEvent
|
||||
/**
|
||||
* Return true if event is unconditional, i.e. must be fired.
|
||||
*/
|
||||
@ -193,31 +198,29 @@ private:
|
||||
/**
|
||||
* Accessible state change event.
|
||||
*/
|
||||
class nsAccStateChangeEvent: public nsAccEvent,
|
||||
public nsIAccessibleStateChangeEvent
|
||||
class AccStateChangeEvent: public AccEvent
|
||||
{
|
||||
public:
|
||||
nsAccStateChangeEvent(nsAccessible *aAccessible,
|
||||
PRUint32 aState, PRBool aIsExtraState,
|
||||
PRBool aIsEnabled, PRBool aIsAsynch = PR_FALSE,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect);
|
||||
AccStateChangeEvent(nsAccessible* aAccessible,
|
||||
PRUint32 aState, PRBool aIsExtraState,
|
||||
PRBool aIsEnabled, PRBool aIsAsynch = PR_FALSE,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect);
|
||||
|
||||
nsAccStateChangeEvent(nsINode *aNode, PRUint32 aState, PRBool aIsExtraState,
|
||||
PRBool aIsEnabled);
|
||||
AccStateChangeEvent(nsINode* aNode, PRUint32 aState, PRBool aIsExtraState,
|
||||
PRBool aIsEnabled);
|
||||
|
||||
nsAccStateChangeEvent(nsINode *aNode, PRUint32 aState, PRBool aIsExtraState);
|
||||
AccStateChangeEvent(nsINode* aNode, PRUint32 aState, PRBool aIsExtraState);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLESTATECHANGEEVENT
|
||||
// AccEvent
|
||||
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
|
||||
|
||||
// nsAccEvent
|
||||
static const EventGroup kEventGroup = eStateChangeEvent;
|
||||
virtual unsigned int GetEventGroups() const
|
||||
{
|
||||
return nsAccEvent::GetEventGroups() | (1U << eStateChangeEvent);
|
||||
return AccEvent::GetEventGroups() | (1U << eStateChangeEvent);
|
||||
}
|
||||
|
||||
// nsAccStateChangeEvent
|
||||
// AccStateChangeEvent
|
||||
PRUint32 GetState() const { return mState; }
|
||||
PRBool IsExtraState() const { return mIsExtraState; }
|
||||
PRBool IsStateEnabled() const { return mIsEnabled; }
|
||||
@ -232,29 +235,29 @@ private:
|
||||
/**
|
||||
* Accessible text change event.
|
||||
*/
|
||||
class nsAccTextChangeEvent: public nsAccEvent,
|
||||
public nsIAccessibleTextChangeEvent
|
||||
class AccTextChangeEvent: public AccEvent
|
||||
{
|
||||
public:
|
||||
nsAccTextChangeEvent(nsAccessible *aAccessible, PRInt32 aStart,
|
||||
nsAString& aModifiedText,
|
||||
PRBool aIsInserted, PRBool aIsAsynch = PR_FALSE,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect);
|
||||
AccTextChangeEvent(nsAccessible* aAccessible, PRInt32 aStart,
|
||||
nsAString& aModifiedText,
|
||||
PRBool aIsInserted, PRBool aIsAsynch = PR_FALSE,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLETEXTCHANGEEVENT
|
||||
// AccEvent
|
||||
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
|
||||
|
||||
// nsAccEvent
|
||||
static const EventGroup kEventGroup = eTextChangeEvent;
|
||||
virtual unsigned int GetEventGroups() const
|
||||
{
|
||||
return nsAccEvent::GetEventGroups() | (1U << eTextChangeEvent);
|
||||
return AccEvent::GetEventGroups() | (1U << eTextChangeEvent);
|
||||
}
|
||||
|
||||
// nsAccTextChangeEvent
|
||||
// AccTextChangeEvent
|
||||
PRInt32 GetStartOffset() const { return mStart; }
|
||||
PRUint32 GetLength() const { return mModifiedText.Length(); }
|
||||
PRBool IsTextInserted() const { return mIsInserted; }
|
||||
void GetModifiedText(nsAString& aModifiedText)
|
||||
{ aModifiedText = mModifiedText; }
|
||||
|
||||
private:
|
||||
PRInt32 mStart;
|
||||
@ -268,24 +271,24 @@ private:
|
||||
/**
|
||||
* Accessible hide events.
|
||||
*/
|
||||
class AccHideEvent : public nsAccEvent
|
||||
class AccHideEvent : public AccEvent
|
||||
{
|
||||
public:
|
||||
AccHideEvent(nsAccessible* aTarget, nsINode* aTargetNode,
|
||||
PRBool aIsAsynch, EIsFromUserInput aIsFromUserInput);
|
||||
|
||||
// nsAccEvent
|
||||
// Event
|
||||
static const EventGroup kEventGroup = eHideEvent;
|
||||
virtual unsigned int GetEventGroups() const
|
||||
{
|
||||
return nsAccEvent::GetEventGroups() | (1U << eHideEvent);
|
||||
return AccEvent::GetEventGroups() | (1U << eHideEvent);
|
||||
}
|
||||
|
||||
protected:
|
||||
nsRefPtr<nsAccessible> mParent;
|
||||
nsRefPtr<nsAccessible> mNextSibling;
|
||||
nsRefPtr<nsAccessible> mPrevSibling;
|
||||
nsRefPtr<nsAccTextChangeEvent> mTextChangeEvent;
|
||||
nsRefPtr<AccTextChangeEvent> mTextChangeEvent;
|
||||
|
||||
friend class nsAccEventQueue;
|
||||
};
|
||||
@ -294,24 +297,22 @@ protected:
|
||||
/**
|
||||
* Accessible caret move event.
|
||||
*/
|
||||
class nsAccCaretMoveEvent: public nsAccEvent,
|
||||
public nsIAccessibleCaretMoveEvent
|
||||
class AccCaretMoveEvent: public AccEvent
|
||||
{
|
||||
public:
|
||||
nsAccCaretMoveEvent(nsAccessible *aAccessible, PRInt32 aCaretOffset);
|
||||
nsAccCaretMoveEvent(nsINode *aNode);
|
||||
AccCaretMoveEvent(nsAccessible* aAccessible, PRInt32 aCaretOffset);
|
||||
AccCaretMoveEvent(nsINode* aNode);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLECARETMOVEEVENT
|
||||
// AccEvent
|
||||
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
|
||||
|
||||
// nsAccEvent
|
||||
static const EventGroup kEventGroup = eCaretMoveEvent;
|
||||
virtual unsigned int GetEventGroups() const
|
||||
{
|
||||
return nsAccEvent::GetEventGroups() | (1U << eCaretMoveEvent);
|
||||
return AccEvent::GetEventGroups() | (1U << eCaretMoveEvent);
|
||||
}
|
||||
|
||||
// nsAccCaretMoveEvent
|
||||
// AccCaretMoveEvent
|
||||
PRInt32 GetCaretOffset() const { return mCaretOffset; }
|
||||
|
||||
private:
|
||||
@ -322,25 +323,23 @@ private:
|
||||
/**
|
||||
* Accessible table change event.
|
||||
*/
|
||||
class nsAccTableChangeEvent : public nsAccEvent,
|
||||
public nsIAccessibleTableChangeEvent
|
||||
class AccTableChangeEvent : public AccEvent
|
||||
{
|
||||
public:
|
||||
nsAccTableChangeEvent(nsAccessible *aAccessible, PRUint32 aEventType,
|
||||
PRInt32 aRowOrColIndex, PRInt32 aNumRowsOrCols,
|
||||
PRBool aIsAsynch);
|
||||
AccTableChangeEvent(nsAccessible* aAccessible, PRUint32 aEventType,
|
||||
PRInt32 aRowOrColIndex, PRInt32 aNumRowsOrCols,
|
||||
PRBool aIsAsynch);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLETABLECHANGEEVENT
|
||||
// AccEvent
|
||||
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
|
||||
|
||||
// nsAccEvent
|
||||
static const EventGroup kEventGroup = eTableChangeEvent;
|
||||
virtual unsigned int GetEventGroups() const
|
||||
{
|
||||
return nsAccEvent::GetEventGroups() | (1U << eTableChangeEvent);
|
||||
return AccEvent::GetEventGroups() | (1U << eTableChangeEvent);
|
||||
}
|
||||
|
||||
// nsAccTableChangeEvent
|
||||
// AccTableChangeEvent
|
||||
PRUint32 GetIndex() const { return mRowOrColIndex; }
|
||||
PRUint32 GetCount() const { return mNumRowsOrCols; }
|
||||
|
||||
@ -356,7 +355,7 @@ private:
|
||||
class downcast_accEvent
|
||||
{
|
||||
public:
|
||||
downcast_accEvent(nsAccEvent *e) : mRawPtr(e) { }
|
||||
downcast_accEvent(AccEvent* e) : mRawPtr(e) { }
|
||||
|
||||
template<class Destination>
|
||||
operator Destination*() {
|
||||
@ -368,7 +367,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
nsAccEvent *mRawPtr;
|
||||
AccEvent* mRawPtr;
|
||||
};
|
||||
|
||||
#endif
|
@ -49,12 +49,12 @@ LIBXUL_LIBRARY = 1
|
||||
|
||||
CPPSRCS = \
|
||||
AccCollector.cpp \
|
||||
AccEvent.cpp \
|
||||
AccGroupInfo.cpp \
|
||||
AccIterator.cpp \
|
||||
filters.cpp \
|
||||
nsAccDocManager.cpp \
|
||||
nsAccessNode.cpp \
|
||||
nsAccEvent.cpp \
|
||||
nsARIAGridAccessible.cpp \
|
||||
nsARIAMap.cpp \
|
||||
nsDocAccessible.cpp \
|
||||
@ -91,6 +91,7 @@ include $(topsrcdir)/config/rules.mk
|
||||
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(srcdir) \
|
||||
-I$(srcdir)/../xpcom \
|
||||
-I$(srcdir)/../html \
|
||||
-I$(srcdir)/../xul \
|
||||
-I$(srcdir)/../../../layout/generic \
|
||||
|
@ -235,16 +235,16 @@ nsAccDocManager::OnStateChange(nsIWebProgress *aWebProgress,
|
||||
loadType == LOAD_RELOAD_BYPASS_PROXY_AND_CACHE) {
|
||||
|
||||
// Fire reload event.
|
||||
nsRefPtr<nsAccEvent> reloadEvent =
|
||||
new nsAccEvent(nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD, docAcc);
|
||||
nsRefPtr<AccEvent> reloadEvent =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD, docAcc);
|
||||
nsEventShell::FireEvent(reloadEvent);
|
||||
}
|
||||
|
||||
// Fire state busy change event. Use delayed event since we don't care
|
||||
// actually if event isn't delivered when the document goes away like a shot.
|
||||
nsRefPtr<nsAccEvent> stateEvent =
|
||||
new nsAccStateChangeEvent(document, nsIAccessibleStates::STATE_BUSY,
|
||||
PR_FALSE, PR_TRUE);
|
||||
nsRefPtr<AccEvent> stateEvent =
|
||||
new AccStateChangeEvent(document, nsIAccessibleStates::STATE_BUSY,
|
||||
PR_FALSE, PR_TRUE);
|
||||
docAcc->FireDelayedAccessibleEvent(stateEvent);
|
||||
|
||||
return NS_OK;
|
||||
@ -378,14 +378,14 @@ nsAccDocManager::HandleDOMDocumentLoad(nsIDocument *aDocument,
|
||||
|
||||
// Fire complete/load stopped if the load event type is given.
|
||||
if (aLoadEventType) {
|
||||
nsRefPtr<nsAccEvent> loadEvent = new nsAccEvent(aLoadEventType, aDocument);
|
||||
nsRefPtr<AccEvent> loadEvent = new AccEvent(aLoadEventType, aDocument);
|
||||
docAcc->FireDelayedAccessibleEvent(loadEvent);
|
||||
}
|
||||
|
||||
// Fire busy state change event.
|
||||
nsRefPtr<nsAccEvent> stateEvent =
|
||||
new nsAccStateChangeEvent(aDocument, nsIAccessibleStates::STATE_BUSY,
|
||||
PR_FALSE, PR_FALSE);
|
||||
nsRefPtr<AccEvent> stateEvent =
|
||||
new AccStateChangeEvent(aDocument, nsIAccessibleStates::STATE_BUSY,
|
||||
PR_FALSE, PR_FALSE);
|
||||
docAcc->FireDelayedAccessibleEvent(stateEvent);
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,7 @@ private:
|
||||
} else if (type == nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD) { \
|
||||
strEventType.AssignLiteral("reload"); \
|
||||
} else if (type == nsIAccessibleEvent::EVENT_STATE_CHANGE) { \
|
||||
nsAccStateChangeEvent *event = downcast_accEvent(aEvent); \
|
||||
AccStateChangeEvent* event = downcast_accEvent(aEvent); \
|
||||
if (event->GetState() == nsIAccessibleStates::STATE_BUSY) { \
|
||||
strEventType.AssignLiteral("busy "); \
|
||||
if (event->IsStateEnabled()) \
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "nsDocAccessible.h"
|
||||
#include "nsEventShell.h"
|
||||
|
||||
#include "nsAccEvent.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccTreeWalker.h"
|
||||
#include "nsRelUtils.h"
|
||||
@ -1240,7 +1241,7 @@ nsAccessible::GetXULName(nsAString& aLabel)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAccessible::HandleAccEvent(nsAccEvent *aEvent)
|
||||
nsAccessible::HandleAccEvent(AccEvent* aEvent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aEvent);
|
||||
|
||||
@ -1248,7 +1249,20 @@ nsAccessible::HandleAccEvent(nsAccEvent *aEvent)
|
||||
mozilla::services::GetObserverService();
|
||||
NS_ENSURE_TRUE(obsService, NS_ERROR_FAILURE);
|
||||
|
||||
return obsService->NotifyObservers(aEvent, NS_ACCESSIBLE_EVENT_TOPIC, nsnull);
|
||||
nsCOMPtr<nsISimpleEnumerator> observers;
|
||||
obsService->EnumerateObservers(NS_ACCESSIBLE_EVENT_TOPIC,
|
||||
getter_AddRefs(observers));
|
||||
|
||||
NS_ENSURE_STATE(observers);
|
||||
|
||||
PRBool hasObservers = PR_FALSE;
|
||||
observers->HasMoreElements(&hasObservers);
|
||||
if (hasObservers) {
|
||||
nsRefPtr<nsAccEvent> evnt(aEvent->CreateXPCOMObject());
|
||||
return obsService->NotifyObservers(evnt, NS_ACCESSIBLE_EVENT_TOPIC, nsnull);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -55,7 +55,7 @@
|
||||
class AccGroupInfo;
|
||||
class EmbeddedObjCollector;
|
||||
class nsAccessible;
|
||||
class nsAccEvent;
|
||||
class AccEvent;
|
||||
struct nsRoleMapEntry;
|
||||
|
||||
struct nsRect;
|
||||
@ -303,7 +303,7 @@ public:
|
||||
* Handle accessible event, i.e. process it, notifies observers and fires
|
||||
* platform specific event.
|
||||
*/
|
||||
virtual nsresult HandleAccEvent(nsAccEvent *aAccEvent);
|
||||
virtual nsresult HandleAccEvent(AccEvent* aAccEvent);
|
||||
|
||||
/**
|
||||
* Return true if there are accessible children in anonymous content
|
||||
@ -454,7 +454,7 @@ protected:
|
||||
*
|
||||
* @param aEvent the accessible event to fire.
|
||||
*/
|
||||
virtual nsresult FirePlatformEvent(nsAccEvent *aEvent) = 0;
|
||||
virtual nsresult FirePlatformEvent(AccEvent* aEvent) = 0;
|
||||
|
||||
// Data Members
|
||||
nsRefPtr<nsAccessible> mParent;
|
||||
|
@ -264,8 +264,7 @@ nsCaretAccessible::NormalSelectionChanged(nsIDOMDocument *aDoc,
|
||||
mLastCaretOffset = caretOffset;
|
||||
mLastTextAccessible.swap(textAcc);
|
||||
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccCaretMoveEvent(textNode);
|
||||
nsRefPtr<AccEvent> event = new AccCaretMoveEvent(textNode);
|
||||
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return mRootAccessible->FireDelayedAccessibleEvent(event);
|
||||
@ -285,9 +284,9 @@ nsCaretAccessible::SpellcheckSelectionChanged(nsIDOMDocument *aDoc,
|
||||
nsAccUtils::GetTextAccessibleFromSelection(aSel);
|
||||
NS_ENSURE_STATE(textAcc);
|
||||
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccEvent(nsIAccessibleEvent::EVENT_TEXT_ATTRIBUTE_CHANGED,
|
||||
textAcc, nsnull);
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_TEXT_ATTRIBUTE_CHANGED,
|
||||
textAcc, nsnull);
|
||||
|
||||
nsEventShell::FireEvent(event);
|
||||
return NS_OK;
|
||||
|
@ -611,8 +611,8 @@ nsDocAccessible::Init()
|
||||
|
||||
// Fire reorder event to notify new accessible document has been created and
|
||||
// attached to the tree.
|
||||
nsRefPtr<nsAccEvent> reorderEvent =
|
||||
new nsAccReorderEvent(mParent, PR_FALSE, PR_TRUE, mDocument);
|
||||
nsRefPtr<AccEvent> reorderEvent =
|
||||
new AccReorderEvent(mParent, PR_FALSE, PR_TRUE, mDocument);
|
||||
if (!reorderEvent)
|
||||
return PR_FALSE;
|
||||
|
||||
@ -878,11 +878,11 @@ NS_IMETHODIMP nsDocAccessible::Observe(nsISupports *aSubject, const char *aTopic
|
||||
if (!nsCRT::strcmp(aTopic,"obs_documentCreated")) {
|
||||
// State editable will now be set, readonly is now clear
|
||||
// Normally we only fire delayed events created from the node, not an
|
||||
// accessible object. See the nsAccStateChangeEvent constructor for details
|
||||
// accessible object. See the AccStateChangeEvent constructor for details
|
||||
// about this exceptional case.
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccStateChangeEvent(this, nsIAccessibleStates::EXT_STATE_EDITABLE,
|
||||
PR_TRUE, PR_TRUE);
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(this, nsIAccessibleStates::EXT_STATE_EDITABLE,
|
||||
PR_TRUE, PR_TRUE);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
}
|
||||
|
||||
@ -972,17 +972,17 @@ nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID
|
||||
// Note. We use the attribute instead of the disabled state bit because
|
||||
// ARIA's aria-disabled does not affect the disabled state bit.
|
||||
|
||||
nsRefPtr<nsAccEvent> enabledChangeEvent =
|
||||
new nsAccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::EXT_STATE_ENABLED,
|
||||
PR_TRUE);
|
||||
nsRefPtr<AccEvent> enabledChangeEvent =
|
||||
new AccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::EXT_STATE_ENABLED,
|
||||
PR_TRUE);
|
||||
|
||||
FireDelayedAccessibleEvent(enabledChangeEvent);
|
||||
|
||||
nsRefPtr<nsAccEvent> sensitiveChangeEvent =
|
||||
new nsAccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::EXT_STATE_SENSITIVE,
|
||||
PR_TRUE);
|
||||
nsRefPtr<AccEvent> sensitiveChangeEvent =
|
||||
new AccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::EXT_STATE_SENSITIVE,
|
||||
PR_TRUE);
|
||||
|
||||
FireDelayedAccessibleEvent(sensitiveChangeEvent);
|
||||
return;
|
||||
@ -1033,7 +1033,7 @@ nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID
|
||||
// seem right but we had started using it for something else
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN,
|
||||
multiSelect->GetNode(),
|
||||
nsAccEvent::eAllowDupes);
|
||||
AccEvent::eAllowDupes);
|
||||
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
{&nsAccessibilityAtoms::_empty, &nsAccessibilityAtoms::_false, nsnull};
|
||||
@ -1050,10 +1050,10 @@ nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID
|
||||
}
|
||||
|
||||
if (aAttribute == nsAccessibilityAtoms::contenteditable) {
|
||||
nsRefPtr<nsAccEvent> editableChangeEvent =
|
||||
new nsAccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::EXT_STATE_EDITABLE,
|
||||
PR_TRUE);
|
||||
nsRefPtr<AccEvent> editableChangeEvent =
|
||||
new AccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::EXT_STATE_EDITABLE,
|
||||
PR_TRUE);
|
||||
FireDelayedAccessibleEvent(editableChangeEvent);
|
||||
return;
|
||||
}
|
||||
@ -1067,19 +1067,17 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
// there is an ARIA role present or not.
|
||||
|
||||
if (aAttribute == nsAccessibilityAtoms::aria_required) {
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::STATE_REQUIRED,
|
||||
PR_FALSE);
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_REQUIRED,
|
||||
PR_FALSE);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
if (aAttribute == nsAccessibilityAtoms::aria_invalid) {
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::STATE_INVALID,
|
||||
PR_FALSE);
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_INVALID,
|
||||
PR_FALSE);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
return;
|
||||
}
|
||||
@ -1107,10 +1105,9 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
|
||||
// We treat aria-expanded as a global ARIA state for historical reasons
|
||||
if (aAttribute == nsAccessibilityAtoms::aria_expanded) {
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::STATE_EXPANDED,
|
||||
PR_FALSE);
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_EXPANDED,
|
||||
PR_FALSE);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
return;
|
||||
}
|
||||
@ -1129,8 +1126,8 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
const PRUint32 kState = (aAttribute == nsAccessibilityAtoms::aria_checked) ?
|
||||
nsIAccessibleStates::STATE_CHECKED :
|
||||
nsIAccessibleStates::STATE_PRESSED;
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccStateChangeEvent(aContent, kState, PR_FALSE);
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, kState, PR_FALSE);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
if (aContent == gLastFocusedNode) {
|
||||
// State changes for MIXED state currently only supported for focused item, because
|
||||
@ -1143,10 +1140,9 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
PRBool isMixed =
|
||||
(nsAccUtils::State(accessible) & nsIAccessibleStates::STATE_MIXED) != 0;
|
||||
if (wasMixed != isMixed) {
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::STATE_MIXED,
|
||||
PR_FALSE, isMixed);
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_MIXED,
|
||||
PR_FALSE, isMixed);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
}
|
||||
}
|
||||
@ -1155,10 +1151,9 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
}
|
||||
|
||||
if (aAttribute == nsAccessibilityAtoms::aria_readonly) {
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccStateChangeEvent(aContent,
|
||||
nsIAccessibleStates::STATE_READONLY,
|
||||
PR_FALSE);
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(aContent, nsIAccessibleStates::STATE_READONLY,
|
||||
PR_FALSE);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
return;
|
||||
}
|
||||
@ -1277,7 +1272,7 @@ nsDocAccessible::ParentChainChanged(nsIContent *aContent)
|
||||
|
||||
#ifdef DEBUG_ACCDOCMGR
|
||||
nsresult
|
||||
nsDocAccessible::HandleAccEvent(nsAccEvent *aAccEvent)
|
||||
nsDocAccessible::HandleAccEvent(AccEvent* aAccEvent)
|
||||
{
|
||||
NS_LOG_ACCDOCLOAD_HANDLEEVENT(aAccEvent)
|
||||
|
||||
@ -1300,9 +1295,9 @@ nsDocAccessible::FireValueChangeForTextFields(nsAccessible *aAccessible)
|
||||
return;
|
||||
|
||||
// Dependent value change event for text changes in textfields
|
||||
nsRefPtr<nsAccEvent> valueChangeEvent =
|
||||
new nsAccEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible,
|
||||
PR_FALSE, eAutoDetect, nsAccEvent::eRemoveDupes);
|
||||
nsRefPtr<AccEvent> valueChangeEvent =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible,
|
||||
PR_FALSE, eAutoDetect, AccEvent::eRemoveDupes);
|
||||
FireDelayedAccessibleEvent(valueChangeEvent);
|
||||
}
|
||||
|
||||
@ -1355,17 +1350,17 @@ nsDocAccessible::FireTextChangeEventForText(nsIContent *aContent,
|
||||
return;
|
||||
|
||||
// Normally we only fire delayed events created from the node, not an
|
||||
// accessible object. See the nsAccTextChangeEvent constructor for details
|
||||
// accessible object. See the AccTextChangeEvent constructor for details
|
||||
// about this exceptional case.
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccTextChangeEvent(textAccessible, offset + textOffset, text,
|
||||
aIsInserted, PR_FALSE);
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccTextChangeEvent(textAccessible, offset + textOffset, text,
|
||||
aIsInserted, PR_FALSE);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
|
||||
FireValueChangeForTextFields(textAccessible);
|
||||
}
|
||||
|
||||
already_AddRefed<nsAccEvent>
|
||||
already_AddRefed<AccEvent>
|
||||
nsDocAccessible::CreateTextChangeEventForNode(nsAccessible *aContainerAccessible,
|
||||
nsIContent *aChangeNode,
|
||||
nsAccessible *aChangeChild,
|
||||
@ -1432,9 +1427,9 @@ nsDocAccessible::CreateTextChangeEventForNode(nsAccessible *aContainerAccessible
|
||||
if (text.IsEmpty())
|
||||
return nsnull;
|
||||
|
||||
nsAccEvent *event =
|
||||
new nsAccTextChangeEvent(aContainerAccessible, offset, text,
|
||||
aIsInserting, aIsAsynch, aIsFromUserInput);
|
||||
AccEvent* event = new AccTextChangeEvent(aContainerAccessible, offset, text,
|
||||
aIsInserting, aIsAsynch,
|
||||
aIsFromUserInput);
|
||||
NS_IF_ADDREF(event);
|
||||
|
||||
return event;
|
||||
@ -1443,12 +1438,12 @@ nsDocAccessible::CreateTextChangeEventForNode(nsAccessible *aContainerAccessible
|
||||
// nsDocAccessible public member
|
||||
nsresult
|
||||
nsDocAccessible::FireDelayedAccessibleEvent(PRUint32 aEventType, nsINode *aNode,
|
||||
nsAccEvent::EEventRule aAllowDupes,
|
||||
AccEvent::EEventRule aAllowDupes,
|
||||
PRBool aIsAsynch,
|
||||
EIsFromUserInput aIsFromUserInput)
|
||||
{
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccEvent(aEventType, aNode, aIsAsynch, aIsFromUserInput, aAllowDupes);
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccEvent(aEventType, aNode, aIsAsynch, aIsFromUserInput, aAllowDupes);
|
||||
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return FireDelayedAccessibleEvent(event);
|
||||
@ -1456,7 +1451,7 @@ nsDocAccessible::FireDelayedAccessibleEvent(PRUint32 aEventType, nsINode *aNode,
|
||||
|
||||
// nsDocAccessible public member
|
||||
nsresult
|
||||
nsDocAccessible::FireDelayedAccessibleEvent(nsAccEvent *aEvent)
|
||||
nsDocAccessible::FireDelayedAccessibleEvent(AccEvent* aEvent)
|
||||
{
|
||||
NS_ENSURE_ARG(aEvent);
|
||||
NS_LOG_ACCDOCLOAD_FIREEVENT(aEvent)
|
||||
@ -1468,7 +1463,7 @@ nsDocAccessible::FireDelayedAccessibleEvent(nsAccEvent *aEvent)
|
||||
}
|
||||
|
||||
void
|
||||
nsDocAccessible::ProcessPendingEvent(nsAccEvent *aEvent)
|
||||
nsDocAccessible::ProcessPendingEvent(AccEvent* aEvent)
|
||||
{
|
||||
nsAccessible *accessible = aEvent->GetAccessible();
|
||||
nsINode *node = aEvent->GetNode();
|
||||
@ -1535,7 +1530,7 @@ nsDocAccessible::ProcessPendingEvent(nsAccEvent *aEvent)
|
||||
// the offset, length and text for the text change.
|
||||
if (node && node != mDocument) {
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
||||
nsRefPtr<nsAccEvent> textChangeEvent =
|
||||
nsRefPtr<AccEvent> textChangeEvent =
|
||||
CreateTextChangeEventForNode(containerAccessible, content, accessible,
|
||||
PR_TRUE, PR_TRUE, isFromUserInput);
|
||||
if (textChangeEvent) {
|
||||
@ -1569,8 +1564,8 @@ nsDocAccessible::ProcessPendingEvent(nsAccEvent *aEvent)
|
||||
GetAccService()->GetAccessible(gLastFocusedNode);
|
||||
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_ALERT, focusedAcc);
|
||||
#endif
|
||||
nsRefPtr<nsAccEvent> caretMoveEvent =
|
||||
new nsAccCaretMoveEvent(accessible, caretOffset);
|
||||
nsRefPtr<AccEvent> caretMoveEvent =
|
||||
new AccCaretMoveEvent(accessible, caretOffset);
|
||||
if (!caretMoveEvent)
|
||||
return;
|
||||
|
||||
@ -1588,7 +1583,7 @@ nsDocAccessible::ProcessPendingEvent(nsAccEvent *aEvent)
|
||||
// Fire reorder event if it's unconditional (see InvalidateCacheSubtree
|
||||
// method) or if changed node (that is the reason of this reorder event)
|
||||
// is accessible or has accessible children.
|
||||
nsAccReorderEvent *reorderEvent = downcast_accEvent(aEvent);
|
||||
AccReorderEvent* reorderEvent = downcast_accEvent(aEvent);
|
||||
if (reorderEvent->IsUnconditionalEvent() ||
|
||||
reorderEvent->HasAccessibleInReasonSubtree()) {
|
||||
nsEventShell::FireEvent(aEvent);
|
||||
@ -1857,7 +1852,7 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
||||
// nsIAccessibleStates::STATE_INVISIBLE for the event's accessible object.
|
||||
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_SHOW, childNode,
|
||||
nsAccEvent::eCoalesceFromSameSubtree,
|
||||
AccEvent::eCoalesceFromSameSubtree,
|
||||
isAsynch);
|
||||
|
||||
// Check to see change occurred in an ARIA menu, and fire
|
||||
@ -1865,7 +1860,7 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
||||
nsRoleMapEntry *roleMapEntry = nsAccUtils::GetRoleMapEntry(childNode);
|
||||
if (roleMapEntry && roleMapEntry->role == nsIAccessibleRole::ROLE_MENUPOPUP) {
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_START,
|
||||
childNode, nsAccEvent::eRemoveDupes,
|
||||
childNode, AccEvent::eRemoveDupes,
|
||||
isAsynch);
|
||||
}
|
||||
|
||||
@ -1874,7 +1869,7 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
||||
while (PR_TRUE) {
|
||||
if (roleMapEntry && roleMapEntry->role == nsIAccessibleRole::ROLE_ALERT) {
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_ALERT, ancestor,
|
||||
nsAccEvent::eRemoveDupes, isAsynch);
|
||||
AccEvent::eRemoveDupes, isAsynch);
|
||||
break;
|
||||
}
|
||||
ancestor = ancestor->GetParent();
|
||||
@ -1902,10 +1897,9 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
|
||||
PRBool isUnconditionalEvent = childAccessible ||
|
||||
aChild && nsAccUtils::HasAccessibleChildren(childNode);
|
||||
|
||||
nsRefPtr<nsAccEvent> reorderEvent =
|
||||
new nsAccReorderEvent(containerAccessible, isAsynch,
|
||||
isUnconditionalEvent,
|
||||
aChild ? aChild : nsnull);
|
||||
nsRefPtr<AccEvent> reorderEvent =
|
||||
new AccReorderEvent(containerAccessible, isAsynch, isUnconditionalEvent,
|
||||
aChild ? aChild : nsnull);
|
||||
NS_ENSURE_TRUE(reorderEvent,);
|
||||
|
||||
FireDelayedAccessibleEvent(reorderEvent);
|
||||
@ -1935,7 +1929,7 @@ nsDocAccessible::FireShowHideEvents(nsINode *aNode,
|
||||
if (accessible) {
|
||||
// Found an accessible, so fire the show/hide on it and don't look further
|
||||
// into this subtree.
|
||||
nsRefPtr<nsAccEvent> event;
|
||||
nsRefPtr<AccEvent> event;
|
||||
if (aDelayedOrNormal == eDelayedEvent &&
|
||||
aEventType == nsIAccessibleEvent::EVENT_HIDE) {
|
||||
// Use AccHideEvent for delayed hide events to coalesce text change events
|
||||
@ -1944,9 +1938,9 @@ nsDocAccessible::FireShowHideEvents(nsINode *aNode,
|
||||
aIsAsyncChange, aIsFromUserInput);
|
||||
|
||||
} else {
|
||||
event = new nsAccEvent(aEventType, accessible, aIsAsyncChange,
|
||||
aIsFromUserInput,
|
||||
nsAccEvent::eCoalesceFromSameSubtree);
|
||||
event = new AccEvent(aEventType, accessible, aIsAsyncChange,
|
||||
aIsFromUserInput,
|
||||
AccEvent::eCoalesceFromSameSubtree);
|
||||
}
|
||||
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
|
@ -117,7 +117,7 @@ public:
|
||||
virtual void SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry);
|
||||
|
||||
#ifdef DEBUG_ACCDOCMGR
|
||||
virtual nsresult HandleAccEvent(nsAccEvent *aAccEvent);
|
||||
virtual nsresult HandleAccEvent(AccEvent* aAccEvent);
|
||||
#endif
|
||||
|
||||
// nsIAccessibleText
|
||||
@ -151,7 +151,7 @@ public:
|
||||
* code synchronous with a DOM event
|
||||
*/
|
||||
nsresult FireDelayedAccessibleEvent(PRUint32 aEventType, nsINode *aNode,
|
||||
nsAccEvent::EEventRule aAllowDupes = nsAccEvent::eRemoveDupes,
|
||||
AccEvent::EEventRule aAllowDupes = AccEvent::eRemoveDupes,
|
||||
PRBool aIsAsynch = PR_FALSE,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect);
|
||||
|
||||
@ -160,7 +160,7 @@ public:
|
||||
*
|
||||
* @param aEvent [in] the event to fire
|
||||
*/
|
||||
nsresult FireDelayedAccessibleEvent(nsAccEvent *aEvent);
|
||||
nsresult FireDelayedAccessibleEvent(AccEvent* aEvent);
|
||||
|
||||
/**
|
||||
* Find the accessible object in the accessibility cache that corresponds to
|
||||
@ -207,7 +207,7 @@ public:
|
||||
* Process the event when the queue of pending events is untwisted. Fire
|
||||
* accessible events as result of the processing.
|
||||
*/
|
||||
void ProcessPendingEvent(nsAccEvent* aEvent);
|
||||
void ProcessPendingEvent(AccEvent* aEvent);
|
||||
|
||||
protected:
|
||||
|
||||
@ -276,7 +276,7 @@ protected:
|
||||
* @param aIsAsync [in] whether casual change is async
|
||||
* @param aIsFromUserInput [in] the event is known to be from user input
|
||||
*/
|
||||
already_AddRefed<nsAccEvent>
|
||||
already_AddRefed<AccEvent>
|
||||
CreateTextChangeEventForNode(nsAccessible *aContainerAccessible,
|
||||
nsIContent *aChangeNode,
|
||||
nsAccessible *aAccessible,
|
||||
|
@ -47,7 +47,7 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void
|
||||
nsEventShell::FireEvent(nsAccEvent *aEvent)
|
||||
nsEventShell::FireEvent(AccEvent* aEvent)
|
||||
{
|
||||
if (!aEvent)
|
||||
return;
|
||||
@ -72,8 +72,8 @@ nsEventShell::FireEvent(PRUint32 aEventType, nsAccessible *aAccessible,
|
||||
{
|
||||
NS_ENSURE_TRUE(aAccessible,);
|
||||
|
||||
nsRefPtr<nsAccEvent> event = new nsAccEvent(aEventType, aAccessible,
|
||||
aIsAsynch, aIsFromUserInput);
|
||||
nsRefPtr<AccEvent> event = new AccEvent(aEventType, aAccessible,
|
||||
aIsAsynch, aIsFromUserInput);
|
||||
|
||||
FireEvent(event);
|
||||
}
|
||||
@ -123,12 +123,7 @@ NS_INTERFACE_MAP_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsAccEventQueue)
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mDocument");
|
||||
cb.NoteXPCOMChild(static_cast<nsIAccessible*>(tmp->mDocument.get()));
|
||||
|
||||
PRUint32 i, length = tmp->mEvents.Length();
|
||||
for (i = 0; i < length; ++i) {
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvents[i]");
|
||||
cb.NoteXPCOMChild(tmp->mEvents[i].get());
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSTARRAY_MEMBER(mEvents, AccEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsAccEventQueue)
|
||||
@ -143,7 +138,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsAccEventQueue)
|
||||
// nsAccEventQueue: public
|
||||
|
||||
void
|
||||
nsAccEventQueue::Push(nsAccEvent *aEvent)
|
||||
nsAccEventQueue::Push(AccEvent* aEvent)
|
||||
{
|
||||
mEvents.AppendElement(aEvent);
|
||||
|
||||
@ -203,15 +198,15 @@ nsAccEventQueue::WillRefresh(mozilla::TimeStamp aTime)
|
||||
|
||||
// Process only currently queued events. Newly appended events during events
|
||||
// flushing won't be processed.
|
||||
nsTArray < nsRefPtr<nsAccEvent> > events;
|
||||
nsTArray < nsRefPtr<AccEvent> > events;
|
||||
events.SwapElements(mEvents);
|
||||
PRUint32 length = events.Length();
|
||||
NS_ASSERTION(length, "How did we get here without events to fire?");
|
||||
|
||||
for (PRUint32 index = 0; index < length; index ++) {
|
||||
|
||||
nsAccEvent *accEvent = events[index];
|
||||
if (accEvent->mEventRule != nsAccEvent::eDoNotEmit) {
|
||||
AccEvent* accEvent = events[index];
|
||||
if (accEvent->mEventRule != AccEvent::eDoNotEmit) {
|
||||
mDocument->ProcessPendingEvent(accEvent);
|
||||
|
||||
AccHideEvent* hideEvent = downcast_accEvent(accEvent);
|
||||
@ -240,7 +235,7 @@ nsAccEventQueue::CoalesceEvents()
|
||||
{
|
||||
PRUint32 numQueuedEvents = mEvents.Length();
|
||||
PRInt32 tail = numQueuedEvents - 1;
|
||||
nsAccEvent* tailEvent = mEvents[tail];
|
||||
AccEvent* tailEvent = mEvents[tail];
|
||||
|
||||
// No node means this is application accessible (which can be a subject
|
||||
// of reorder events), we do not coalesce events for it currently.
|
||||
@ -248,10 +243,10 @@ nsAccEventQueue::CoalesceEvents()
|
||||
return;
|
||||
|
||||
switch(tailEvent->mEventRule) {
|
||||
case nsAccEvent::eCoalesceFromSameSubtree:
|
||||
case AccEvent::eCoalesceFromSameSubtree:
|
||||
{
|
||||
for (PRInt32 index = tail - 1; index >= 0; index--) {
|
||||
nsAccEvent* thisEvent = mEvents[index];
|
||||
AccEvent* thisEvent = mEvents[index];
|
||||
|
||||
if (thisEvent->mEventType != tailEvent->mEventType)
|
||||
continue; // Different type
|
||||
@ -280,7 +275,7 @@ nsAccEventQueue::CoalesceEvents()
|
||||
tailEvent->mEventRule = thisEvent->mEventRule;
|
||||
|
||||
// Coalesce text change events for hide events.
|
||||
if (tailEvent->mEventRule != nsAccEvent::eDoNotEmit)
|
||||
if (tailEvent->mEventRule != AccEvent::eDoNotEmit)
|
||||
CoalesceTextChangeEventsFor(tailHideEvent, thisHideEvent);
|
||||
|
||||
return;
|
||||
@ -302,7 +297,7 @@ nsAccEventQueue::CoalesceEvents()
|
||||
PRBool thisCanBeDescendantOfTail = PR_FALSE;
|
||||
|
||||
// Coalesce depending on whether this event was coalesced or not.
|
||||
if (thisEvent->mEventRule == nsAccEvent::eDoNotEmit) {
|
||||
if (thisEvent->mEventRule == AccEvent::eDoNotEmit) {
|
||||
// If this event was coalesced then do not emit tail event iff tail
|
||||
// event has the same target or its target is contained by this event
|
||||
// target. Note, we don't need to check whether tail event target
|
||||
@ -313,7 +308,7 @@ nsAccEventQueue::CoalesceEvents()
|
||||
// node siblings while this event was coalesced.
|
||||
|
||||
if (thisEvent->mNode == tailEvent->mNode) {
|
||||
thisEvent->mEventRule = nsAccEvent::eDoNotEmit;
|
||||
thisEvent->mEventRule = AccEvent::eDoNotEmit;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -331,11 +326,11 @@ nsAccEventQueue::CoalesceEvents()
|
||||
// be conditional events (be or not be fired in the end).
|
||||
if (thisEvent->mEventType == nsIAccessibleEvent::EVENT_REORDER) {
|
||||
CoalesceReorderEventsFromSameSource(thisEvent, tailEvent);
|
||||
if (tailEvent->mEventRule != nsAccEvent::eDoNotEmit)
|
||||
if (tailEvent->mEventRule != AccEvent::eDoNotEmit)
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
tailEvent->mEventRule = nsAccEvent::eDoNotEmit;
|
||||
tailEvent->mEventRule = AccEvent::eDoNotEmit;
|
||||
}
|
||||
|
||||
return;
|
||||
@ -367,13 +362,13 @@ nsAccEventQueue::CoalesceEvents()
|
||||
|
||||
if (thisEvent->mEventType == nsIAccessibleEvent::EVENT_REORDER) {
|
||||
CoalesceReorderEventsFromSameTree(thisEvent, tailEvent);
|
||||
if (tailEvent->mEventRule != nsAccEvent::eDoNotEmit)
|
||||
if (tailEvent->mEventRule != AccEvent::eDoNotEmit)
|
||||
continue;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
tailEvent->mEventRule = nsAccEvent::eDoNotEmit;
|
||||
tailEvent->mEventRule = AccEvent::eDoNotEmit;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -391,7 +386,7 @@ nsAccEventQueue::CoalesceEvents()
|
||||
|
||||
if (thisEvent->mEventType == nsIAccessibleEvent::EVENT_REORDER) {
|
||||
CoalesceReorderEventsFromSameTree(tailEvent, thisEvent);
|
||||
if (tailEvent->mEventRule != nsAccEvent::eDoNotEmit)
|
||||
if (tailEvent->mEventRule != AccEvent::eDoNotEmit)
|
||||
continue;
|
||||
|
||||
return;
|
||||
@ -399,9 +394,9 @@ nsAccEventQueue::CoalesceEvents()
|
||||
|
||||
// Do not emit thisEvent, also apply this result to sibling nodes of
|
||||
// thisNode.
|
||||
thisEvent->mEventRule = nsAccEvent::eDoNotEmit;
|
||||
thisEvent->mEventRule = AccEvent::eDoNotEmit;
|
||||
ApplyToSiblings(0, index, thisEvent->mEventType,
|
||||
thisEvent->mNode, nsAccEvent::eDoNotEmit);
|
||||
thisEvent->mNode, AccEvent::eDoNotEmit);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -416,32 +411,32 @@ nsAccEventQueue::CoalesceEvents()
|
||||
|
||||
} break; // case eCoalesceFromSameSubtree
|
||||
|
||||
case nsAccEvent::eCoalesceFromSameDocument:
|
||||
case AccEvent::eCoalesceFromSameDocument:
|
||||
{
|
||||
// Used for focus event, coalesce more older event since focus event
|
||||
// for accessible can be duplicated by event for its document, we are
|
||||
// interested in focus event for accessible.
|
||||
for (PRInt32 index = tail - 1; index >= 0; index--) {
|
||||
nsAccEvent* thisEvent = mEvents[index];
|
||||
AccEvent* thisEvent = mEvents[index];
|
||||
if (thisEvent->mEventType == tailEvent->mEventType &&
|
||||
thisEvent->mEventRule == tailEvent->mEventRule &&
|
||||
thisEvent->GetDocAccessible() == tailEvent->GetDocAccessible()) {
|
||||
thisEvent->mEventRule = nsAccEvent::eDoNotEmit;
|
||||
thisEvent->mEventRule = AccEvent::eDoNotEmit;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} break; // case eCoalesceFromSameDocument
|
||||
|
||||
case nsAccEvent::eRemoveDupes:
|
||||
case AccEvent::eRemoveDupes:
|
||||
{
|
||||
// Check for repeat events, coalesce newly appended event by more older
|
||||
// event.
|
||||
for (PRInt32 index = tail - 1; index >= 0; index--) {
|
||||
nsAccEvent* accEvent = mEvents[index];
|
||||
AccEvent* accEvent = mEvents[index];
|
||||
if (accEvent->mEventType == tailEvent->mEventType &&
|
||||
accEvent->mEventRule == tailEvent->mEventRule &&
|
||||
accEvent->mNode == tailEvent->mNode) {
|
||||
tailEvent->mEventRule = nsAccEvent::eDoNotEmit;
|
||||
tailEvent->mEventRule = AccEvent::eDoNotEmit;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -455,12 +450,12 @@ nsAccEventQueue::CoalesceEvents()
|
||||
void
|
||||
nsAccEventQueue::ApplyToSiblings(PRUint32 aStart, PRUint32 aEnd,
|
||||
PRUint32 aEventType, nsINode* aNode,
|
||||
nsAccEvent::EEventRule aEventRule)
|
||||
AccEvent::EEventRule aEventRule)
|
||||
{
|
||||
for (PRUint32 index = aStart; index < aEnd; index ++) {
|
||||
nsAccEvent* accEvent = mEvents[index];
|
||||
AccEvent* accEvent = mEvents[index];
|
||||
if (accEvent->mEventType == aEventType &&
|
||||
accEvent->mEventRule != nsAccEvent::eDoNotEmit &&
|
||||
accEvent->mEventRule != AccEvent::eDoNotEmit &&
|
||||
accEvent->mNode->GetNodeParent() == aNode->GetNodeParent()) {
|
||||
accEvent->mEventRule = aEventRule;
|
||||
}
|
||||
@ -468,38 +463,38 @@ nsAccEventQueue::ApplyToSiblings(PRUint32 aStart, PRUint32 aEnd,
|
||||
}
|
||||
|
||||
void
|
||||
nsAccEventQueue::CoalesceReorderEventsFromSameSource(nsAccEvent *aAccEvent1,
|
||||
nsAccEvent *aAccEvent2)
|
||||
nsAccEventQueue::CoalesceReorderEventsFromSameSource(AccEvent* aAccEvent1,
|
||||
AccEvent* aAccEvent2)
|
||||
{
|
||||
// Do not emit event2 if event1 is unconditional.
|
||||
nsAccReorderEvent *reorderEvent1 = downcast_accEvent(aAccEvent1);
|
||||
AccReorderEvent* reorderEvent1 = downcast_accEvent(aAccEvent1);
|
||||
if (reorderEvent1->IsUnconditionalEvent()) {
|
||||
aAccEvent2->mEventRule = nsAccEvent::eDoNotEmit;
|
||||
aAccEvent2->mEventRule = AccEvent::eDoNotEmit;
|
||||
return;
|
||||
}
|
||||
|
||||
// Do not emit event1 if event2 is unconditional.
|
||||
nsAccReorderEvent *reorderEvent2 = downcast_accEvent(aAccEvent2);
|
||||
AccReorderEvent* reorderEvent2 = downcast_accEvent(aAccEvent2);
|
||||
if (reorderEvent2->IsUnconditionalEvent()) {
|
||||
aAccEvent1->mEventRule = nsAccEvent::eDoNotEmit;
|
||||
aAccEvent1->mEventRule = AccEvent::eDoNotEmit;
|
||||
return;
|
||||
}
|
||||
|
||||
// Do not emit event2 if event1 is valid, otherwise do not emit event1.
|
||||
if (reorderEvent1->HasAccessibleInReasonSubtree())
|
||||
aAccEvent2->mEventRule = nsAccEvent::eDoNotEmit;
|
||||
aAccEvent2->mEventRule = AccEvent::eDoNotEmit;
|
||||
else
|
||||
aAccEvent1->mEventRule = nsAccEvent::eDoNotEmit;
|
||||
aAccEvent1->mEventRule = AccEvent::eDoNotEmit;
|
||||
}
|
||||
|
||||
void
|
||||
nsAccEventQueue::CoalesceReorderEventsFromSameTree(nsAccEvent *aAccEvent,
|
||||
nsAccEvent *aDescendantAccEvent)
|
||||
nsAccEventQueue::CoalesceReorderEventsFromSameTree(AccEvent* aAccEvent,
|
||||
AccEvent* aDescendantAccEvent)
|
||||
{
|
||||
// Do not emit descendant event if this event is unconditional.
|
||||
nsAccReorderEvent *reorderEvent = downcast_accEvent(aAccEvent);
|
||||
AccReorderEvent* reorderEvent = downcast_accEvent(aAccEvent);
|
||||
if (reorderEvent->IsUnconditionalEvent())
|
||||
aDescendantAccEvent->mEventRule = nsAccEvent::eDoNotEmit;
|
||||
aDescendantAccEvent->mEventRule = AccEvent::eDoNotEmit;
|
||||
}
|
||||
|
||||
void
|
||||
@ -509,7 +504,7 @@ nsAccEventQueue::CoalesceTextChangeEventsFor(AccHideEvent* aTailEvent,
|
||||
// XXX: we need a way to ignore SplitNode and JoinNode() when they do not
|
||||
// affect the text within the hypertext.
|
||||
|
||||
nsAccTextChangeEvent* textEvent = aThisEvent->mTextChangeEvent;
|
||||
AccTextChangeEvent* textEvent = aThisEvent->mTextChangeEvent;
|
||||
if (!textEvent)
|
||||
return;
|
||||
|
||||
@ -557,7 +552,7 @@ nsAccEventQueue::CreateTextChangeEventFor(AccHideEvent* aEvent)
|
||||
return;
|
||||
|
||||
aEvent->mTextChangeEvent =
|
||||
new nsAccTextChangeEvent(textAccessible, offset, text, PR_FALSE,
|
||||
aEvent->mIsAsync,
|
||||
aEvent->mIsFromUserInput ? eFromUserInput : eNoUserInput);
|
||||
new AccTextChangeEvent(textAccessible, offset, text, PR_FALSE,
|
||||
aEvent->mIsAsync,
|
||||
aEvent->mIsFromUserInput ? eFromUserInput : eNoUserInput);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@
|
||||
#ifndef _nsEventShell_H_
|
||||
#define _nsEventShell_H_
|
||||
|
||||
#include "nsAccEvent.h"
|
||||
#include "AccEvent.h"
|
||||
|
||||
#include "a11yGeneric.h"
|
||||
|
||||
@ -59,7 +59,7 @@ public:
|
||||
/**
|
||||
* Fire the accessible event.
|
||||
*/
|
||||
static void FireEvent(nsAccEvent *aEvent);
|
||||
static void FireEvent(AccEvent* aEvent);
|
||||
|
||||
/**
|
||||
* Fire accessible event of the given type for the given accessible.
|
||||
@ -105,7 +105,7 @@ public:
|
||||
/**
|
||||
* Push event to queue, coalesce it if necessary. Start pending processing.
|
||||
*/
|
||||
void Push(nsAccEvent *aEvent);
|
||||
void Push(AccEvent* aEvent);
|
||||
|
||||
/**
|
||||
* Shutdown the queue.
|
||||
@ -142,20 +142,20 @@ private:
|
||||
*/
|
||||
void ApplyToSiblings(PRUint32 aStart, PRUint32 aEnd,
|
||||
PRUint32 aEventType, nsINode* aNode,
|
||||
nsAccEvent::EEventRule aEventRule);
|
||||
AccEvent::EEventRule aEventRule);
|
||||
|
||||
/**
|
||||
* Do not emit one of two given reorder events fired for the same DOM node.
|
||||
*/
|
||||
void CoalesceReorderEventsFromSameSource(nsAccEvent *aAccEvent1,
|
||||
nsAccEvent *aAccEvent2);
|
||||
void CoalesceReorderEventsFromSameSource(AccEvent* aAccEvent1,
|
||||
AccEvent* aAccEvent2);
|
||||
|
||||
/**
|
||||
* Do not emit one of two given reorder events fired for DOM nodes in the case
|
||||
* when one DOM node is in parent chain of second one.
|
||||
*/
|
||||
void CoalesceReorderEventsFromSameTree(nsAccEvent *aAccEvent,
|
||||
nsAccEvent *aDescendantAccEvent);
|
||||
void CoalesceReorderEventsFromSameTree(AccEvent* aAccEvent,
|
||||
AccEvent* aDescendantAccEvent);
|
||||
|
||||
/**
|
||||
* Coalesce text change events caused by sibling hide events.
|
||||
@ -186,7 +186,7 @@ private:
|
||||
* Pending events array. Don't make this an nsAutoTArray; we use
|
||||
* SwapElements() on it.
|
||||
*/
|
||||
nsTArray<nsRefPtr<nsAccEvent> > mEvents;
|
||||
nsTArray<nsRefPtr<AccEvent> > mEvents;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -403,10 +403,10 @@ nsRootAccessible::FireAccessibleFocusEvent(nsAccessible *aAccessible,
|
||||
if (menuBarAccessible) {
|
||||
mCurrentARIAMenubar = menuBarAccessible->GetNode();
|
||||
if (mCurrentARIAMenubar) {
|
||||
nsRefPtr<nsAccEvent> menuStartEvent =
|
||||
new nsAccEvent(nsIAccessibleEvent::EVENT_MENU_START,
|
||||
menuBarAccessible, PR_FALSE, aIsFromUserInput,
|
||||
nsAccEvent::eAllowDupes);
|
||||
nsRefPtr<AccEvent> menuStartEvent =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_MENU_START,
|
||||
menuBarAccessible, PR_FALSE, aIsFromUserInput,
|
||||
AccEvent::eAllowDupes);
|
||||
if (menuStartEvent) {
|
||||
FireDelayedAccessibleEvent(menuStartEvent);
|
||||
}
|
||||
@ -416,9 +416,9 @@ nsRootAccessible::FireAccessibleFocusEvent(nsAccessible *aAccessible,
|
||||
}
|
||||
}
|
||||
else if (mCurrentARIAMenubar) {
|
||||
nsRefPtr<nsAccEvent> menuEndEvent =
|
||||
new nsAccEvent(nsIAccessibleEvent::EVENT_MENU_END, mCurrentARIAMenubar,
|
||||
PR_FALSE, aIsFromUserInput, nsAccEvent::eAllowDupes);
|
||||
nsRefPtr<AccEvent> menuEndEvent =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_MENU_END, mCurrentARIAMenubar,
|
||||
PR_FALSE, aIsFromUserInput, AccEvent::eAllowDupes);
|
||||
if (menuEndEvent) {
|
||||
FireDelayedAccessibleEvent(menuEndEvent);
|
||||
}
|
||||
@ -446,7 +446,7 @@ nsRootAccessible::FireAccessibleFocusEvent(nsAccessible *aAccessible,
|
||||
// Coalesce focus events from the same document, because DOM focus event might
|
||||
// be fired for the document node and then for the focused DOM element.
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_FOCUS,
|
||||
finalFocusNode, nsAccEvent::eCoalesceFromSameDocument,
|
||||
finalFocusNode, AccEvent::eCoalesceFromSameDocument,
|
||||
aIsAsynch, aIsFromUserInput);
|
||||
|
||||
return PR_TRUE;
|
||||
@ -549,9 +549,9 @@ nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
||||
PRBool isEnabled = (state & (nsIAccessibleStates::STATE_CHECKED |
|
||||
nsIAccessibleStates::STATE_SELECTED)) != 0;
|
||||
|
||||
nsRefPtr<nsAccEvent> accEvent =
|
||||
new nsAccStateChangeEvent(accessible, nsIAccessibleStates::STATE_CHECKED,
|
||||
PR_FALSE, isEnabled);
|
||||
nsRefPtr<AccEvent> accEvent =
|
||||
new AccStateChangeEvent(accessible, nsIAccessibleStates::STATE_CHECKED,
|
||||
PR_FALSE, isEnabled);
|
||||
nsEventShell::FireEvent(accEvent);
|
||||
|
||||
if (isEnabled)
|
||||
@ -565,10 +565,9 @@ nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
||||
|
||||
PRBool isEnabled = !!(state & nsIAccessibleStates::STATE_CHECKED);
|
||||
|
||||
nsRefPtr<nsAccEvent> accEvent =
|
||||
new nsAccStateChangeEvent(accessible,
|
||||
nsIAccessibleStates::STATE_CHECKED,
|
||||
PR_FALSE, isEnabled);
|
||||
nsRefPtr<AccEvent> accEvent =
|
||||
new AccStateChangeEvent(accessible, nsIAccessibleStates::STATE_CHECKED,
|
||||
PR_FALSE, isEnabled);
|
||||
|
||||
nsEventShell::FireEvent(accEvent);
|
||||
return NS_OK;
|
||||
@ -600,9 +599,9 @@ nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
||||
PRUint32 state = nsAccUtils::State(accessible); // collapsed/expanded changed
|
||||
PRBool isEnabled = (state & nsIAccessibleStates::STATE_EXPANDED) != 0;
|
||||
|
||||
nsRefPtr<nsAccEvent> accEvent =
|
||||
new nsAccStateChangeEvent(accessible, nsIAccessibleStates::STATE_EXPANDED,
|
||||
PR_FALSE, isEnabled);
|
||||
nsRefPtr<AccEvent> accEvent =
|
||||
new AccStateChangeEvent(accessible, nsIAccessibleStates::STATE_EXPANDED,
|
||||
PR_FALSE, isEnabled);
|
||||
nsEventShell::FireEvent(accEvent);
|
||||
return NS_OK;
|
||||
}
|
||||
@ -753,7 +752,7 @@ nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
||||
}
|
||||
else if (eventType.EqualsLiteral("ValueChange")) {
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
|
||||
targetNode, nsAccEvent::eRemoveDupes);
|
||||
targetNode, AccEvent::eRemoveDupes);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else if (eventType.EqualsLiteral("mouseover")) {
|
||||
@ -887,10 +886,10 @@ nsRootAccessible::HandlePopupShownEvent(nsAccessible *aAccessible)
|
||||
PRUint32 comboboxRole = nsAccUtils::Role(comboboxAcc);
|
||||
if (comboboxRole == nsIAccessibleRole::ROLE_COMBOBOX ||
|
||||
comboboxRole == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccStateChangeEvent(comboboxAcc,
|
||||
nsIAccessibleStates::STATE_EXPANDED,
|
||||
PR_FALSE, PR_TRUE);
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(comboboxAcc,
|
||||
nsIAccessibleStates::STATE_EXPANDED,
|
||||
PR_FALSE, PR_TRUE);
|
||||
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsEventShell::FireEvent(event);
|
||||
@ -929,10 +928,10 @@ nsRootAccessible::HandlePopupHidingEvent(nsINode *aNode,
|
||||
PRUint32 comboboxRole = nsAccUtils::Role(comboboxAcc);
|
||||
if (comboboxRole == nsIAccessibleRole::ROLE_COMBOBOX ||
|
||||
comboboxRole == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccStateChangeEvent(comboboxAcc,
|
||||
nsIAccessibleStates::STATE_EXPANDED,
|
||||
PR_FALSE, PR_FALSE);
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(comboboxAcc,
|
||||
nsIAccessibleStates::STATE_EXPANDED,
|
||||
PR_FALSE, PR_FALSE);
|
||||
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsEventShell::FireEvent(event);
|
||||
|
@ -763,8 +763,8 @@ nsHTMLSelectOptionAccessible::SelectionChangedIfOption(nsIContent *aPossibleOpti
|
||||
return;
|
||||
|
||||
|
||||
nsRefPtr<nsAccEvent> selWithinEvent =
|
||||
new nsAccEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN, multiSelect);
|
||||
nsRefPtr<AccEvent> selWithinEvent =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN, multiSelect);
|
||||
|
||||
if (!selWithinEvent)
|
||||
return;
|
||||
@ -780,8 +780,7 @@ nsHTMLSelectOptionAccessible::SelectionChangedIfOption(nsIContent *aPossibleOpti
|
||||
eventType = nsIAccessibleEvent::EVENT_SELECTION_REMOVE;
|
||||
}
|
||||
|
||||
nsRefPtr<nsAccEvent> selAddRemoveEvent =
|
||||
new nsAccEvent(eventType, option);
|
||||
nsRefPtr<AccEvent> selAddRemoveEvent = new AccEvent(eventType, option);
|
||||
|
||||
if (selAddRemoveEvent)
|
||||
option->GetDocAccessible()->FireDelayedAccessibleEvent(selAddRemoveEvent);
|
||||
|
@ -78,7 +78,7 @@ class nsAccessibleWrap : public nsAccessible
|
||||
virtual void Shutdown ();
|
||||
virtual void InvalidateChildren();
|
||||
|
||||
virtual nsresult HandleAccEvent(nsAccEvent *aEvent);
|
||||
virtual nsresult HandleAccEvent(AccEvent* aEvent);
|
||||
|
||||
// ignored means that the accessible might still have children, but is not displayed
|
||||
// to the user. it also has no native accessible object represented for it.
|
||||
@ -98,7 +98,7 @@ class nsAccessibleWrap : public nsAccessible
|
||||
|
||||
protected:
|
||||
|
||||
virtual nsresult FirePlatformEvent(nsAccEvent *aEvent);
|
||||
virtual nsresult FirePlatformEvent(AccEvent* aEvent);
|
||||
|
||||
/**
|
||||
* Return true if the parent doesn't have children to expose to AT.
|
||||
|
@ -161,7 +161,7 @@ nsAccessibleWrap::Shutdown ()
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
|
||||
nsAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
@ -174,7 +174,7 @@ nsAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
|
||||
nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
|
@ -70,7 +70,7 @@ PRBool nsAccessNodeWrap::gIsEnumVariantSupportDisabled = 0;
|
||||
// Used to determine whether an IAccessible2 compatible screen reader is loaded.
|
||||
PRBool nsAccessNodeWrap::gIsIA2Disabled = PR_FALSE;
|
||||
|
||||
nsAccTextChangeEvent *nsAccessNodeWrap::gTextEvent = nsnull;
|
||||
AccTextChangeEvent* nsAccessNodeWrap::gTextEvent = nsnull;
|
||||
|
||||
// Pref to disallow CtrlTab preview functionality if JAWS or Window-Eyes are
|
||||
// running.
|
||||
|
@ -71,7 +71,7 @@
|
||||
typedef LRESULT (STDAPICALLTYPE *LPFNNOTIFYWINEVENT)(DWORD event,HWND hwnd,LONG idObjectType,LONG idObject);
|
||||
typedef LRESULT (STDAPICALLTYPE *LPFNGETGUITHREADINFO)(DWORD idThread, GUITHREADINFO* pgui);
|
||||
|
||||
class nsAccTextChangeEvent;
|
||||
class AccTextChangeEvent;
|
||||
|
||||
class nsAccessNodeWrap : public nsAccessNode,
|
||||
public nsIWinAccessNode,
|
||||
@ -187,7 +187,7 @@ protected:
|
||||
* It is used in nsHyperTextAccessibleWrap for IA2::newText/oldText
|
||||
* implementation.
|
||||
*/
|
||||
static nsAccTextChangeEvent *gTextEvent;
|
||||
static AccTextChangeEvent* gTextEvent;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1582,7 +1582,7 @@ NS_IMETHODIMP nsAccessibleWrap::GetNativeInterface(void **aOutAccessible)
|
||||
// nsAccessible
|
||||
|
||||
nsresult
|
||||
nsAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
|
||||
nsAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
|
||||
{
|
||||
nsresult rv = nsAccessible::HandleAccEvent(aEvent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -1591,7 +1591,7 @@ nsAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
|
||||
nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
|
||||
{
|
||||
PRUint32 eventType = aEvent->GetEventType();
|
||||
|
||||
|
@ -307,7 +307,7 @@ public: // construction, destruction
|
||||
UINT *puArgErr);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult HandleAccEvent(nsAccEvent *aEvent);
|
||||
virtual nsresult HandleAccEvent(AccEvent* aEvent);
|
||||
|
||||
// Helper methods
|
||||
static PRInt32 GetChildIDFor(nsIAccessible* aAccessible);
|
||||
@ -346,7 +346,7 @@ public: // construction, destruction
|
||||
void UnattachIEnumVariant();
|
||||
|
||||
protected:
|
||||
virtual nsresult FirePlatformEvent(nsAccEvent *aEvent);
|
||||
virtual nsresult FirePlatformEvent(AccEvent* aEvent);
|
||||
|
||||
// mEnumVARIANTPosition not the current accessible's position, but a "cursor" of
|
||||
// where we are in the current list of children, with respect to
|
||||
|
@ -51,7 +51,7 @@ IMPL_IUNKNOWN_INHERITED2(nsHyperTextAccessibleWrap,
|
||||
CAccessibleEditableText);
|
||||
|
||||
nsresult
|
||||
nsHyperTextAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
|
||||
nsHyperTextAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
|
||||
{
|
||||
PRUint32 eventType = aEvent->GetEventType();
|
||||
|
||||
@ -100,6 +100,8 @@ nsHyperTextAccessibleWrap::GetModifiedText(PRBool aGetInsertedText,
|
||||
|
||||
*aStartOffset = gTextEvent->GetStartOffset();
|
||||
*aEndOffset = *aStartOffset + gTextEvent->GetLength();
|
||||
return gTextEvent->GetModifiedText(aText);
|
||||
gTextEvent->GetModifiedText(aText);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult HandleAccEvent(nsAccEvent *aEvent);
|
||||
virtual nsresult HandleAccEvent(AccEvent* aEvent);
|
||||
|
||||
protected:
|
||||
virtual nsresult GetModifiedText(PRBool aGetInsertedText, nsAString& aText,
|
||||
|
@ -53,7 +53,8 @@ public: // construction, destruction
|
||||
virtual ~nsAccessibleWrap();
|
||||
|
||||
protected:
|
||||
virtual nsresult FirePlatformEvent(nsAccEvent *aEvent) {
|
||||
virtual nsresult FirePlatformEvent(AccEvent* aEvent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
61
accessible/src/xpcom/Makefile.in
Normal file
61
accessible/src/xpcom/Makefile.in
Normal file
@ -0,0 +1,61 @@
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Mozilla Foundation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2010
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = accessibility
|
||||
LIBRARY_NAME = accessibility_xpcom_s
|
||||
LIBXUL_LIBRARY = 1
|
||||
|
||||
CPPSRCS = \
|
||||
nsAccEvent.cpp \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../base \
|
||||
$(NULL)
|
206
accessible/src/xpcom/nsAccEvent.cpp
Normal file
206
accessible/src/xpcom/nsAccEvent.cpp
Normal file
@ -0,0 +1,206 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAccEvent.h"
|
||||
#include "nsDocAccessible.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsAccEvent, nsIAccessibleEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccEvent::GetIsFromUserInput(PRBool* aIsFromUserInput)
|
||||
{
|
||||
*aIsFromUserInput = mEvent->IsFromUserInput();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccEvent::GetEventType(PRUint32* aEventType)
|
||||
{
|
||||
*aEventType = mEvent->GetEventType();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccEvent::GetAccessible(nsIAccessible** aAccessible)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAccessible);
|
||||
*aAccessible = nsnull;
|
||||
|
||||
NS_IF_ADDREF(*aAccessible = mEvent->GetAccessible());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccEvent::GetDOMNode(nsIDOMNode** aDOMNode)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDOMNode);
|
||||
*aDOMNode = nsnull;
|
||||
|
||||
nsINode* node = mEvent->GetNode();
|
||||
if (node)
|
||||
CallQueryInterface(node, aDOMNode);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccEvent::GetAccessibleDocument(nsIAccessibleDocument** aDocAccessible)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDocAccessible);
|
||||
|
||||
NS_IF_ADDREF(*aDocAccessible = mEvent->GetDocAccessible());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccStateChangeEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccStateChangeEvent, nsAccEvent,
|
||||
nsIAccessibleStateChangeEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccStateChangeEvent::GetState(PRUint32* aState)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aState);
|
||||
*aState = static_cast<AccStateChangeEvent*>(mEvent.get())->GetState();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccStateChangeEvent::IsExtraState(PRBool* aIsExtraState)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsExtraState);
|
||||
*aIsExtraState = static_cast<AccStateChangeEvent*>(mEvent.get())->IsExtraState();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccStateChangeEvent::IsEnabled(PRBool* aIsEnabled)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsEnabled);
|
||||
*aIsEnabled = static_cast<AccStateChangeEvent*>(mEvent.get())->IsStateEnabled();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccTextChangeEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccTextChangeEvent, nsAccEvent,
|
||||
nsIAccessibleTextChangeEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccTextChangeEvent::GetStart(PRInt32* aStart)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aStart);
|
||||
*aStart = static_cast<AccTextChangeEvent*>(mEvent.get())->GetStartOffset();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccTextChangeEvent::GetLength(PRUint32* aLength)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLength);
|
||||
*aLength = static_cast<AccTextChangeEvent*>(mEvent.get())->GetLength();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccTextChangeEvent::IsInserted(PRBool* aIsInserted)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsInserted);
|
||||
*aIsInserted = static_cast<AccTextChangeEvent*>(mEvent.get())->IsTextInserted();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccTextChangeEvent::GetModifiedText(nsAString& aModifiedText)
|
||||
{
|
||||
static_cast<AccTextChangeEvent*>(mEvent.get())->GetModifiedText(aModifiedText);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccCaretMoveEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccCaretMoveEvent, nsAccEvent,
|
||||
nsIAccessibleCaretMoveEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccCaretMoveEvent::GetCaretOffset(PRInt32 *aCaretOffset)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCaretOffset);
|
||||
|
||||
*aCaretOffset = static_cast<AccCaretMoveEvent*>(mEvent.get())->GetCaretOffset();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccTableChangeEvent
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccTableChangeEvent, nsAccEvent,
|
||||
nsIAccessibleTableChangeEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccTableChangeEvent::GetRowOrColIndex(PRInt32 *aRowOrColIndex)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRowOrColIndex);
|
||||
|
||||
*aRowOrColIndex =
|
||||
static_cast<AccTableChangeEvent*>(mEvent.get())->GetIndex();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccTableChangeEvent::GetNumRowsOrCols(PRInt32* aNumRowsOrCols)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aNumRowsOrCols);
|
||||
|
||||
*aNumRowsOrCols = static_cast<AccTableChangeEvent*>(mEvent.get())->GetCount();
|
||||
return NS_OK;
|
||||
}
|
||||
|
148
accessible/src/xpcom/nsAccEvent.h
Normal file
148
accessible/src/xpcom/nsAccEvent.h
Normal file
@ -0,0 +1,148 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsAccEvent_H_
|
||||
#define _nsAccEvent_H_
|
||||
|
||||
#include "nsIAccessibleEvent.h"
|
||||
|
||||
#include "AccEvent.h"
|
||||
|
||||
/**
|
||||
* Generic accessible event.
|
||||
*/
|
||||
class nsAccEvent: public nsIAccessibleEvent
|
||||
{
|
||||
public:
|
||||
nsAccEvent(AccEvent* aEvent) : mEvent(aEvent) { }
|
||||
virtual ~nsAccEvent() { }
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIACCESSIBLEEVENT
|
||||
|
||||
protected:
|
||||
nsRefPtr<AccEvent> mEvent;
|
||||
|
||||
private:
|
||||
nsAccEvent();
|
||||
nsAccEvent(const nsAccEvent&);
|
||||
nsAccEvent& operator =(const nsAccEvent&);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accessible state change event.
|
||||
*/
|
||||
class nsAccStateChangeEvent: public nsAccEvent,
|
||||
public nsIAccessibleStateChangeEvent
|
||||
{
|
||||
public:
|
||||
nsAccStateChangeEvent(AccStateChangeEvent* aEvent) : nsAccEvent(aEvent) { }
|
||||
virtual ~nsAccStateChangeEvent() { }
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLESTATECHANGEEVENT
|
||||
|
||||
private:
|
||||
nsAccStateChangeEvent();
|
||||
nsAccStateChangeEvent(const nsAccStateChangeEvent&);
|
||||
nsAccStateChangeEvent& operator =(const nsAccStateChangeEvent&);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accessible text change event.
|
||||
*/
|
||||
class nsAccTextChangeEvent: public nsAccEvent,
|
||||
public nsIAccessibleTextChangeEvent
|
||||
{
|
||||
public:
|
||||
nsAccTextChangeEvent(AccTextChangeEvent* aEvent) : nsAccEvent(aEvent) { }
|
||||
virtual ~nsAccTextChangeEvent() { }
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLETEXTCHANGEEVENT
|
||||
|
||||
private:
|
||||
nsAccTextChangeEvent();
|
||||
nsAccTextChangeEvent(const nsAccTextChangeEvent&);
|
||||
nsAccTextChangeEvent& operator =(const nsAccTextChangeEvent&);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accessible caret move event.
|
||||
*/
|
||||
class nsAccCaretMoveEvent: public nsAccEvent,
|
||||
public nsIAccessibleCaretMoveEvent
|
||||
{
|
||||
public:
|
||||
nsAccCaretMoveEvent(AccCaretMoveEvent* aEvent) : nsAccEvent(aEvent) { }
|
||||
virtual ~nsAccCaretMoveEvent() { }
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLECARETMOVEEVENT
|
||||
|
||||
private:
|
||||
nsAccCaretMoveEvent();
|
||||
nsAccCaretMoveEvent(const nsAccCaretMoveEvent&);
|
||||
nsAccCaretMoveEvent& operator =(const nsAccCaretMoveEvent&);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accessible table change event.
|
||||
*/
|
||||
class nsAccTableChangeEvent : public nsAccEvent,
|
||||
public nsIAccessibleTableChangeEvent
|
||||
{
|
||||
public:
|
||||
nsAccTableChangeEvent(AccTableChangeEvent* aEvent) : nsAccEvent(aEvent) { }
|
||||
virtual ~nsAccTableChangeEvent() { }
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLETABLECHANGEEVENT
|
||||
|
||||
private:
|
||||
nsAccTableChangeEvent();
|
||||
nsAccTableChangeEvent(const nsAccTableChangeEvent&);
|
||||
nsAccTableChangeEvent& operator =(const nsAccTableChangeEvent&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -521,8 +521,8 @@ nsXULTreeAccessible::InvalidateCache(PRInt32 aRow, PRInt32 aCount)
|
||||
nsAccessible *accessible = mAccessibleCache.GetWeak(key);
|
||||
|
||||
if (accessible) {
|
||||
nsRefPtr<nsAccEvent> event =
|
||||
new nsAccEvent(nsIAccessibleEvent::EVENT_HIDE, accessible, PR_FALSE);
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_HIDE, accessible, PR_FALSE);
|
||||
nsEventShell::FireEvent(event);
|
||||
|
||||
accessible->Shutdown();
|
||||
@ -622,8 +622,8 @@ nsXULTreeAccessible::TreeViewChanged()
|
||||
// Fire only notification destroy/create events on accessible tree to lie to
|
||||
// AT because it should be expensive to fire destroy events for each tree item
|
||||
// in cache.
|
||||
nsRefPtr<nsAccEvent> eventDestroy =
|
||||
new nsAccEvent(nsIAccessibleEvent::EVENT_HIDE, this, PR_FALSE);
|
||||
nsRefPtr<AccEvent> eventDestroy =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_HIDE, this, PR_FALSE);
|
||||
if (!eventDestroy)
|
||||
return;
|
||||
|
||||
@ -633,8 +633,8 @@ nsXULTreeAccessible::TreeViewChanged()
|
||||
|
||||
mTree->GetView(getter_AddRefs(mTreeView));
|
||||
|
||||
nsRefPtr<nsAccEvent> eventCreate =
|
||||
new nsAccEvent(nsIAccessibleEvent::EVENT_SHOW, this, PR_FALSE);
|
||||
nsRefPtr<AccEvent> eventCreate =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_SHOW, this, PR_FALSE);
|
||||
if (!eventCreate)
|
||||
return;
|
||||
|
||||
|
@ -1238,9 +1238,9 @@ nsXULTreeGridCellAccessible::CellInvalidated()
|
||||
mTreeView->GetCellValue(mRow, mColumn, textEquiv);
|
||||
if (mCachedTextEquiv != textEquiv) {
|
||||
PRBool isEnabled = textEquiv.EqualsLiteral("true");
|
||||
nsRefPtr<nsAccEvent> accEvent =
|
||||
new nsAccStateChangeEvent(this, nsIAccessibleStates::STATE_CHECKED,
|
||||
PR_FALSE, isEnabled);
|
||||
nsRefPtr<AccEvent> accEvent =
|
||||
new AccStateChangeEvent(this, nsIAccessibleStates::STATE_CHECKED,
|
||||
PR_FALSE, isEnabled);
|
||||
nsEventShell::FireEvent(accEvent);
|
||||
|
||||
mCachedTextEquiv = textEquiv;
|
||||
|
Loading…
x
Reference in New Issue
Block a user