mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 383482 [a11y]overflow:hidden style should not "invalidate" the focused link
r=surkov.alexander
This commit is contained in:
parent
98945d72c4
commit
87bceab025
@ -40,7 +40,9 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsAccessibleWrap.h"
|
||||
#include "nsAccessibleEventData.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsDocAccessibleWrap.h"
|
||||
#include "nsIAccessibleValue.h"
|
||||
#include "nsString.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "prprf.h"
|
||||
@ -1095,6 +1097,9 @@ nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
|
||||
rv = aEvent->GetEventType(&type);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsAccEvent *event = NS_REINTERPRET_CAST(nsAccEvent*, aEvent);
|
||||
void *eventData = event->mEventData;
|
||||
|
||||
AtkObject *atkObj = nsAccessibleWrap::GetAtkObject(accessible);
|
||||
|
||||
// We don't create ATK objects for nsIAccessible plain text leaves,
|
||||
@ -1106,6 +1111,10 @@ nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAccessibleWrap *accWrap = GetAccessibleWrap(atkObj);
|
||||
|
||||
AtkTableChange * pAtkTableChange = nsnull;
|
||||
|
||||
switch (type) {
|
||||
case nsIAccessibleEvent::EVENT_STATE_CHANGE:
|
||||
return FireAtkStateChangeEvent(aEvent, atkObj);
|
||||
@ -1115,6 +1124,250 @@ nsAccessibleWrap::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
|
||||
|
||||
case nsIAccessibleEvent::EVENT_PROPERTY_CHANGED:
|
||||
return FireAtkPropChangedEvent(aEvent, atkObj);
|
||||
|
||||
case nsIAccessibleEvent::EVENT_FOCUS:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_FOCUS\n"));
|
||||
nsRefPtr<nsRootAccessible> rootAccWrap = accWrap->GetRootAccessible();
|
||||
if (rootAccWrap && rootAccWrap->mActivated) {
|
||||
atk_focus_tracker_notify(atkObj);
|
||||
}
|
||||
} break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_VALUE_CHANGE:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_VALUE_CHANGE\n"));
|
||||
nsCOMPtr<nsIAccessibleValue> value(do_QueryInterface(accessible));
|
||||
if (value) { // Make sure this is a numeric value
|
||||
// Don't fire for MSAA string value changes (e.g. text editing)
|
||||
// ATK values are always numeric
|
||||
g_object_notify( (GObject*)atkObj, "accessible-value" );
|
||||
}
|
||||
} break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_SELECTION_CHANGED:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_SELECTION_CHANGED\n"));
|
||||
g_signal_emit_by_name(atkObj, "selection_changed");
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_SELECTION_CHANGED\n"));
|
||||
g_signal_emit_by_name(atkObj, "text_selection_changed");
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_CARET_MOVED\n"));
|
||||
NS_ASSERTION(eventData, "Event needs event data");
|
||||
if (!eventData)
|
||||
break;
|
||||
|
||||
MAI_LOG_DEBUG(("\n\nCaret postion: %d", *(gint *)eventData ));
|
||||
g_signal_emit_by_name(atkObj,
|
||||
"text_caret_moved",
|
||||
// Curent caret position
|
||||
*(gint *)eventData);
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_TABLE_MODEL_CHANGED:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_MODEL_CHANGED\n"));
|
||||
g_signal_emit_by_name(atkObj, "model_changed");
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_TABLE_ROW_INSERT:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_INSERT\n"));
|
||||
NS_ASSERTION(eventData, "Event needs event data");
|
||||
if (!eventData)
|
||||
break;
|
||||
|
||||
pAtkTableChange = NS_REINTERPRET_CAST(AtkTableChange *, eventData);
|
||||
|
||||
g_signal_emit_by_name(atkObj,
|
||||
"row_inserted",
|
||||
// After which the rows are inserted
|
||||
pAtkTableChange->index,
|
||||
// The number of the inserted
|
||||
pAtkTableChange->count);
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_TABLE_ROW_DELETE:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_DELETE\n"));
|
||||
NS_ASSERTION(eventData, "Event needs event data");
|
||||
if (!eventData)
|
||||
break;
|
||||
|
||||
pAtkTableChange = NS_REINTERPRET_CAST(AtkTableChange *, eventData);
|
||||
|
||||
g_signal_emit_by_name(atkObj,
|
||||
"row_deleted",
|
||||
// After which the rows are deleted
|
||||
pAtkTableChange->index,
|
||||
// The number of the deleted
|
||||
pAtkTableChange->count);
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_TABLE_ROW_REORDER:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_REORDER\n"));
|
||||
g_signal_emit_by_name(atkObj, "row_reordered");
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_TABLE_COLUMN_INSERT:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_INSERT\n"));
|
||||
NS_ASSERTION(eventData, "Event needs event data");
|
||||
if (!eventData)
|
||||
break;
|
||||
|
||||
pAtkTableChange = NS_REINTERPRET_CAST(AtkTableChange *, eventData);
|
||||
|
||||
g_signal_emit_by_name(atkObj,
|
||||
"column_inserted",
|
||||
// After which the columns are inserted
|
||||
pAtkTableChange->index,
|
||||
// The number of the inserted
|
||||
pAtkTableChange->count);
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_TABLE_COLUMN_DELETE:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_DELETE\n"));
|
||||
NS_ASSERTION(eventData, "Event needs event data");
|
||||
if (!eventData)
|
||||
break;
|
||||
|
||||
pAtkTableChange = NS_REINTERPRET_CAST(AtkTableChange *, eventData);
|
||||
|
||||
g_signal_emit_by_name(atkObj,
|
||||
"column_deleted",
|
||||
// After which the columns are deleted
|
||||
pAtkTableChange->index,
|
||||
// The number of the deleted
|
||||
pAtkTableChange->count);
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_TABLE_COLUMN_REORDER:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_REORDER\n"));
|
||||
g_signal_emit_by_name(atkObj, "column_reordered");
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_SECTION_CHANGED:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_SECTION_CHANGED\n"));
|
||||
g_signal_emit_by_name(atkObj, "visible_data_changed");
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_HYPERTEXT_LINK_SELECTED:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_HYPERTEXT_LINK_SELECTED\n"));
|
||||
atk_focus_tracker_notify(atkObj);
|
||||
g_signal_emit_by_name(atkObj,
|
||||
"link_selected",
|
||||
// Selected link index
|
||||
*(gint *)eventData);
|
||||
break;
|
||||
|
||||
// Is a superclass of ATK event children_changed
|
||||
case nsIAccessibleEvent::EVENT_REORDER:
|
||||
AtkChildrenChange *pAtkChildrenChange;
|
||||
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_REORDER(children_change)\n"));
|
||||
|
||||
pAtkChildrenChange = NS_REINTERPRET_CAST(AtkChildrenChange *,
|
||||
eventData);
|
||||
nsAccessibleWrap *childAccWrap;
|
||||
if (pAtkChildrenChange && pAtkChildrenChange->child) {
|
||||
childAccWrap = NS_STATIC_CAST(nsAccessibleWrap *,
|
||||
pAtkChildrenChange->child);
|
||||
g_signal_emit_by_name (atkObj,
|
||||
pAtkChildrenChange->add ? \
|
||||
"children_changed::add" : \
|
||||
"children_changed::remove",
|
||||
pAtkChildrenChange->index,
|
||||
childAccWrap->GetAtkObject(),
|
||||
NULL);
|
||||
}
|
||||
else {
|
||||
//
|
||||
// EVENT_REORDER is normally fired by "HTML Document".
|
||||
//
|
||||
// In GOK, [only] "children_changed::add" can cause foreground
|
||||
// window accessible to update it children, which will
|
||||
// refresh "UI-Grab" window.
|
||||
//
|
||||
g_signal_emit_by_name (atkObj,
|
||||
"children_changed::add",
|
||||
-1, NULL, NULL);
|
||||
}
|
||||
|
||||
break;
|
||||
/*
|
||||
* Because dealing with menu is very different between nsIAccessible
|
||||
* and ATK, and the menu activity is important, specially transfer the
|
||||
* following two event.
|
||||
* Need more verification by AT test.
|
||||
*/
|
||||
case nsIAccessibleEvent::EVENT_MENU_START:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENU_START\n"));
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_MENU_END:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENU_END\n"));
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_WINDOW_ACTIVATE:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_ACTIVATED\n"));
|
||||
nsDocAccessibleWrap *accDocWrap =
|
||||
NS_STATIC_CAST(nsDocAccessibleWrap *, accessible.get());
|
||||
accDocWrap->mActivated = PR_TRUE;
|
||||
guint id = g_signal_lookup ("activate", MAI_TYPE_ATK_OBJECT);
|
||||
g_signal_emit(atkObj, id, 0);
|
||||
} break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_WINDOW_DEACTIVATE:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_DEACTIVATED\n"));
|
||||
nsDocAccessibleWrap *accDocWrap =
|
||||
NS_STATIC_CAST(nsDocAccessibleWrap *, accessible.get());
|
||||
accDocWrap->mActivated = PR_FALSE;
|
||||
guint id = g_signal_lookup ("deactivate", MAI_TYPE_ATK_OBJECT);
|
||||
g_signal_emit(atkObj, id, 0);
|
||||
} break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_LOAD_COMPLETE\n"));
|
||||
g_signal_emit_by_name (atkObj, "load_complete");
|
||||
} break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_RELOAD\n"));
|
||||
g_signal_emit_by_name (atkObj, "reload");
|
||||
} break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_STOPPED:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_LOAD_STOPPED\n"));
|
||||
g_signal_emit_by_name (atkObj, "load_stopped");
|
||||
} break;
|
||||
case nsIAccessibleEvent::EVENT_DOCUMENT_ATTRIBUTES_CHANGED:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_ATTRIBUTES_CHANGED\n"));
|
||||
g_signal_emit_by_name (atkObj, "attributes_changed");
|
||||
} break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_MENUPOPUP_START:
|
||||
// fire extra focus event, then go down to EVENT_SHOW
|
||||
atk_focus_tracker_notify(atkObj);
|
||||
|
||||
case nsIAccessibleEvent::EVENT_SHOW:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_SHOW\n"));
|
||||
atk_object_notify_state_change(atkObj, ATK_STATE_VISIBLE, PR_TRUE);
|
||||
atk_object_notify_state_change(atkObj, ATK_STATE_SHOWING, PR_TRUE);
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_HIDE:
|
||||
case nsIAccessibleEvent::EVENT_MENUPOPUP_END:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_HIDE\n"));
|
||||
atk_object_notify_state_change(atkObj, ATK_STATE_VISIBLE, PR_FALSE);
|
||||
atk_object_notify_state_change(atkObj, ATK_STATE_SHOWING, PR_FALSE);
|
||||
break;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -40,18 +40,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsMai.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsDocAccessibleWrap.h"
|
||||
#include "nsAccessibleEventData.h"
|
||||
#include "nsIAccessibleValue.h"
|
||||
|
||||
#include <atk/atk.h>
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "nsStateMap.h"
|
||||
|
||||
//----- nsDocAccessibleWrap -----
|
||||
|
||||
@ -64,313 +53,3 @@ nsDocAccessibleWrap::nsDocAccessibleWrap(nsIDOMNode *aDOMNode,
|
||||
nsDocAccessibleWrap::~nsDocAccessibleWrap()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent,
|
||||
nsIAccessible* aAccessible,
|
||||
void* aEventData)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAccessible);
|
||||
|
||||
// First fire nsIObserver event for internal xpcom accessibility clients
|
||||
nsDocAccessible::FireToolkitEvent(aEvent, aAccessible, aEventData);
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
MAI_LOG_DEBUG(("\n\nReceived event: aEvent=%u, obj=0x%x, data=0x%x \n",
|
||||
aEvent, aAccessible, aEventData));
|
||||
|
||||
AtkObject *atkObj = nsAccessibleWrap::GetAtkObject(aAccessible);
|
||||
|
||||
// We don't create ATK objects for nsIAccessible plain text leaves,
|
||||
// just return NS_OK in such case
|
||||
if (!atkObj) {
|
||||
NS_ASSERTION(aEvent == nsIAccessibleEvent::EVENT_SHOW ||
|
||||
aEvent == nsIAccessibleEvent::EVENT_HIDE,
|
||||
"Event other than SHOW and HIDE fired for plain text leaves");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAccessibleWrap *accWrap = GetAccessibleWrap(atkObj);
|
||||
|
||||
AtkTableChange * pAtkTableChange = nsnull;
|
||||
|
||||
switch (aEvent) {
|
||||
case nsIAccessibleEvent::EVENT_FOCUS:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_FOCUS\n"));
|
||||
nsRefPtr<nsRootAccessible> rootAccWrap = accWrap->GetRootAccessible();
|
||||
if (rootAccWrap && rootAccWrap->mActivated) {
|
||||
atk_focus_tracker_notify(atkObj);
|
||||
}
|
||||
rv = NS_OK;
|
||||
} break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_VALUE_CHANGE :
|
||||
{
|
||||
nsCOMPtr<nsIAccessibleValue> value(do_QueryInterface(aAccessible));
|
||||
if (value) { // Make sure this is a numeric value
|
||||
// Don't fire for MSAA string value changes (e.g. text editing)
|
||||
// ATK values are always numeric
|
||||
g_object_notify( (GObject*)atkObj, "accessible-value" );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_SELECTION_CHANGED:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_SELECTION_CHANGED\n"));
|
||||
g_signal_emit_by_name(atkObj, "selection_changed");
|
||||
rv = NS_OK;
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_SELECTION_CHANGED\n"));
|
||||
g_signal_emit_by_name(atkObj, "text_selection_changed");
|
||||
rv = NS_OK;
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TEXT_CARET_MOVED\n"));
|
||||
NS_ASSERTION(aEventData, "Event needs event data");
|
||||
if (!aEventData)
|
||||
break;
|
||||
|
||||
MAI_LOG_DEBUG(("\n\nCaret postion: %d", *(gint *)aEventData ));
|
||||
g_signal_emit_by_name(atkObj,
|
||||
"text_caret_moved",
|
||||
// Curent caret position
|
||||
*(gint *)aEventData);
|
||||
rv = NS_OK;
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_TABLE_MODEL_CHANGED:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_MODEL_CHANGED\n"));
|
||||
g_signal_emit_by_name(atkObj, "model_changed");
|
||||
rv = NS_OK;
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_TABLE_ROW_INSERT:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_INSERT\n"));
|
||||
NS_ASSERTION(aEventData, "Event needs event data");
|
||||
if (!aEventData)
|
||||
break;
|
||||
|
||||
pAtkTableChange = NS_REINTERPRET_CAST(AtkTableChange *, aEventData);
|
||||
|
||||
g_signal_emit_by_name(atkObj,
|
||||
"row_inserted",
|
||||
// After which the rows are inserted
|
||||
pAtkTableChange->index,
|
||||
// The number of the inserted
|
||||
pAtkTableChange->count);
|
||||
rv = NS_OK;
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_TABLE_ROW_DELETE:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_DELETE\n"));
|
||||
NS_ASSERTION(aEventData, "Event needs event data");
|
||||
if (!aEventData)
|
||||
break;
|
||||
|
||||
pAtkTableChange = NS_REINTERPRET_CAST(AtkTableChange *, aEventData);
|
||||
|
||||
g_signal_emit_by_name(atkObj,
|
||||
"row_deleted",
|
||||
// After which the rows are deleted
|
||||
pAtkTableChange->index,
|
||||
// The number of the deleted
|
||||
pAtkTableChange->count);
|
||||
rv = NS_OK;
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_TABLE_ROW_REORDER:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_ROW_REORDER\n"));
|
||||
g_signal_emit_by_name(atkObj, "row_reordered");
|
||||
rv = NS_OK;
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_TABLE_COLUMN_INSERT:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_INSERT\n"));
|
||||
NS_ASSERTION(aEventData, "Event needs event data");
|
||||
if (!aEventData)
|
||||
break;
|
||||
|
||||
pAtkTableChange = NS_REINTERPRET_CAST(AtkTableChange *, aEventData);
|
||||
|
||||
g_signal_emit_by_name(atkObj,
|
||||
"column_inserted",
|
||||
// After which the columns are inserted
|
||||
pAtkTableChange->index,
|
||||
// The number of the inserted
|
||||
pAtkTableChange->count);
|
||||
rv = NS_OK;
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_TABLE_COLUMN_DELETE:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_DELETE\n"));
|
||||
NS_ASSERTION(aEventData, "Event needs event data");
|
||||
if (!aEventData)
|
||||
break;
|
||||
|
||||
pAtkTableChange = NS_REINTERPRET_CAST(AtkTableChange *, aEventData);
|
||||
|
||||
g_signal_emit_by_name(atkObj,
|
||||
"column_deleted",
|
||||
// After which the columns are deleted
|
||||
pAtkTableChange->index,
|
||||
// The number of the deleted
|
||||
pAtkTableChange->count);
|
||||
rv = NS_OK;
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_TABLE_COLUMN_REORDER:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_TABLE_COLUMN_REORDER\n"));
|
||||
g_signal_emit_by_name(atkObj, "column_reordered");
|
||||
rv = NS_OK;
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_SECTION_CHANGED:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_SECTION_CHANGED\n"));
|
||||
g_signal_emit_by_name(atkObj, "visible_data_changed");
|
||||
rv = NS_OK;
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_HYPERTEXT_LINK_SELECTED:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_HYPERTEXT_LINK_SELECTED\n"));
|
||||
atk_focus_tracker_notify(atkObj);
|
||||
g_signal_emit_by_name(atkObj,
|
||||
"link_selected",
|
||||
// Selected link index
|
||||
*(gint *)aEventData);
|
||||
rv = NS_OK;
|
||||
break;
|
||||
|
||||
// Is a superclass of ATK event children_changed
|
||||
case nsIAccessibleEvent::EVENT_REORDER:
|
||||
AtkChildrenChange *pAtkChildrenChange;
|
||||
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_REORDER(children_change)\n"));
|
||||
|
||||
pAtkChildrenChange = NS_REINTERPRET_CAST(AtkChildrenChange *,
|
||||
aEventData);
|
||||
nsAccessibleWrap *childAccWrap;
|
||||
if (pAtkChildrenChange && pAtkChildrenChange->child) {
|
||||
childAccWrap = NS_STATIC_CAST(nsAccessibleWrap *,
|
||||
pAtkChildrenChange->child);
|
||||
g_signal_emit_by_name (atkObj,
|
||||
pAtkChildrenChange->add ? \
|
||||
"children_changed::add" : \
|
||||
"children_changed::remove",
|
||||
pAtkChildrenChange->index,
|
||||
childAccWrap->GetAtkObject(),
|
||||
NULL);
|
||||
}
|
||||
else {
|
||||
//
|
||||
// EVENT_REORDER is normally fired by "HTML Document".
|
||||
//
|
||||
// In GOK, [only] "children_changed::add" can cause foreground
|
||||
// window accessible to update it children, which will
|
||||
// refresh "UI-Grab" window.
|
||||
//
|
||||
g_signal_emit_by_name (atkObj,
|
||||
"children_changed::add",
|
||||
-1, NULL, NULL);
|
||||
}
|
||||
|
||||
rv = NS_OK;
|
||||
break;
|
||||
|
||||
/*
|
||||
* Because dealing with menu is very different between nsIAccessible
|
||||
* and ATK, and the menu activity is important, specially transfer the
|
||||
* following two event.
|
||||
* Need more verification by AT test.
|
||||
*/
|
||||
case nsIAccessibleEvent::EVENT_MENU_START:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENU_START\n"));
|
||||
rv = NS_OK;
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_MENU_END:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_MENU_END\n"));
|
||||
rv = NS_OK;
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_WINDOW_ACTIVATE:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_ACTIVATED\n"));
|
||||
nsDocAccessibleWrap *accDocWrap =
|
||||
NS_STATIC_CAST(nsDocAccessibleWrap *, aAccessible);
|
||||
accDocWrap->mActivated = PR_TRUE;
|
||||
guint id = g_signal_lookup ("activate", MAI_TYPE_ATK_OBJECT);
|
||||
g_signal_emit(atkObj, id, 0);
|
||||
rv = NS_OK;
|
||||
} break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_WINDOW_DEACTIVATE:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_WINDOW_DEACTIVATED\n"));
|
||||
nsDocAccessibleWrap *accDocWrap =
|
||||
NS_STATIC_CAST(nsDocAccessibleWrap *, aAccessible);
|
||||
accDocWrap->mActivated = PR_FALSE;
|
||||
guint id = g_signal_lookup ("deactivate", MAI_TYPE_ATK_OBJECT);
|
||||
g_signal_emit(atkObj, id, 0);
|
||||
rv = NS_OK;
|
||||
} break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_LOAD_COMPLETE\n"));
|
||||
g_signal_emit_by_name (atkObj, "load_complete");
|
||||
rv = NS_OK;
|
||||
} break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_RELOAD\n"));
|
||||
g_signal_emit_by_name (atkObj, "reload");
|
||||
rv = NS_OK;
|
||||
} break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_STOPPED:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_LOAD_STOPPED\n"));
|
||||
g_signal_emit_by_name (atkObj, "load_stopped");
|
||||
rv = NS_OK;
|
||||
} break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_DOCUMENT_ATTRIBUTES_CHANGED:
|
||||
{
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_DOCUMENT_ATTRIBUTES_CHANGED\n"));
|
||||
g_signal_emit_by_name (atkObj, "attributes_changed");
|
||||
rv = NS_OK;
|
||||
} break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_MENUPOPUP_START:
|
||||
// fire extra focus event, then go down to EVENT_SHOW
|
||||
atk_focus_tracker_notify(atkObj);
|
||||
|
||||
case nsIAccessibleEvent::EVENT_SHOW:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_SHOW\n"));
|
||||
atk_object_notify_state_change(atkObj, ATK_STATE_VISIBLE, PR_TRUE);
|
||||
atk_object_notify_state_change(atkObj, ATK_STATE_SHOWING, PR_TRUE);
|
||||
rv = NS_OK;
|
||||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_HIDE:
|
||||
case nsIAccessibleEvent::EVENT_MENUPOPUP_END:
|
||||
MAI_LOG_DEBUG(("\n\nReceived: EVENT_HIDE\n"));
|
||||
atk_object_notify_state_change(atkObj, ATK_STATE_VISIBLE, PR_FALSE);
|
||||
atk_object_notify_state_change(atkObj, ATK_STATE_SHOWING, PR_FALSE);
|
||||
rv = NS_OK;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Don't transfer others
|
||||
MAI_LOG_DEBUG(("\n\nReceived an unknown event=0x%u\n", aEvent));
|
||||
break;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -54,10 +54,6 @@ public:
|
||||
nsDocAccessibleWrap(nsIDOMNode *aNode, nsIWeakReference *aShell);
|
||||
virtual ~nsDocAccessibleWrap();
|
||||
|
||||
NS_IMETHOD FireToolkitEvent(PRUint32 aEvent, nsIAccessible* aAccessible,
|
||||
void* aData);
|
||||
|
||||
protected:
|
||||
PRBool mActivated;
|
||||
};
|
||||
|
||||
|
@ -476,13 +476,6 @@ PRBool nsRootAccessible::FireAccessibleFocusEvent(nsIAccessible *aAccessible,
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIAccessible> privateAccessible =
|
||||
do_QueryInterface(finalFocusAccessible);
|
||||
NS_ASSERTION(privateAccessible , "No nsPIAccessible for nsIAccessible");
|
||||
if (!privateAccessible) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRUint32 role = Role(finalFocusAccessible);
|
||||
if (role == nsIAccessibleRole::ROLE_MENUITEM) {
|
||||
if (!mIsInDHTMLMenu) { // Entering menus
|
||||
@ -503,7 +496,7 @@ PRBool nsRootAccessible::FireAccessibleFocusEvent(nsIAccessible *aAccessible,
|
||||
gLastFocusedNode = finalFocusNode;
|
||||
NS_IF_ADDREF(gLastFocusedNode);
|
||||
|
||||
nsCOMPtr<nsIAccessibleDocument> docAccessible = do_QueryInterface(privateAccessible);
|
||||
nsCOMPtr<nsIAccessibleDocument> docAccessible = do_QueryInterface(finalFocusAccessible);
|
||||
if (docAccessible) {
|
||||
// Doc is gaining focus, but actual focus may be on an element within document
|
||||
nsCOMPtr<nsIDOMNode> realFocusedNode = GetCurrentFocus();
|
||||
@ -515,15 +508,15 @@ PRBool nsRootAccessible::FireAccessibleFocusEvent(nsIAccessible *aAccessible,
|
||||
}
|
||||
}
|
||||
|
||||
privateAccessible->FireToolkitEvent(nsIAccessibleEvent::EVENT_FOCUS,
|
||||
finalFocusAccessible, nsnull);
|
||||
FireDelayedToolkitEvent(nsIAccessibleEvent::EVENT_FOCUS,
|
||||
finalFocusNode, nsnull);
|
||||
|
||||
// Fire state change event for focus
|
||||
nsCOMPtr<nsIAccessibleStateChangeEvent> accEvent =
|
||||
new nsAccStateChangeEvent(finalFocusAccessible,
|
||||
new nsAccStateChangeEvent(finalFocusNode,
|
||||
nsIAccessibleStates::STATE_FOCUSED,
|
||||
PR_FALSE, PR_TRUE);
|
||||
FireAccessibleEvent(accEvent);
|
||||
FireDelayedAccessibleEvent(accEvent);
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user