Fix for bug 374790 - fix MSAA event map, patch=aaronlev, me

This commit is contained in:
surkov.alexander@gmail.com 2007-04-06 08:36:42 -07:00
parent 0ff9439b71
commit 236a51e8d5
3 changed files with 13 additions and 1 deletions

View File

@ -474,6 +474,10 @@ interface nsIAccessibleEvent : nsISupports
*/ */
const unsigned long EVENT_INTERNAL_LOAD = 0x005C; const unsigned long EVENT_INTERNAL_LOAD = 0x005C;
/**
* Help make sure event map does not get out-of-line.
*/
const unsigned long EVENT_LAST_ENTRY = 0x005D;
/** /**
* The type of event, based on the enumerated event values * The type of event, based on the enumerated event values

View File

@ -169,6 +169,12 @@ NS_IMETHODIMP nsDocAccessibleWrap::Shutdown()
NS_IMETHODIMP NS_IMETHODIMP
nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent, nsIAccessible* aAccessible, void* aData) nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent, nsIAccessible* aAccessible, void* aData)
{ {
NS_ENSURE_TRUE(aEvent > 0 && aEvent < nsIAccessibleEvent::EVENT_LAST_ENTRY,
NS_ERROR_FAILURE);
NS_ASSERTION(gWinEventMap[nsIAccessibleEvent::EVENT_LAST_ENTRY] == kEVENT_LAST_ENTRY,
"MSAA event map skewed");
PRUint32 winEvent = gWinEventMap[aEvent]; PRUint32 winEvent = gWinEventMap[aEvent];
if (!winEvent) if (!winEvent)
return NS_OK; return NS_OK;

View File

@ -42,8 +42,10 @@
#include "AccessibleEventId.h" #include "AccessibleEventId.h"
const PRUint32 kEVENT_WIN_UNKNOWN = 0x00000000; const PRUint32 kEVENT_WIN_UNKNOWN = 0x00000000;
const PRUint32 kEVENT_LAST_ENTRY = 0xffffffff;
static const PRUint32 gWinEventMap[] = { static const PRUint32 gWinEventMap[] = {
kEVENT_WIN_UNKNOWN, // nsIAccessibleEvent doesn't have 0 constant
kEVENT_WIN_UNKNOWN, // nsIAccessibleEvent::EVENT_CREATE kEVENT_WIN_UNKNOWN, // nsIAccessibleEvent::EVENT_CREATE
kEVENT_WIN_UNKNOWN, // nsIAccessibleEvent::EVENT_DESTROY kEVENT_WIN_UNKNOWN, // nsIAccessibleEvent::EVENT_DESTROY
EVENT_OBJECT_SHOW, // nsIAccessibleEvent::EVENT_SHOW EVENT_OBJECT_SHOW, // nsIAccessibleEvent::EVENT_SHOW
@ -124,7 +126,6 @@ static const PRUint32 gWinEventMap[] = {
kEVENT_WIN_UNKNOWN, // nsIAccessibleEvent::EVENT_WINDOW_MINIMIZE kEVENT_WIN_UNKNOWN, // nsIAccessibleEvent::EVENT_WINDOW_MINIMIZE
kEVENT_WIN_UNKNOWN, // nsIAccessibleEvent::EVENT_WINDOW_RESIZE kEVENT_WIN_UNKNOWN, // nsIAccessibleEvent::EVENT_WINDOW_RESIZE
kEVENT_WIN_UNKNOWN, // nsIAccessibleEvent::EVENT_WINDOW_RESTORE kEVENT_WIN_UNKNOWN, // nsIAccessibleEvent::EVENT_WINDOW_RESTORE
kEVENT_WIN_UNKNOWN, // nsIAccessibleEvent::EVENT_INTERNAL_LOAD
IA2_EVENT_HYPERLINK_END_INDEX_CHANGED, // nsIAccessibleEvent::EVENT_HYPERLINK_END_INDEX_CHANGED IA2_EVENT_HYPERLINK_END_INDEX_CHANGED, // nsIAccessibleEvent::EVENT_HYPERLINK_END_INDEX_CHANGED
IA2_EVENT_HYPERLINK_NUMBER_OF_ANCHORS_CHANGED, // nsIAccessibleEvent::EVENT_HYPERLINK_NUMBER_OF_ANCHORS_CHANGED IA2_EVENT_HYPERLINK_NUMBER_OF_ANCHORS_CHANGED, // nsIAccessibleEvent::EVENT_HYPERLINK_NUMBER_OF_ANCHORS_CHANGED
IA2_EVENT_HYPERLINK_SELECTED_LINK_CHANGED, // nsIAccessibleEvent::EVENT_HYPERLINK_SELECTED_LINK_CHANGED IA2_EVENT_HYPERLINK_SELECTED_LINK_CHANGED, // nsIAccessibleEvent::EVENT_HYPERLINK_SELECTED_LINK_CHANGED
@ -137,5 +138,6 @@ static const PRUint32 gWinEventMap[] = {
IA2_EVENT_PAGE_CHANGED, // nsIAccessibleEvent::EVENT_PAGE_CHANGED IA2_EVENT_PAGE_CHANGED, // nsIAccessibleEvent::EVENT_PAGE_CHANGED
IA2_EVENT_ROLE_CHANGED, // nsIAccessibleEvent::EVENT_ROLE_CHANGED IA2_EVENT_ROLE_CHANGED, // nsIAccessibleEvent::EVENT_ROLE_CHANGED
kEVENT_WIN_UNKNOWN, // nsIAccessibleEvent::EVENT_INTERNAL_LOAD kEVENT_WIN_UNKNOWN, // nsIAccessibleEvent::EVENT_INTERNAL_LOAD
kEVENT_LAST_ENTRY // nsIAccessibleEvent::EVENT_LAST_ENTRY
}; };