Bug 540281 - rename nsAccessible::FireAccessibleEvent into HandleAccEvent, r=davidb

This commit is contained in:
Alexander Surkov 2010-01-19 00:32:40 +08:00
parent ef18429603
commit 999f7e3a57
13 changed files with 39 additions and 48 deletions

View File

@ -1107,24 +1107,22 @@ nsAccessibleWrap *GetAccessibleWrap(AtkObject *aAtkObj)
} }
nsresult nsresult
nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent) nsAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
{ {
nsresult rv = nsAccessible::FireAccessibleEvent(aEvent); nsresult rv = nsAccessible::HandleAccEvent(aEvent);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
return FirePlatformEvent(aEvent); return FirePlatformEvent(aEvent);
} }
nsresult nsresult
nsAccessibleWrap::FirePlatformEvent(nsIAccessibleEvent *aEvent) nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
{ {
nsCOMPtr<nsIAccessible> accessible; nsCOMPtr<nsIAccessible> accessible;
aEvent->GetAccessible(getter_AddRefs(accessible)); aEvent->GetAccessible(getter_AddRefs(accessible));
NS_ENSURE_TRUE(accessible, NS_ERROR_FAILURE); NS_ENSURE_TRUE(accessible, NS_ERROR_FAILURE);
PRUint32 type = 0; PRUint32 type = aEvent->GetEventType();
nsresult rv = aEvent->GetEventType(&type);
NS_ENSURE_SUCCESS(rv, rv);
AtkObject *atkObj = nsAccessibleWrap::GetAtkObject(accessible); AtkObject *atkObj = nsAccessibleWrap::GetAtkObject(accessible);

View File

@ -100,7 +100,7 @@ public:
// return the atk object for this nsAccessibleWrap // return the atk object for this nsAccessibleWrap
NS_IMETHOD GetNativeInterface(void **aOutAccessible); NS_IMETHOD GetNativeInterface(void **aOutAccessible);
NS_IMETHOD FireAccessibleEvent(nsIAccessibleEvent *aEvent); virtual nsresult HandleAccEvent(nsAccEvent *aEvent);
AtkObject * GetAtkObject(void); AtkObject * GetAtkObject(void);
static AtkObject * GetAtkObject(nsIAccessible * acc); static AtkObject * GetAtkObject(nsIAccessible * acc);
@ -118,7 +118,7 @@ public:
} }
protected: protected:
virtual nsresult FirePlatformEvent(nsIAccessibleEvent *aEvent); virtual nsresult FirePlatformEvent(nsAccEvent *aEvent);
nsresult FireAtkStateChangeEvent(nsIAccessibleEvent *aEvent, nsresult FireAtkStateChangeEvent(nsIAccessibleEvent *aEvent,
AtkObject *aObject); AtkObject *aObject);

View File

@ -1356,7 +1356,7 @@ nsAccessible::GetXULName(nsAString& aLabel)
} }
nsresult nsresult
nsAccessible::FireAccessibleEvent(nsIAccessibleEvent *aEvent) nsAccessible::HandleAccEvent(nsAccEvent *aEvent)
{ {
NS_ENSURE_ARG_POINTER(aEvent); NS_ENSURE_ARG_POINTER(aEvent);
nsCOMPtr<nsIDOMNode> eventNode; nsCOMPtr<nsIDOMNode> eventNode;

View File

@ -104,11 +104,11 @@ private:
#define NS_ACCESSIBLE_IMPL_CID \ #define NS_ACCESSIBLE_IMPL_CID \
{ /* c734df37-7e12-49ec-8983-eea88a186bb8 */ \ { /* 133c8bf4-4913-4355-bd50-426bd1d6e1ad */ \
0xc734df37, \ 0x133c8bf4, \
0x7e12, \ 0x4913, \
0x49ec, \ 0x4355, \
{ 0x89, 0x83, 0xee, 0xa8, 0x8a, 0x18, 0x6b, 0xb8 } \ { 0xbd, 0x50, 0x42, 0x6b, 0xd1, 0xd6, 0xe1, 0xad } \
} }
class nsAccessible : public nsAccessNodeWrap, class nsAccessible : public nsAccessNodeWrap,
@ -280,9 +280,10 @@ public:
// Miscellaneous methods // Miscellaneous methods
/** /**
* Fire accessible event. * Handle accessible event, i.e. process it, notifies observers and fires
* platform specific event.
*/ */
virtual nsresult FireAccessibleEvent(nsIAccessibleEvent *aAccEvent); virtual nsresult HandleAccEvent(nsAccEvent *aAccEvent);
/** /**
* Return true if there are accessible children in anonymous content * Return true if there are accessible children in anonymous content
@ -446,13 +447,13 @@ protected:
/** /**
* Fires platform accessible event. It's notification method only. It does * Fires platform accessible event. It's notification method only. It does
* change nothing on Gecko side. Mostly you should use * change nothing on Gecko side. Don't use it until you're sure what you do
* nsIAccessible::FireAccessibleEvent excepting special cases like we have * (see example in XUL tree accessible), use nsEventShell::FireEvent()
* in xul:tree accessible to lie to AT. Must be overridden in wrap classes. * instead. MUST be overridden in wrap classes.
* *
* @param aEvent the accessible event to fire. * @param aEvent the accessible event to fire.
*/ */
virtual nsresult FirePlatformEvent(nsIAccessibleEvent *aEvent) = 0; virtual nsresult FirePlatformEvent(nsAccEvent *aEvent) = 0;
// Data Members // Data Members
nsRefPtr<nsAccessible> mParent; nsRefPtr<nsAccessible> mParent;

View File

@ -50,7 +50,7 @@ nsEventShell::FireEvent(nsAccEvent *aEvent)
nsAccUtils::QueryObject<nsAccessible>(aEvent->GetAccessible()); nsAccUtils::QueryObject<nsAccessible>(aEvent->GetAccessible());
NS_ENSURE_TRUE(acc,); NS_ENSURE_TRUE(acc,);
acc->FireAccessibleEvent(aEvent); acc->HandleAccEvent(aEvent);
} }
void void

View File

@ -77,7 +77,7 @@ class nsAccessibleWrap : public nsAccessible
virtual nsresult Shutdown (); virtual nsresult Shutdown ();
virtual void InvalidateChildren(); virtual void InvalidateChildren();
virtual nsresult FireAccessibleEvent(nsIAccessibleEvent *aEvent); virtual nsresult FireAccessibleEvent(nsAccEvent *aEvent);
// ignored means that the accessible might still have children, but is not displayed // 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. // to the user. it also has no native accessible object represented for it.
@ -97,7 +97,7 @@ class nsAccessibleWrap : public nsAccessible
protected: protected:
virtual nsresult FirePlatformEvent(nsIAccessibleEvent *aEvent); virtual nsresult FirePlatformEvent(nsAccEvent *aEvent);
PRBool AncestorIsFlat() { PRBool AncestorIsFlat() {
// we don't create a native object if we're child of a "flat" accessible; for example, on OS X buttons // we don't create a native object if we're child of a "flat" accessible; for example, on OS X buttons

View File

@ -160,13 +160,11 @@ nsAccessibleWrap::Shutdown ()
} }
nsresult nsresult
nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent) nsAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
{ {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
NS_ENSURE_ARG_POINTER(aEvent); nsresult rv = nsAccessible::HandleAccEvent(aEvent);
nsresult rv = nsAccessible::FireAccessibleEvent(aEvent);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
return FirePlatformEvent(aEvent); return FirePlatformEvent(aEvent);
@ -175,13 +173,11 @@ nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
} }
nsresult nsresult
nsAccessibleWrap::FirePlatformEvent(nsIAccessibleEvent *aEvent) nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
{ {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
PRUint32 eventType; PRUint32 eventType = aEvent->GetEventType();
nsresult rv = aEvent->GetEventType(&eventType);
NS_ENSURE_SUCCESS(rv, rv);
// ignore everything but focus-changed and value-changed events for now. // ignore everything but focus-changed and value-changed events for now.
if (eventType != nsIAccessibleEvent::EVENT_FOCUS && if (eventType != nsIAccessibleEvent::EVENT_FOCUS &&

View File

@ -1656,21 +1656,18 @@ NS_IMETHODIMP nsAccessibleWrap::GetNativeInterface(void **aOutAccessible)
// nsAccessible // nsAccessible
nsresult nsresult
nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent) nsAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
{ {
NS_ENSURE_ARG(aEvent); nsresult rv = nsAccessible::HandleAccEvent(aEvent);
nsresult rv = nsAccessible::FireAccessibleEvent(aEvent);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
return FirePlatformEvent(aEvent); return FirePlatformEvent(aEvent);
} }
nsresult nsresult
nsAccessibleWrap::FirePlatformEvent(nsIAccessibleEvent *aEvent) nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
{ {
PRUint32 eventType = 0; PRUint32 eventType = aEvent->GetEventType();
aEvent->GetEventType(&eventType);
NS_ENSURE_TRUE(eventType > 0 && NS_ENSURE_TRUE(eventType > 0 &&
eventType < nsIAccessibleEvent::EVENT_LAST_ENTRY, eventType < nsIAccessibleEvent::EVENT_LAST_ENTRY,

View File

@ -307,7 +307,7 @@ class nsAccessibleWrap : public nsAccessible,
UINT *puArgErr); UINT *puArgErr);
// nsAccessible // nsAccessible
virtual nsresult FireAccessibleEvent(nsIAccessibleEvent *aEvent); virtual nsresult HandleAccEvent(nsAccEvent *aEvent);
// Helper methods // Helper methods
static PRInt32 GetChildIDFor(nsIAccessible* aAccessible); static PRInt32 GetChildIDFor(nsIAccessible* aAccessible);
@ -342,7 +342,7 @@ class nsAccessibleWrap : public nsAccessible,
void UnattachIEnumVariant(); void UnattachIEnumVariant();
protected: protected:
virtual nsresult FirePlatformEvent(nsIAccessibleEvent *aEvent); virtual nsresult FirePlatformEvent(nsAccEvent *aEvent);
// mEnumVARIANTPosition not the current accessible's position, but a "cursor" of // mEnumVARIANTPosition not the current accessible's position, but a "cursor" of
// where we are in the current list of children, with respect to // where we are in the current list of children, with respect to

View File

@ -49,10 +49,9 @@ IMPL_IUNKNOWN_INHERITED2(nsHyperTextAccessibleWrap,
CAccessibleEditableText); CAccessibleEditableText);
nsresult nsresult
nsHyperTextAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent) nsHyperTextAccessibleWrap::HandleAccEvent(nsAccEvent *aEvent)
{ {
PRUint32 eventType; PRUint32 eventType = aEvent->GetEventType();
aEvent->GetEventType(&eventType);
if (eventType == nsIAccessibleEvent::EVENT_TEXT_REMOVED || if (eventType == nsIAccessibleEvent::EVENT_TEXT_REMOVED ||
eventType == nsIAccessibleEvent::EVENT_TEXT_INSERTED) { eventType == nsIAccessibleEvent::EVENT_TEXT_INSERTED) {
@ -74,7 +73,7 @@ nsHyperTextAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
} }
} }
return nsHyperTextAccessible::FireAccessibleEvent(aEvent); return nsHyperTextAccessible::HandleAccEvent(aEvent);
} }
nsresult nsresult

View File

@ -61,7 +61,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
// nsAccessible // nsAccessible
virtual nsresult FireAccessibleEvent(nsIAccessibleEvent *aEvent); virtual nsresult HandleAccEvent(nsAccEvent *aEvent);
protected: protected:
virtual nsresult GetModifiedText(PRBool aGetInsertedText, nsAString& aText, virtual nsresult GetModifiedText(PRBool aGetInsertedText, nsAString& aText,

View File

@ -53,7 +53,7 @@ class nsAccessibleWrap : public nsAccessible
virtual ~nsAccessibleWrap(); virtual ~nsAccessibleWrap();
protected: protected:
virtual nsresult FirePlatformEvent(nsIAccessibleEvent *aEvent) { virtual nsresult FirePlatformEvent(nsAccEvent *aEvent) {
return NS_OK; return NS_OK;
} }
}; };

View File

@ -683,7 +683,7 @@ nsXULTreeAccessible::TreeViewChanged()
// Fire only notification destroy/create events on accessible tree to lie to // 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 // AT because it should be expensive to fire destroy events for each tree item
// in cache. // in cache.
nsCOMPtr<nsIAccessibleEvent> eventDestroy = nsRefPtr<nsAccEvent> eventDestroy =
new nsAccEvent(nsIAccessibleEvent::EVENT_HIDE, this, PR_FALSE); new nsAccEvent(nsIAccessibleEvent::EVENT_HIDE, this, PR_FALSE);
if (!eventDestroy) if (!eventDestroy)
return; return;
@ -694,7 +694,7 @@ nsXULTreeAccessible::TreeViewChanged()
mTree->GetView(getter_AddRefs(mTreeView)); mTree->GetView(getter_AddRefs(mTreeView));
nsCOMPtr<nsIAccessibleEvent> eventCreate = nsRefPtr<nsAccEvent> eventCreate =
new nsAccEvent(nsIAccessibleEvent::EVENT_SHOW, this, PR_FALSE); new nsAccEvent(nsIAccessibleEvent::EVENT_SHOW, this, PR_FALSE);
if (!eventCreate) if (!eventCreate)
return; return;