зеркало из https://github.com/mozilla/pjs.git
Bug 377514 AT-SPI focus events no longer being genrated
patch by alexender.surkov review=ginn.chen
This commit is contained in:
Родитель
066427011f
Коммит
8789f5cd05
|
@ -1017,3 +1017,67 @@ nsAccessibleWrap *GetAccessibleWrap(AtkObject *aAtkObj)
|
|||
NS_ENSURE_TRUE(tmpAccWrap->GetAtkObject() == aAtkObj, nsnull);
|
||||
return tmpAccWrap;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
|
||||
{
|
||||
nsresult rv = nsAccessible::FireAccessibleEvent(aEvent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
aEvent->GetAccessible(getter_AddRefs(accessible));
|
||||
nsIAccessible *tmpAccessible = accessible;
|
||||
nsAccessibleWrap *accWrap = NS_STATIC_CAST(nsAccessibleWrap*, tmpAccessible);
|
||||
NS_ENSURE_TRUE(accWrap, NS_ERROR_FAILURE);
|
||||
|
||||
AtkObject *atkObj = accWrap->GetAtkObject();
|
||||
NS_ENSURE_TRUE(atkObj, NS_ERROR_FAILURE);
|
||||
|
||||
PRUint32 type = 0;
|
||||
rv = aEvent->GetEventType(&type);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
switch (type) {
|
||||
case nsIAccessibleEvent::EVENT_STATE_CHANGE:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_STATE_CHANGE\n"));
|
||||
|
||||
nsCOMPtr<nsIAccessibleStateChangeEvent> event =
|
||||
do_QueryInterface(aEvent);
|
||||
NS_ENSURE_TRUE(event, NS_ERROR_FAILURE);
|
||||
|
||||
PRUint32 state = 0;
|
||||
event->GetState(&state);
|
||||
|
||||
PRBool isExtra;
|
||||
event->IsExtraState(&isExtra);
|
||||
|
||||
PRBool isEnabled;
|
||||
event->IsEnabled(&isEnabled);
|
||||
|
||||
PRInt32 stateIndex = AtkStateMap::GetStateIndexFor(state);
|
||||
if (stateIndex >= 0) {
|
||||
const AtkStateMap *atkStateMap = isExtra ? gAtkStateMapExt : gAtkStateMap;
|
||||
NS_ASSERTION(atkStateMap[stateIndex].stateMapEntryType != kNoSuchState,
|
||||
"No such state");
|
||||
|
||||
if (atkStateMap[stateIndex].atkState != kNone) {
|
||||
NS_ASSERTION(atkStateMap[stateIndex].stateMapEntryType != kNoStateChange,
|
||||
"State changes should not fired for this state");
|
||||
|
||||
if (atkStateMap[stateIndex].stateMapEntryType == kMapOpposite)
|
||||
isEnabled = !isEnabled;
|
||||
|
||||
// Fire state change for first state if there is one to map
|
||||
atk_object_notify_state_change(atkObj,
|
||||
atkStateMap[stateIndex].atkState,
|
||||
isEnabled);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,6 +72,7 @@ public:
|
|||
public:
|
||||
// return the atk object for this nsAccessibleWrap
|
||||
NS_IMETHOD GetNativeInterface(void **aOutAccessible);
|
||||
NS_IMETHOD FireAccessibleEvent(nsIAccessibleEvent *aEvent);
|
||||
|
||||
AtkObject * GetAtkObject(void);
|
||||
|
||||
|
|
|
@ -474,66 +474,3 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
|
||||
{
|
||||
nsresult rv = nsDocAccessible::FireAccessibleEvent(aEvent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
aEvent->GetAccessible(getter_AddRefs(accessible));
|
||||
nsIAccessible *tmpAccessible = accessible;
|
||||
nsAccessibleWrap *accWrap = NS_STATIC_CAST(nsAccessibleWrap*, tmpAccessible);
|
||||
NS_ENSURE_TRUE(accWrap, NS_ERROR_FAILURE);
|
||||
|
||||
AtkObject *atkObj = accWrap->GetAtkObject();
|
||||
NS_ENSURE_TRUE(atkObj, NS_ERROR_FAILURE);
|
||||
|
||||
PRUint32 type = 0;
|
||||
rv = aEvent->GetEventType(&type);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
switch (type) {
|
||||
case nsIAccessibleEvent::EVENT_STATE_CHANGE:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_STATE_CHANGE\n"));
|
||||
|
||||
nsCOMPtr<nsIAccessibleStateChangeEvent> event =
|
||||
do_QueryInterface(aEvent);
|
||||
NS_ENSURE_TRUE(event, NS_ERROR_FAILURE);
|
||||
|
||||
PRUint32 state = 0;
|
||||
event->GetState(&state);
|
||||
|
||||
PRBool isExtra;
|
||||
event->IsExtraState(&isExtra);
|
||||
|
||||
PRBool isEnabled;
|
||||
event->IsEnabled(&isEnabled);
|
||||
|
||||
PRInt32 stateIndex = AtkStateMap::GetStateIndexFor(state);
|
||||
if (stateIndex >= 0) {
|
||||
const AtkStateMap *atkStateMap = isExtra ? gAtkStateMapExt : gAtkStateMap;
|
||||
NS_ASSERTION(atkStateMap[stateIndex].stateMapEntryType != kNoSuchState,
|
||||
"No such state");
|
||||
|
||||
if (atkStateMap[stateIndex].atkState != kNone) {
|
||||
NS_ASSERTION(atkStateMap[stateIndex].stateMapEntryType != kNoStateChange,
|
||||
"State changes should not fired for this state");
|
||||
|
||||
if (atkStateMap[stateIndex].stateMapEntryType == kMapOpposite)
|
||||
isEnabled = !isEnabled;
|
||||
|
||||
// Fire state change for first state if there is one to map
|
||||
atk_object_notify_state_change(atkObj,
|
||||
atkStateMap[stateIndex].atkState,
|
||||
isEnabled);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,6 @@ public:
|
|||
|
||||
NS_IMETHOD FireToolkitEvent(PRUint32 aEvent, nsIAccessible* aAccessible,
|
||||
void* aData);
|
||||
NS_IMETHOD FireAccessibleEvent(nsIAccessibleEvent *aEvent);
|
||||
|
||||
protected:
|
||||
PRBool mActivated;
|
||||
|
|
|
@ -1969,14 +1969,16 @@ nsresult nsAccessible::GetXULName(nsAString& aLabel, PRBool aCanAggregateSubtree
|
|||
|
||||
NS_IMETHODIMP nsAccessible::FireToolkitEvent(PRUint32 aEvent, nsIAccessible *aTarget, void * aData)
|
||||
{
|
||||
// Don't fire event for accessible that has been shut down.
|
||||
NS_ENSURE_TRUE(mWeakShell, NS_ERROR_FAILURE);
|
||||
// Don't fire event for accessible that has been shut down
|
||||
if (!mWeakShell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIAccessibleEvent> accEvent =
|
||||
new nsAccEvent(aEvent, aTarget, aData);
|
||||
NS_ENSURE_TRUE(accEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
nsCOMPtr<nsIAccessibleDocument> docAccessible(GetDocAccessible());
|
||||
nsCOMPtr<nsPIAccessible> eventHandlingAccessible(do_QueryInterface(docAccessible));
|
||||
if (eventHandlingAccessible)
|
||||
return eventHandlingAccessible->FireToolkitEvent(aEvent, aTarget, aData);
|
||||
|
||||
return FireAccessibleEvent(accEvent);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -1425,6 +1425,21 @@ nsDocAccessible::GetAccessibleInParentChain(nsIDOMNode *aNode,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocAccessible::FireToolkitEvent(PRUint32 aEvent, nsIAccessible *aTarget,
|
||||
void * aData)
|
||||
{
|
||||
// Don't fire event for accessible that has been shut down.
|
||||
if (!mWeakShell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIAccessibleEvent> accEvent =
|
||||
new nsAccEvent(aEvent, aTarget, aData);
|
||||
NS_ENSURE_TRUE(accEvent, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return FireAccessibleEvent(accEvent);
|
||||
}
|
||||
|
||||
void nsDocAccessible::DocLoadCallback(nsITimer *aTimer, void *aClosure)
|
||||
{
|
||||
// Doc has finished loading, fire "load finished" event
|
||||
|
|
|
@ -91,6 +91,9 @@ class nsDocAccessible : public nsHyperTextAccessible,
|
|||
// nsIDocumentObserver
|
||||
NS_DECL_NSIDOCUMENTOBSERVER
|
||||
|
||||
NS_IMETHOD FireToolkitEvent(PRUint32 aEvent, nsIAccessible* aAccessible,
|
||||
void* aData);
|
||||
|
||||
static void FlushEventsCallback(nsITimer *aTimer, void *aClosure);
|
||||
|
||||
// nsIAccessNode
|
||||
|
|
Загрузка…
Ссылка в новой задаче