Bug 175827. Accessibility APIs: XUL and HTML comboboxes - when pulled down, should have initial MSAA focus event on first focused option. r=kyle, sr=alecf, a=dbaron

This commit is contained in:
aaronl%netscape.com 2002-10-25 02:53:45 +00:00
Родитель f1118b17d1
Коммит 1ca819e5c7
5 изменённых файлов: 68 добавлений и 32 удалений

Просмотреть файл

@ -509,8 +509,14 @@ void nsRootAccessible::FireAccessibleFocusEvent(nsIAccessible *focusAccessible,
if (focusAccessible && focusNode && gLastFocusedNode != focusNode) {
mListener->HandleEvent(nsIAccessibleEventListener::EVENT_FOCUS, focusAccessible, nsnull);
NS_IF_RELEASE(gLastFocusedNode);
gLastFocusedNode = focusNode;
NS_ADDREF(gLastFocusedNode);
PRUint32 role = ROLE_NOTHING;
focusAccessible->GetAccRole(&role);
if (role == ROLE_MENUITEM || role == ROLE_LISTITEM)
gLastFocusedNode = nsnull; // This makes it report all focus events on menu and list items
else {
gLastFocusedNode = focusNode;
NS_IF_ADDREF(gLastFocusedNode);
}
if (mCaretAccessible)
mCaretAccessible->AttachNewSelectionListener(focusNode);
}

Просмотреть файл

@ -1499,21 +1499,7 @@ nsListControlFrame::PerformSelection(PRInt32 aSelectedIndex,
#endif
#ifdef ACCESSIBILITY
// Fire a custom DOM event for the change, so that accessibility can
// fire a native focus event for accessibility
// (Some 3rd party products need to track our focus)
nsCOMPtr<nsIDOMEvent> event;
nsCOMPtr<nsIEventListenerManager> manager;
mContent->GetListenerManager(getter_AddRefs(manager));
if (manager &&
NS_SUCCEEDED(manager->CreateEvent(mPresContext, nsnull, NS_LITERAL_STRING("Events"), getter_AddRefs(event)))) {
event->InitEvent(NS_LITERAL_STRING("DOMMenuItemActive"), PR_TRUE, PR_TRUE);
PRBool noDefault;
nsCOMPtr<nsIEventStateManager> esm;
mPresContext->GetEventStateManager(getter_AddRefs(esm));
if (esm)
esm->DispatchNewEvent(mContent, event, &noDefault);
}
FireMenuItemActiveEvent(); // Inform assistive tech what got focus
#endif
return wasChanged;
@ -2564,6 +2550,9 @@ nsListControlFrame::AboutToDropDown()
mSelectedIndexWhenPoppedDown = selectedIndex;
if (mIsAllContentHere && mIsAllFramesHere && mHasBeenInitialized) {
ScrollToIndex(selectedIndex);
#ifdef ACCESSIBILITY
FireMenuItemActiveEvent(); // Inform assistive tech what got focus
#endif
}
return NS_OK;
@ -2862,6 +2851,28 @@ PRBool nsListControlFrame::IsClickingInCombobox(nsIDOMEvent* aMouseEvent)
return PR_FALSE;
}
//----------------------------------------------------------------------
// Fire a custom DOM event for the change, so that accessibility can
// fire a native focus event for accessibility
// (Some 3rd party products need to track our focus)
#ifdef ACCESSIBILITY
void
nsListControlFrame::FireMenuItemActiveEvent()
{
nsCOMPtr<nsIDOMEvent> event;
nsCOMPtr<nsIEventListenerManager> manager;
mContent->GetListenerManager(getter_AddRefs(manager));
if (manager &&
NS_SUCCEEDED(manager->CreateEvent(mPresContext, nsnull, NS_LITERAL_STRING("Events"), getter_AddRefs(event)))) {
event->InitEvent(NS_LITERAL_STRING("DOMMenuItemActive"), PR_TRUE, PR_TRUE);
PRBool noDefault;
nsCOMPtr<nsIEventStateManager> esm;
mPresContext->GetEventStateManager(getter_AddRefs(esm));
if (esm)
esm->DispatchNewEvent(mContent, event, &noDefault);
}
}
#endif
//----------------------------------------------------------------------
// Sets the mSelectedIndex and mOldSelectedIndex from figuring out what

Просмотреть файл

@ -321,6 +321,10 @@ public:
void PaintFocus(nsIRenderingContext& aRC, nsFramePaintLayer aWhichLayer);
#ifdef ACCESSIBILITY
void FireMenuItemActiveEvent(); // Inform assistive tech what got focused
#endif
protected:
nsresult IsOptionDisabled(PRInt32 anIndex, PRBool &aIsDisabled);

Просмотреть файл

@ -1499,21 +1499,7 @@ nsListControlFrame::PerformSelection(PRInt32 aSelectedIndex,
#endif
#ifdef ACCESSIBILITY
// Fire a custom DOM event for the change, so that accessibility can
// fire a native focus event for accessibility
// (Some 3rd party products need to track our focus)
nsCOMPtr<nsIDOMEvent> event;
nsCOMPtr<nsIEventListenerManager> manager;
mContent->GetListenerManager(getter_AddRefs(manager));
if (manager &&
NS_SUCCEEDED(manager->CreateEvent(mPresContext, nsnull, NS_LITERAL_STRING("Events"), getter_AddRefs(event)))) {
event->InitEvent(NS_LITERAL_STRING("DOMMenuItemActive"), PR_TRUE, PR_TRUE);
PRBool noDefault;
nsCOMPtr<nsIEventStateManager> esm;
mPresContext->GetEventStateManager(getter_AddRefs(esm));
if (esm)
esm->DispatchNewEvent(mContent, event, &noDefault);
}
FireMenuItemActiveEvent(); // Inform assistive tech what got focus
#endif
return wasChanged;
@ -2564,6 +2550,9 @@ nsListControlFrame::AboutToDropDown()
mSelectedIndexWhenPoppedDown = selectedIndex;
if (mIsAllContentHere && mIsAllFramesHere && mHasBeenInitialized) {
ScrollToIndex(selectedIndex);
#ifdef ACCESSIBILITY
FireMenuItemActiveEvent(); // Inform assistive tech what got focus
#endif
}
return NS_OK;
@ -2862,6 +2851,28 @@ PRBool nsListControlFrame::IsClickingInCombobox(nsIDOMEvent* aMouseEvent)
return PR_FALSE;
}
//----------------------------------------------------------------------
// Fire a custom DOM event for the change, so that accessibility can
// fire a native focus event for accessibility
// (Some 3rd party products need to track our focus)
#ifdef ACCESSIBILITY
void
nsListControlFrame::FireMenuItemActiveEvent()
{
nsCOMPtr<nsIDOMEvent> event;
nsCOMPtr<nsIEventListenerManager> manager;
mContent->GetListenerManager(getter_AddRefs(manager));
if (manager &&
NS_SUCCEEDED(manager->CreateEvent(mPresContext, nsnull, NS_LITERAL_STRING("Events"), getter_AddRefs(event)))) {
event->InitEvent(NS_LITERAL_STRING("DOMMenuItemActive"), PR_TRUE, PR_TRUE);
PRBool noDefault;
nsCOMPtr<nsIEventStateManager> esm;
mPresContext->GetEventStateManager(getter_AddRefs(esm));
if (esm)
esm->DispatchNewEvent(mContent, event, &noDefault);
}
}
#endif
//----------------------------------------------------------------------
// Sets the mSelectedIndex and mOldSelectedIndex from figuring out what

Просмотреть файл

@ -321,6 +321,10 @@ public:
void PaintFocus(nsIRenderingContext& aRC, nsFramePaintLayer aWhichLayer);
#ifdef ACCESSIBILITY
void FireMenuItemActiveEvent(); // Inform assistive tech what got focused
#endif
protected:
nsresult IsOptionDisabled(PRInt32 anIndex, PRBool &aIsDisabled);