Bug 514595 - it's not necessary to keep two events type for show and two ones for hide, r=marocz, davidb, ginn, sr=roc

--HG--
rename : accessible/tests/mochitest/test_events_mutation_coalesce.html => accessible/tests/mochitest/test_events_coalescence.html
This commit is contained in:
Alexander Surkov 2009-09-09 17:03:14 +08:00
Родитель f4161907fa
Коммит 779138bd8c
22 изменённых файлов: 308 добавлений и 331 удалений

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

@ -46,7 +46,7 @@ interface nsObjectFrame;
interface nsIContent;
interface nsITimer;
[uuid(05481634-4700-45d6-8a0c-704f3a5abc00)]
[uuid(2fb528bc-33ec-4987-bbaa-21cab013f092)]
interface nsIAccessibilityService : nsIAccessibleRetrieval
{
nsIAccessible createOuterDocAccessible(in nsIDOMNode aNode);
@ -86,22 +86,24 @@ interface nsIAccessibilityService : nsIAccessibleRetrieval
void removeNativeRootAccessible(in nsIAccessible aRootAccessible);
/**
* Invalidate the accessibility cache associated with aPresShell, for accessibles
* that were generated for aContainerContent and its subtree.
* The container content node for the change is passed in, rather than the
* changed presentation for the content node itself.
* @param aPresShell The presShell where changes occured
* @param aChangeContent The affected DOM content
* @param aEvent The event from nsIAccessibleEvent that
* caused the change:
* Must be one of:
* EVENT_REORDER (change),
* EVENT_SHOW (make visible or create) or
* EVENT_HIDE (destroy or hide)
* Used to describe sort of changes leading to accessible tree invalidation.
*/
void invalidateSubtreeFor(in nsIPresShell aPresShell,
in nsIContent aChangedContent,
in PRUint32 aEvent);
const unsigned long NODE_APPEND = 0x01;
const unsigned long NODE_REMOVE = 0x02;
const unsigned long NODE_SIGNIFICANT_CHANGE = 0x03;
const unsigned long FRAME_SHOW = 0x04;
const unsigned long FRAME_HIDE = 0x05;
const unsigned long FRAME_SIGNIFICANT_CHANGE = 0x06;
/**
* Invalidate the accessible tree when DOM tree or frame tree is changed.
*
* @param aPresShell [in] the presShell where changes occured
* @param aContent [in] the affected DOM content
* @param aChangeType [in] the change type (see constants declared above)
*/
void invalidateSubtreeFor(in nsIPresShell aPresShell, in nsIContent aContent,
in PRUint32 aChangeType);
/**
* An internal doc load event has occured. Handle the event and remove it from the list.

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

@ -61,426 +61,403 @@ interface nsIDOMNode;
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(ba448f0e-a761-48c8-a0f5-1f25e23d4fe4)]
[scriptable, uuid(5713f093-1d67-4666-b9e2-516f410976bc)]
interface nsIAccessibleEvent : nsISupports
{
/**
* An object has been created.
*/
const unsigned long EVENT_DOM_CREATE = 0x0001;
const unsigned long EVENT_SHOW = 0x0001;
/**
* An object has been destroyed.
*/
const unsigned long EVENT_DOM_DESTROY = 0x0002;
const unsigned long EVENT_HIDE = 0x0002;
/**
* An object's properties or content have changed significantly so that the
* type of object has really changed, and therefore the accessible should be
* destroyed or recreated.
* An object's children have changed
*/
const unsigned long EVENT_DOM_SIGNIFICANT_CHANGE = 0x0003;
/**
* A hidden object is shown -- this is a layout occurance and is thus asynchronous
*/
const unsigned long EVENT_ASYNCH_SHOW = 0x0004;
/**
* An object is hidden -- this is a layout occurance and is thus asynchronous
*/
const unsigned long EVENT_ASYNCH_HIDE = 0x0005;
/**
* An object had a significant layout change which could affect
* the type of accessible object -- this is a layout occurance and is thus asynchronous
*/
const unsigned long EVENT_ASYNCH_SIGNIFICANT_CHANGE = 0x0006;
const unsigned long EVENT_REORDER = 0x0003;
/**
* The active descendant of a component has changed. The active descendant
* is used in objects with transient children.
*/
const unsigned long EVENT_ACTIVE_DECENDENT_CHANGED = 0x0007;
const unsigned long EVENT_ACTIVE_DECENDENT_CHANGED = 0x0004;
/**
* An object has received the keyboard focus.
*/
const unsigned long EVENT_FOCUS = 0x0008;
const unsigned long EVENT_FOCUS = 0x0005;
/**
* An object's state has changed.
*/
const unsigned long EVENT_STATE_CHANGE = 0x0009;
const unsigned long EVENT_STATE_CHANGE = 0x0006;
/**
* An object has changed location, shape, or size.
*/
const unsigned long EVENT_LOCATION_CHANGE = 0x000A;
const unsigned long EVENT_LOCATION_CHANGE = 0x0007;
/**
* An object's Name property has changed.
*/
const unsigned long EVENT_NAME_CHANGE = 0x000B;
const unsigned long EVENT_NAME_CHANGE = 0x0008;
/**
* An object's Description property has changed.
*/
const unsigned long EVENT_DESCRIPTION_CHANGE = 0x000C;
const unsigned long EVENT_DESCRIPTION_CHANGE = 0x0009;
/**
* An object's Value property has changed.
*/
const unsigned long EVENT_VALUE_CHANGE = 0x000D;
const unsigned long EVENT_VALUE_CHANGE = 0x000A;
/**
* An object's help has changed.
*/
const unsigned long EVENT_HELP_CHANGE = 0x000E;
const unsigned long EVENT_HELP_CHANGE = 0x000B;
/**
* An object's default action has changed.
*/
const unsigned long EVENT_DEFACTION_CHANGE = 0x000F;
const unsigned long EVENT_DEFACTION_CHANGE = 0x000C;
/**
* An object's action has changed.
*/
const unsigned long EVENT_ACTION_CHANGE = 0x0010;
const unsigned long EVENT_ACTION_CHANGE = 0x000D;
/**
* An object's keyboard shortcut has changed.
*/
const unsigned long EVENT_ACCELERATOR_CHANGE = 0x0011;
const unsigned long EVENT_ACCELERATOR_CHANGE = 0x000E;
/**
* The selection within a container object has changed.
*/
const unsigned long EVENT_SELECTION = 0x0012;
const unsigned long EVENT_SELECTION = 0x000F;
/**
* An item within a container object has been added to the selection.
*/
const unsigned long EVENT_SELECTION_ADD = 0x0013;
const unsigned long EVENT_SELECTION_ADD = 0x0010;
/**
* An item within a container object has been removed from the selection.
*/
const unsigned long EVENT_SELECTION_REMOVE = 0x0014;
const unsigned long EVENT_SELECTION_REMOVE = 0x0011;
/**
* Numerous selection changes have occurred within a container object.
*/
const unsigned long EVENT_SELECTION_WITHIN = 0x0015;
const unsigned long EVENT_SELECTION_WITHIN = 0x0012;
/**
* An alert has been generated. Server applications send this event when a
* user needs to know that a user interface element has changed.
*/
const unsigned long EVENT_ALERT = 0x0016;
const unsigned long EVENT_ALERT = 0x0013;
/**
* The foreground window has changed.
*/
const unsigned long EVENT_FOREGROUND = 0x0017;
const unsigned long EVENT_FOREGROUND = 0x0014;
/**
* A menu item on the menu bar has been selected.
*/
const unsigned long EVENT_MENU_START = 0x0018;
const unsigned long EVENT_MENU_START = 0x0015;
/**
* A menu from the menu bar has been closed.
*/
const unsigned long EVENT_MENU_END = 0x0019;
const unsigned long EVENT_MENU_END = 0x0016;
/**
* A pop-up menu has been displayed.
*/
const unsigned long EVENT_MENUPOPUP_START = 0x001A;
const unsigned long EVENT_MENUPOPUP_START = 0x0017;
/**
* A pop-up menu has been closed.
*/
const unsigned long EVENT_MENUPOPUP_END = 0x001B;
const unsigned long EVENT_MENUPOPUP_END = 0x0018;
/**
* A window has received mouse capture.
*/
const unsigned long EVENT_CAPTURE_START = 0x001C;
const unsigned long EVENT_CAPTURE_START = 0x0019;
/**
* A window has lost mouse capture.
*/
const unsigned long EVENT_CAPTURE_END = 0x001D;
const unsigned long EVENT_CAPTURE_END = 0x001A;
/**
* A window is being moved or resized.
*/
const unsigned long EVENT_MOVESIZE_START = 0x001E;
const unsigned long EVENT_MOVESIZE_START = 0x001B;
/**
* The movement or resizing of a window has finished
*/
const unsigned long EVENT_MOVESIZE_END = 0x001F;
const unsigned long EVENT_MOVESIZE_END = 0x001C;
/**
* A window has entered context-sensitive Help mode
*/
const unsigned long EVENT_CONTEXTHELP_START = 0x0020;
const unsigned long EVENT_CONTEXTHELP_START = 0x001D;
/**
* A window has exited context-sensitive Help mode
*/
const unsigned long EVENT_CONTEXTHELP_END = 0x0021;
const unsigned long EVENT_CONTEXTHELP_END = 0x001E;
/**
* An application is about to enter drag-and-drop mode
*/
const unsigned long EVENT_DRAGDROP_START = 0x0022;
const unsigned long EVENT_DRAGDROP_START = 0x001F;
/**
* An application is about to exit drag-and-drop mode
*/
const unsigned long EVENT_DRAGDROP_END = 0x0023;
const unsigned long EVENT_DRAGDROP_END = 0x0020;
/**
* A dialog box has been displayed
*/
const unsigned long EVENT_DIALOG_START = 0x0024;
const unsigned long EVENT_DIALOG_START = 0x0021;
/**
* A dialog box has been closed
*/
const unsigned long EVENT_DIALOG_END = 0x0025;
const unsigned long EVENT_DIALOG_END = 0x0022;
/**
* Scrolling has started on a scroll bar
*/
const unsigned long EVENT_SCROLLING_START = 0x0026;
const unsigned long EVENT_SCROLLING_START = 0x0023;
/**
* Scrolling has ended on a scroll bar
*/
const unsigned long EVENT_SCROLLING_END = 0x0027;
const unsigned long EVENT_SCROLLING_END = 0x0024;
/**
* A window object is about to be minimized or maximized
*/
const unsigned long EVENT_MINIMIZE_START = 0x0028;
const unsigned long EVENT_MINIMIZE_START = 0x0025;
/**
* A window object has been minimized or maximized
*/
const unsigned long EVENT_MINIMIZE_END = 0x0029;
const unsigned long EVENT_MINIMIZE_END = 0x0026;
/**
* XXX:
*/
const unsigned long EVENT_DOCUMENT_LOAD_START = 0x002A;
const unsigned long EVENT_DOCUMENT_LOAD_START = 0x0027;
/**
* The loading of the document has completed.
*/
const unsigned long EVENT_DOCUMENT_LOAD_COMPLETE = 0x002B;
const unsigned long EVENT_DOCUMENT_LOAD_COMPLETE = 0x0028;
/**
* The document contents are being reloaded.
*/
const unsigned long EVENT_DOCUMENT_RELOAD = 0x002C;
const unsigned long EVENT_DOCUMENT_RELOAD = 0x0029;
/**
* The loading of the document was interrupted.
*/
const unsigned long EVENT_DOCUMENT_LOAD_STOPPED = 0x002D;
const unsigned long EVENT_DOCUMENT_LOAD_STOPPED = 0x002A;
/**
* The document wide attributes of the document object have changed.
*/
const unsigned long EVENT_DOCUMENT_ATTRIBUTES_CHANGED = 0x002E;
const unsigned long EVENT_DOCUMENT_ATTRIBUTES_CHANGED = 0x002B;
/**
* The contents of the document have changed.
*/
const unsigned long EVENT_DOCUMENT_CONTENT_CHANGED = 0x002F;
const unsigned long EVENT_DOCUMENT_CONTENT_CHANGED = 0x002C;
const unsigned long EVENT_PROPERTY_CHANGED = 0x0030;
const unsigned long EVENT_SELECTION_CHANGED = 0x0031;
const unsigned long EVENT_PROPERTY_CHANGED = 0x002D;
const unsigned long EVENT_SELECTION_CHANGED = 0x002E;
/**
* A text object's attributes changed.
* Also see EVENT_OBJECT_ATTRIBUTE_CHANGED.
*/
const unsigned long EVENT_TEXT_ATTRIBUTE_CHANGED = 0x0032;
const unsigned long EVENT_TEXT_ATTRIBUTE_CHANGED = 0x002F;
/**
* The caret has moved to a new position.
*/
const unsigned long EVENT_TEXT_CARET_MOVED = 0x0033;
const unsigned long EVENT_TEXT_CARET_MOVED = 0x0030;
/**
* This event indicates general text changes, i.e. changes to text that is
* exposed through the IAccessibleText and IAccessibleEditableText interfaces.
*/
const unsigned long EVENT_TEXT_CHANGED = 0x0034;
const unsigned long EVENT_TEXT_CHANGED = 0x0031;
/**
* Text was inserted.
*/
const unsigned long EVENT_TEXT_INSERTED = 0x0035;
const unsigned long EVENT_TEXT_INSERTED = 0x0032;
/**
* Text was removed.
*/
const unsigned long EVENT_TEXT_REMOVED = 0x0036;
const unsigned long EVENT_TEXT_REMOVED = 0x0033;
/**
* Text was updated.
*/
const unsigned long EVENT_TEXT_UPDATED = 0x0037;
const unsigned long EVENT_TEXT_UPDATED = 0x0034;
/**
* The text selection changed.
*/
const unsigned long EVENT_TEXT_SELECTION_CHANGED = 0x0038;
const unsigned long EVENT_TEXT_SELECTION_CHANGED = 0x0035;
/**
* A visibile data event indicates the change of the visual appearance
* of an accessible object. This includes for example most of the
* attributes available via the IAccessibleComponent interface.
*/
const unsigned long EVENT_VISIBLE_DATA_CHANGED = 0x0039;
const unsigned long EVENT_VISIBLE_DATA_CHANGED = 0x0036;
/**
* The caret moved from one column to the next.
*/
const unsigned long EVENT_TEXT_COLUMN_CHANGED = 0x003A;
const unsigned long EVENT_TEXT_COLUMN_CHANGED = 0x0037;
/**
* The caret moved from one section to the next.
*/
const unsigned long EVENT_SECTION_CHANGED = 0x003B;
const unsigned long EVENT_SECTION_CHANGED = 0x0038;
/**
* A table caption changed.
*/
const unsigned long EVENT_TABLE_CAPTION_CHANGED = 0x003C;
const unsigned long EVENT_TABLE_CAPTION_CHANGED = 0x0039;
/**
* A table's data changed.
*/
const unsigned long EVENT_TABLE_MODEL_CHANGED = 0x003D;
const unsigned long EVENT_TABLE_MODEL_CHANGED = 0x003A;
/**
* A table's summary changed.
*/
const unsigned long EVENT_TABLE_SUMMARY_CHANGED = 0x003E;
const unsigned long EVENT_TABLE_SUMMARY_CHANGED = 0x003B;
/**
* A table's row description changed.
*/
const unsigned long EVENT_TABLE_ROW_DESCRIPTION_CHANGED = 0x003F;
const unsigned long EVENT_TABLE_ROW_DESCRIPTION_CHANGED = 0x003C;
/**
* A table's row header changed.
*/
const unsigned long EVENT_TABLE_ROW_HEADER_CHANGED = 0x0040;
const unsigned long EVENT_TABLE_ROW_HEADER_CHANGED = 0x003D;
const unsigned long EVENT_TABLE_ROW_INSERT = 0x0041;
const unsigned long EVENT_TABLE_ROW_DELETE = 0x0042;
const unsigned long EVENT_TABLE_ROW_REORDER = 0x0043;
const unsigned long EVENT_TABLE_ROW_INSERT = 0x003E;
const unsigned long EVENT_TABLE_ROW_DELETE = 0x003F;
const unsigned long EVENT_TABLE_ROW_REORDER = 0x0040;
/**
* A table's column description changed.
*/
const unsigned long EVENT_TABLE_COLUMN_DESCRIPTION_CHANGED = 0x0044;
const unsigned long EVENT_TABLE_COLUMN_DESCRIPTION_CHANGED = 0x0041;
/**
* A table's column header changed.
*/
const unsigned long EVENT_TABLE_COLUMN_HEADER_CHANGED = 0x0045;
const unsigned long EVENT_TABLE_COLUMN_HEADER_CHANGED = 0x0042;
const unsigned long EVENT_TABLE_COLUMN_INSERT = 0x0046;
const unsigned long EVENT_TABLE_COLUMN_DELETE = 0x0047;
const unsigned long EVENT_TABLE_COLUMN_REORDER = 0x0048;
const unsigned long EVENT_TABLE_COLUMN_INSERT = 0x0043;
const unsigned long EVENT_TABLE_COLUMN_DELETE = 0x0044;
const unsigned long EVENT_TABLE_COLUMN_REORDER = 0x0045;
const unsigned long EVENT_WINDOW_ACTIVATE = 0x0049;
const unsigned long EVENT_WINDOW_CREATE = 0x004A;
const unsigned long EVENT_WINDOW_DEACTIVATE = 0x004B;
const unsigned long EVENT_WINDOW_DESTROY = 0x004C;
const unsigned long EVENT_WINDOW_MAXIMIZE = 0x004D;
const unsigned long EVENT_WINDOW_MINIMIZE = 0x004E;
const unsigned long EVENT_WINDOW_RESIZE = 0x004F;
const unsigned long EVENT_WINDOW_RESTORE = 0x0050;
const unsigned long EVENT_WINDOW_ACTIVATE = 0x0046;
const unsigned long EVENT_WINDOW_CREATE = 0x0047;
const unsigned long EVENT_WINDOW_DEACTIVATE = 0x0048;
const unsigned long EVENT_WINDOW_DESTROY = 0x0049;
const unsigned long EVENT_WINDOW_MAXIMIZE = 0x004A;
const unsigned long EVENT_WINDOW_MINIMIZE = 0x004B;
const unsigned long EVENT_WINDOW_RESIZE = 0x004C;
const unsigned long EVENT_WINDOW_RESTORE = 0x004D;
/**
* The ending index of this link within the containing string has changed.
*/
const unsigned long EVENT_HYPERLINK_END_INDEX_CHANGED = 0x0051;
const unsigned long EVENT_HYPERLINK_END_INDEX_CHANGED = 0x004E;
/**
* The number of anchors assoicated with this hyperlink object has changed.
*/
const unsigned long EVENT_HYPERLINK_NUMBER_OF_ANCHORS_CHANGED = 0x0052;
const unsigned long EVENT_HYPERLINK_NUMBER_OF_ANCHORS_CHANGED = 0x004F;
/**
* The hyperlink selected state changed from selected to unselected or
* from unselected to selected.
*/
const unsigned long EVENT_HYPERLINK_SELECTED_LINK_CHANGED = 0x0053;
const unsigned long EVENT_HYPERLINK_SELECTED_LINK_CHANGED = 0x0050;
/**
* One of the links associated with the hypertext object has been activated.
*/
const unsigned long EVENT_HYPERTEXT_LINK_ACTIVATED = 0x0054;
const unsigned long EVENT_HYPERTEXT_LINK_ACTIVATED = 0x0051;
/**
* One of the links associated with the hypertext object has been selected.
*/
const unsigned long EVENT_HYPERTEXT_LINK_SELECTED = 0x0055;
const unsigned long EVENT_HYPERTEXT_LINK_SELECTED = 0x0052;
/**
* The starting index of this link within the containing string has changed.
*/
const unsigned long EVENT_HYPERLINK_START_INDEX_CHANGED = 0x0056;
const unsigned long EVENT_HYPERLINK_START_INDEX_CHANGED = 0x0053;
/**
* Focus has changed from one hypertext object to another, or focus moved
* from a non-hypertext object to a hypertext object, or focus moved from a
* hypertext object to a non-hypertext object.
*/
const unsigned long EVENT_HYPERTEXT_CHANGED = 0x0057;
const unsigned long EVENT_HYPERTEXT_CHANGED = 0x0054;
/**
* The number of hyperlinks associated with a hypertext object changed.
*/
const unsigned long EVENT_HYPERTEXT_NLINKS_CHANGED = 0x0058;
const unsigned long EVENT_HYPERTEXT_NLINKS_CHANGED = 0x0055;
/**
* An object's attributes changed. Also see EVENT_TEXT_ATTRIBUTE_CHANGED.
*/
const unsigned long EVENT_OBJECT_ATTRIBUTE_CHANGED = 0x0059;
const unsigned long EVENT_OBJECT_ATTRIBUTE_CHANGED = 0x0056;
/**
* A slide changed in a presentation document or a page boundary was
* crossed in a word processing document.
*/
const unsigned long EVENT_PAGE_CHANGED = 0x005A;
const unsigned long EVENT_PAGE_CHANGED = 0x0057;
/**
* Used internally in Gecko.
*/
const unsigned long EVENT_INTERNAL_LOAD = 0x005B;
/**
* An object's children have changed
*/
const unsigned long EVENT_REORDER = 0x005C;
const unsigned long EVENT_INTERNAL_LOAD = 0x0058;
/**
* Help make sure event map does not get out-of-line.
*/
const unsigned long EVENT_LAST_ENTRY = 0x005D;
const unsigned long EVENT_LAST_ENTRY = 0x0059;
/**
* The type of event, based on the enumerated event values

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

@ -1131,10 +1131,8 @@ nsAccessibleWrap::FirePlatformEvent(nsIAccessibleEvent *aEvent)
// We don't create ATK objects for nsIAccessible plain text leaves,
// just return NS_OK in such case
if (!atkObj) {
NS_ASSERTION(type == nsIAccessibleEvent::EVENT_ASYNCH_SHOW ||
type == nsIAccessibleEvent::EVENT_ASYNCH_HIDE ||
type == nsIAccessibleEvent::EVENT_DOM_CREATE ||
type == nsIAccessibleEvent::EVENT_DOM_DESTROY,
NS_ASSERTION(type == nsIAccessibleEvent::EVENT_SHOW ||
type == nsIAccessibleEvent::EVENT_HIDE,
"Event other than SHOW and HIDE fired for plain text leaves");
return NS_OK;
}
@ -1308,12 +1306,10 @@ nsAccessibleWrap::FirePlatformEvent(nsIAccessibleEvent *aEvent)
g_signal_emit_by_name(atkObj, "visible_data_changed");
break;
case nsIAccessibleEvent::EVENT_DOM_CREATE:
case nsIAccessibleEvent::EVENT_ASYNCH_SHOW:
case nsIAccessibleEvent::EVENT_SHOW:
return FireAtkShowHideEvent(aEvent, atkObj, PR_TRUE);
case nsIAccessibleEvent::EVENT_DOM_DESTROY:
case nsIAccessibleEvent::EVENT_ASYNCH_HIDE:
case nsIAccessibleEvent::EVENT_HIDE:
return FireAtkShowHideEvent(aEvent, atkObj, PR_FALSE);
/*

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

@ -2042,25 +2042,27 @@ NS_IMETHODIMP nsAccessibilityService::RemoveNativeRootAccessible(nsIAccessible *
}
// Called from layout when the frame tree owned by a node changes significantly
NS_IMETHODIMP nsAccessibilityService::InvalidateSubtreeFor(nsIPresShell *aShell,
nsIContent *aChangeContent,
PRUint32 aEvent)
NS_IMETHODIMP
nsAccessibilityService::InvalidateSubtreeFor(nsIPresShell *aShell,
nsIContent *aChangeContent,
PRUint32 aChangeType)
{
NS_ASSERTION(aEvent == nsIAccessibleEvent::EVENT_ASYNCH_SIGNIFICANT_CHANGE ||
aEvent == nsIAccessibleEvent::EVENT_ASYNCH_SHOW ||
aEvent == nsIAccessibleEvent::EVENT_ASYNCH_HIDE ||
aEvent == nsIAccessibleEvent::EVENT_DOM_SIGNIFICANT_CHANGE ||
aEvent == nsIAccessibleEvent::EVENT_DOM_CREATE ||
aEvent == nsIAccessibleEvent::EVENT_DOM_DESTROY,
NS_ASSERTION(aChangeType == nsIAccessibilityService::FRAME_SIGNIFICANT_CHANGE ||
aChangeType == nsIAccessibilityService::FRAME_SHOW ||
aChangeType == nsIAccessibilityService::FRAME_HIDE ||
aChangeType == nsIAccessibilityService::NODE_SIGNIFICANT_CHANGE ||
aChangeType == nsIAccessibilityService::NODE_APPEND ||
aChangeType == nsIAccessibilityService::NODE_REMOVE,
"Incorrect aEvent passed in");
NS_ENSURE_ARG_POINTER(aShell);
nsCOMPtr<nsIAccessibleDocument> accessibleDoc =
nsAccessNode::GetDocAccessibleFor(aShell->GetDocument());
nsRefPtr<nsDocAccessible> docAcc =
nsAccUtils::QueryAccessibleDocument(accessibleDoc);
if (docAcc)
docAcc->InvalidateCacheSubtree(aChangeContent, aEvent);
docAcc->InvalidateCacheSubtree(aChangeContent, aChangeType);
return NS_OK;
}

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

@ -298,12 +298,9 @@ static const char kRoleNames[][20] = {
*/
static const char kEventTypeNames[][40] = {
"unknown", //
"DOM node create", // EVENT_DOM_CREATE
"DOM node destroy", // EVENT_DOM_DESTROY
"DOM node significant change", // EVENT_DOM_SIGNIFICANT_CHANGE
"async show", // EVENT_ASYNCH_SHOW
"async hide", // EVENT_ASYNCH_HIDE
"async significant change", // EVENT_ASYNCH_SIGNIFICANT_CHANGE
"show", // EVENT_SHOW
"hide", // EVENT_HIDE
"reorder", // EVENT_REORDER
"active decendent change", // EVENT_ACTIVE_DECENDENT_CHANGED
"focus", // EVENT_FOCUS
"state change", // EVENT_STATE_CHANGE
@ -388,8 +385,7 @@ static const char kEventTypeNames[][40] = {
"hypertext links count changed", // EVENT_HYPERTEXT_NLINKS_CHANGED
"object attribute changed", // EVENT_OBJECT_ATTRIBUTE_CHANGED
"page changed", // EVENT_PAGE_CHANGED
"internal load", // EVENT_INTERNAL_LOAD
"reorder" // EVENT_REORDER
"internal load" // EVENT_INTERNAL_LOAD
};
/**

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

@ -77,21 +77,19 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsAccEvent)
// nsAccEvent. Constructors
nsAccEvent::nsAccEvent(PRUint32 aEventType, nsIAccessible *aAccessible,
PRBool aIsAsynch, EEventRule aEventRule)
: mEventType(aEventType)
, mEventRule(aEventRule)
, mAccessible(aAccessible)
PRBool aIsAsync, EEventRule aEventRule) :
mEventType(aEventType), mEventRule(aEventRule), mIsAsync(aIsAsync),
mAccessible(aAccessible)
{
CaptureIsFromUserInput(aIsAsynch);
CaptureIsFromUserInput();
}
nsAccEvent::nsAccEvent(PRUint32 aEventType, nsIDOMNode *aDOMNode,
PRBool aIsAsynch, EEventRule aEventRule)
: mEventType(aEventType)
, mEventRule(aEventRule)
, mDOMNode(aDOMNode)
PRBool aIsAsync, EEventRule aEventRule) :
mEventType(aEventType), mEventRule(aEventRule), mIsAsync(aIsAsync),
mDOMNode(aDOMNode)
{
CaptureIsFromUserInput(aIsAsynch);
CaptureIsFromUserInput();
}
void nsAccEvent::GetLastEventAttributes(nsIDOMNode *aNode,
@ -107,7 +105,8 @@ void nsAccEvent::GetLastEventAttributes(nsIDOMNode *aNode,
}
}
void nsAccEvent::CaptureIsFromUserInput(PRBool aIsAsynch)
void
nsAccEvent::CaptureIsFromUserInput()
{
nsCOMPtr<nsIDOMNode> eventNode;
GetDOMNode(getter_AddRefs(eventNode));
@ -126,7 +125,7 @@ void nsAccEvent::CaptureIsFromUserInput(PRBool aIsAsynch)
return;
}
if (!aIsAsynch) {
if (!mIsAsync) {
PrepareForEvent(eventNode);
mIsFromUserInput = gLastEventFromUserInput;
}

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

@ -105,11 +105,12 @@ public:
protected:
already_AddRefed<nsIAccessible> GetAccessibleByNode();
void CaptureIsFromUserInput(PRBool aIsAsynch);
void CaptureIsFromUserInput();
PRBool mIsFromUserInput;
PRUint32 mEventType;
EEventRule mEventRule;
PRPackedBool mIsAsync;
nsCOMPtr<nsIAccessible> mAccessible;
nsCOMPtr<nsIDOMNode> mDOMNode;
nsCOMPtr<nsIAccessibleDocument> mDocAccessible;
@ -128,6 +129,10 @@ public:
nsRefPtr<nsAccEvent> accEvent = GetAccEventPtr(aAccEvent);
return accEvent->mEventRule;
}
static PRBool IsAsyncEvent(nsIAccessibleEvent *aAccEvent) {
nsRefPtr<nsAccEvent> accEvent = GetAccEventPtr(aAccEvent);
return accEvent->mIsAsync;
}
static PRBool IsFromUserInput(nsIAccessibleEvent *aAccEvent) {
PRBool isFromUserInput;
aAccEvent->GetIsFromUserInput(&isFromUserInput);

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

@ -935,7 +935,8 @@ nsDocAccessible::FireDocLoadEvents(PRUint32 aEventType)
if (sameTypeRoot != treeItem) {
// Fire show/hide events to indicate frame/iframe content is new, rather than
// doc load event which causes screen readers to act is if entire page is reloaded
InvalidateCacheSubtree(nsnull, nsIAccessibleEvent::EVENT_DOM_SIGNIFICANT_CHANGE);
InvalidateCacheSubtree(nsnull,
nsIAccessibilityService::NODE_SIGNIFICANT_CHANGE);
}
// Fire STATE_CHANGE event for doc load finish if focus is in same doc tree
if (gLastFocusedNode) {
@ -1183,7 +1184,8 @@ nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID
// Not worth the expense to ensure which namespace these are in
// It doesn't kill use to recreate the accessible even if the attribute was used
// in the wrong namespace or an element that doesn't support it
InvalidateCacheSubtree(aContent, nsIAccessibleEvent::EVENT_DOM_SIGNIFICANT_CHANGE);
InvalidateCacheSubtree(aContent,
nsIAccessibilityService::NODE_SIGNIFICANT_CHANGE);
return;
}
@ -1356,7 +1358,8 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
// This affects whether the accessible supports nsIAccessibleSelectable.
// COM says we cannot change what interfaces are supported on-the-fly,
// so invalidate this object. A new one will be created on demand.
InvalidateCacheSubtree(aContent, nsIAccessibleEvent::EVENT_DOM_SIGNIFICANT_CHANGE);
InvalidateCacheSubtree(aContent,
nsIAccessibilityService::NODE_SIGNIFICANT_CHANGE);
return;
}
@ -1386,7 +1389,7 @@ void nsDocAccessible::ContentAppended(nsIDocument *aDocument,
// unless an accessible can be created for the passed in node, which it
// can't do unless the node is visible. The right thing happens there so
// no need for an extra visibility check here.
InvalidateCacheSubtree(child, nsIAccessibleEvent::EVENT_DOM_CREATE);
InvalidateCacheSubtree(child, nsIAccessibilityService::NODE_APPEND);
}
}
@ -1425,18 +1428,19 @@ nsDocAccessible::ContentInserted(nsIDocument *aDocument, nsIContent* aContainer,
// unless an accessible can be created for the passed in node, which it
// can't do unless the node is visible. The right thing happens there so
// no need for an extra visibility check here.
InvalidateCacheSubtree(aChild, nsIAccessibleEvent::EVENT_DOM_CREATE);
InvalidateCacheSubtree(aChild, nsIAccessibilityService::NODE_APPEND);
}
void
nsDocAccessible::ContentRemoved(nsIDocument *aDocument, nsIContent* aContainer,
nsIContent* aChild, PRInt32 aIndexInContainer)
{
// Invalidate the subtree of the removed element.
// InvalidateCacheSubtree(aChild, nsIAccessibleEvent::EVENT_DOM_DESTROY);
// This is no longer needed, we get our notifications directly from content
// *before* the frame for the content is destroyed, or any other side effects occur.
// That allows us to correctly calculate the TEXT_REMOVED event if there is one.
// It's no needed to invalidate the subtree of the removed element,
// because we get notifications directly from content (see
// nsGenericElement::doRemoveChildAt) *before* the frame for the content is
// destroyed, or any other side effects occur . That allows us to correctly
// calculate the TEXT_REMOVED event if there is one and coalesce events from
// the same subtree.
}
void
@ -1697,9 +1701,10 @@ nsDocAccessible::FlushPendingEvents()
PRUint32 eventType = nsAccEvent::EventType(accessibleEvent);
PRBool isFromUserInput = nsAccEvent::IsFromUserInput(accessibleEvent);
if (domNode == gLastFocusedNode &&
(eventType == nsIAccessibleEvent::EVENT_ASYNCH_HIDE ||
eventType == nsIAccessibleEvent::EVENT_ASYNCH_SHOW)) {
PRBool isAsync = nsAccEvent::IsAsyncEvent(accessibleEvent);
if (domNode == gLastFocusedNode && isAsync &&
(eventType == nsIAccessibleEvent::EVENT_SHOW ||
eventType == nsIAccessibleEvent::EVENT_HIDE)) {
// If frame type didn't change for this event, then we don't actually need to invalidate
// However, we only keep track of the old frame type for the focus, where it's very
// important not to destroy and recreate the accessible for minor style changes,
@ -1714,15 +1719,15 @@ nsDocAccessible::FlushPendingEvents()
if (newFrameType == gLastFocusedFrameType) {
// Don't need to invalidate this current accessible, but can
// just invalidate the children instead
FireShowHideEvents(domNode, PR_TRUE, eventType, PR_FALSE, isFromUserInput);
FireShowHideEvents(domNode, PR_TRUE, eventType, eNormalEvent,
isAsync, isFromUserInput);
continue;
}
gLastFocusedFrameType = newFrameType;
}
}
if (eventType == nsIAccessibleEvent::EVENT_DOM_CREATE ||
eventType == nsIAccessibleEvent::EVENT_ASYNCH_SHOW) {
if (eventType == nsIAccessibleEvent::EVENT_SHOW) {
nsCOMPtr<nsIAccessible> containerAccessible;
if (accessible)
@ -1735,7 +1740,7 @@ nsDocAccessible::FlushPendingEvents()
containerAccessible = this;
}
if (eventType == nsIAccessibleEvent::EVENT_ASYNCH_SHOW) {
if (isAsync) {
// For asynch show, delayed invalidatation of parent's children
nsRefPtr<nsAccessible> containerAcc =
nsAccUtils::QueryAccessible(containerAccessible);
@ -1766,7 +1771,8 @@ nsDocAccessible::FlushPendingEvents()
}
// Fire show/create events for this node or first accessible descendants of it
FireShowHideEvents(domNode, PR_FALSE, eventType, PR_FALSE, isFromUserInput);
FireShowHideEvents(domNode, PR_FALSE, eventType, eNormalEvent, isAsync,
isFromUserInput);
continue;
}
@ -1827,9 +1833,9 @@ nsDocAccessible::FlushPendingEvents()
nsAccEvent::PrepareForEvent(accessibleEvent);
FireAccessibleEvent(accessibleEvent);
// Post event processing
if (eventType == nsIAccessibleEvent::EVENT_ASYNCH_HIDE ||
eventType == nsIAccessibleEvent::EVENT_DOM_DESTROY) {
// Shutdown nsIAccessNode's or nsIAccessibles for any DOM nodes in this subtree
if (eventType == nsIAccessibleEvent::EVENT_HIDE) {
// Shutdown nsIAccessNode's or nsIAccessibles for any DOM nodes in
// this subtree.
nsCOMPtr<nsIDOMNode> hidingNode;
accessibleEvent->GetDOMNode(getter_AddRefs(hidingNode));
if (hidingNode) {
@ -1979,27 +1985,27 @@ void nsDocAccessible::RefreshNodes(nsIDOMNode *aStartNode)
void
nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
PRUint32 aChangeEventType)
PRUint32 aChangeType)
{
PRBool isHiding =
aChangeEventType == nsIAccessibleEvent::EVENT_ASYNCH_HIDE ||
aChangeEventType == nsIAccessibleEvent::EVENT_DOM_DESTROY;
PRBool isHiding =
aChangeType == nsIAccessibilityService::FRAME_HIDE ||
aChangeType == nsIAccessibilityService::NODE_REMOVE;
PRBool isShowing =
aChangeEventType == nsIAccessibleEvent::EVENT_ASYNCH_SHOW ||
aChangeEventType == nsIAccessibleEvent::EVENT_DOM_CREATE;
PRBool isShowing =
aChangeType == nsIAccessibilityService::FRAME_SHOW ||
aChangeType == nsIAccessibilityService::NODE_APPEND;
PRBool isChanging =
aChangeEventType == nsIAccessibleEvent::EVENT_DOM_SIGNIFICANT_CHANGE ||
aChangeEventType == nsIAccessibleEvent::EVENT_ASYNCH_SIGNIFICANT_CHANGE;
PRBool isChanging =
aChangeType == nsIAccessibilityService::NODE_SIGNIFICANT_CHANGE ||
aChangeType == nsIAccessibilityService::FRAME_SIGNIFICANT_CHANGE;
NS_ASSERTION(isChanging || isHiding || isShowing,
"Incorrect aChangeEventType passed in");
PRBool isAsynch =
aChangeEventType == nsIAccessibleEvent::EVENT_ASYNCH_HIDE ||
aChangeEventType == nsIAccessibleEvent::EVENT_ASYNCH_SHOW ||
aChangeEventType == nsIAccessibleEvent::EVENT_ASYNCH_SIGNIFICANT_CHANGE;
PRBool isAsynch =
aChangeType == nsIAccessibilityService::FRAME_HIDE ||
aChangeType == nsIAccessibilityService::FRAME_SHOW ||
aChangeType == nsIAccessibilityService::FRAME_SIGNIFICANT_CHANGE;
// Invalidate cache subtree
// We have to check for accessibles for each dom node by traversing DOM tree
@ -2059,24 +2065,18 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
nsAutoString localName;
childNode->GetLocalName(localName);
const char *hasAccessible = childAccessible ? " (acc)" : "";
if (aChangeEventType == nsIAccessibleEvent::EVENT_ASYNCH_HIDE) {
if (aChangeType == nsIAccessibilityService::FRAME_HIDE)
printf("[Hide %s %s]\n", NS_ConvertUTF16toUTF8(localName).get(), hasAccessible);
}
else if (aChangeEventType == nsIAccessibleEvent::EVENT_ASYNCH_SHOW) {
else if (aChangeType == nsIAccessibilityService::FRAME_SHOW)
printf("[Show %s %s]\n", NS_ConvertUTF16toUTF8(localName).get(), hasAccessible);
}
else if (aChangeEventType == nsIAccessibleEvent::EVENT_ASYNCH_SIGNIFICANT_CHANGE) {
else if (aChangeType == nsIAccessibilityService::FRAME_SIGNIFICANT_CHANGE)
printf("[Layout change %s %s]\n", NS_ConvertUTF16toUTF8(localName).get(), hasAccessible);
}
else if (aChangeEventType == nsIAccessibleEvent::EVENT_DOM_CREATE) {
else if (aChangeType == nsIAccessibleEvent::NODE_APPEND)
printf("[Create %s %s]\n", NS_ConvertUTF16toUTF8(localName).get(), hasAccessible);
}
else if (aChangeEventType == nsIAccessibleEvent::EVENT_DOM_DESTROY) {
else if (aChangeType == nsIAccessibilityService::NODE_REMOVE)
printf("[Destroy %s %s]\n", NS_ConvertUTF16toUTF8(localName).get(), hasAccessible);
}
else if (aChangeEventType == nsIAccessibleEvent::EVENT_DOM_SIGNIFICANT_CHANGE) {
else if (aChangeEventType == nsIAccessibilityService::NODE_SIGNIFICANT_CHANGE)
printf("[Type change %s %s]\n", NS_ConvertUTF16toUTF8(localName).get(), hasAccessible);
}
#endif
nsCOMPtr<nsIAccessible> containerAccessible;
@ -2086,7 +2086,7 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
}
if (!isShowing) {
// Fire EVENT_ASYNCH_HIDE or EVENT_DOM_DESTROY
// Fire EVENT_HIDE.
if (isHiding) {
nsCOMPtr<nsIContent> content(do_QueryInterface(childNode));
if (content) {
@ -2105,12 +2105,12 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
}
}
PRUint32 removalEventType = isAsynch ? nsIAccessibleEvent::EVENT_ASYNCH_HIDE :
nsIAccessibleEvent::EVENT_DOM_DESTROY;
// Fire an event if the accessible existed for node being hidden, otherwise
// for the first line accessible descendants. Fire before the accessible(s) away.
nsresult rv = FireShowHideEvents(childNode, PR_FALSE, removalEventType, PR_TRUE, PR_FALSE);
// for the first line accessible descendants. Fire before the accessible(s)
// away.
nsresult rv = FireShowHideEvents(childNode, PR_FALSE,
nsIAccessibleEvent::EVENT_HIDE,
eDelayedEvent, isAsynch, PR_FALSE);
NS_ENSURE_SUCCESS(rv,);
if (childNode != mDOMNode) { // Fire text change unless the node being removed is for this doc
@ -2145,14 +2145,15 @@ nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
containerAcc->InvalidateChildren();
}
// Fire EVENT_SHOW, EVENT_MENUPOPUP_START for newly visible content.
// Fire after a short timer, because we want to make sure the view has been
// updated to make this accessible content visible. If we don't wait,
// the assistive technology may receive the event and then retrieve
// nsIAccessibleStates::STATE_INVISIBLE for the event's accessible object.
PRUint32 additionEvent = isAsynch ? nsIAccessibleEvent::EVENT_ASYNCH_SHOW :
nsIAccessibleEvent::EVENT_DOM_CREATE;
FireDelayedAccessibleEvent(additionEvent, childNode,
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_SHOW, childNode,
nsAccEvent::eCoalesceFromSameSubtree,
isAsynch);
@ -2251,15 +2252,18 @@ nsDocAccessible::GetAccessibleInParentChain(nsIDOMNode *aNode,
}
nsresult
nsDocAccessible::FireShowHideEvents(nsIDOMNode *aDOMNode, PRBool aAvoidOnThisNode, PRUint32 aEventType,
PRBool aDelay, PRBool aForceIsFromUserInput)
nsDocAccessible::FireShowHideEvents(nsIDOMNode *aDOMNode,
PRBool aAvoidOnThisNode,
PRUint32 aEventType,
EEventFiringType aDelayedOrNormal,
PRBool aIsAsyncChange,
PRBool aForceIsFromUserInput)
{
NS_ENSURE_ARG(aDOMNode);
nsCOMPtr<nsIAccessible> accessible;
if (!aAvoidOnThisNode) {
if (aEventType == nsIAccessibleEvent::EVENT_ASYNCH_HIDE ||
aEventType == nsIAccessibleEvent::EVENT_DOM_DESTROY) {
if (aEventType == nsIAccessibleEvent::EVENT_HIDE) {
// Don't allow creation for accessibles when nodes going away
nsCOMPtr<nsIAccessNode> accessNode;
GetCachedAccessNode(aDOMNode, getter_AddRefs(accessNode));
@ -2272,21 +2276,20 @@ nsDocAccessible::FireShowHideEvents(nsIDOMNode *aDOMNode, PRBool aAvoidOnThisNod
}
if (accessible) {
// Found an accessible, so fire the show/hide on it and don't
// look further into this subtree
PRBool isAsynch = aEventType == nsIAccessibleEvent::EVENT_ASYNCH_HIDE ||
aEventType == nsIAccessibleEvent::EVENT_ASYNCH_SHOW;
// Found an accessible, so fire the show/hide on it and don't look further
// into this subtree.
nsCOMPtr<nsIAccessibleEvent> event =
new nsAccEvent(aEventType, accessible, isAsynch,
new nsAccEvent(aEventType, accessible, aIsAsyncChange,
nsAccEvent::eCoalesceFromSameSubtree);
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
if (aForceIsFromUserInput) {
nsAccEvent::PrepareForEvent(event, aForceIsFromUserInput);
}
if (aDelay) {
if (aDelayedOrNormal == eDelayedEvent)
return FireDelayedAccessibleEvent(event);
}
return FireAccessibleEvent(event);
}
@ -2297,7 +2300,8 @@ nsDocAccessible::FireShowHideEvents(nsIDOMNode *aDOMNode, PRBool aAvoidOnThisNod
for (PRUint32 index = 0; index < count; index++) {
nsCOMPtr<nsIDOMNode> childNode = do_QueryInterface(node->GetChildAt(index));
nsresult rv = FireShowHideEvents(childNode, PR_FALSE, aEventType,
aDelay, aForceIsFromUserInput);
aDelayedOrNormal, aIsAsyncChange,
aForceIsFromUserInput);
NS_ENSURE_SUCCESS(rv, rv);
}

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

@ -257,18 +257,31 @@ protected:
PRBool aIsInserting,
PRBool aIsAsynch);
/**
* Fire show/hide events for either the current node if it has an accessible,
* or the first-line accessible descendants of the given node.
*
* @param aDOMNode the given node
* @param aEventType event type to fire an event
* @param aAvoidOnThisNode Call with PR_TRUE the first time to prevent event firing on root node for change
* @param aDelay whether to fire the event on a delay
* @param aForceIsFromUserInput the event is known to be from user input
*/
nsresult FireShowHideEvents(nsIDOMNode *aDOMNode, PRBool aAvoidOnThisNode, PRUint32 aEventType,
PRBool aDelay, PRBool aForceIsFromUserInput);
/**
* Used to define should the event be fired on a delay.
*/
enum EEventFiringType {
eNormalEvent,
eDelayedEvent
};
/**
* Fire show/hide events for either the current node if it has an accessible,
* or the first-line accessible descendants of the given node.
*
* @param aDOMNode [in] the given node
* @param aAvoidOnThisNode [in] call with PR_TRUE the first time to
* prevent event firing on root node for change
* @param aEventType [in] event type to fire an event
* @param aDelayedOrNormal [in] whether to fire the event on a delay
* @param aIsAsyncChange [in] whether casual change is async
* @param aForceIsFromUserInput [in] the event is known to be from user input
*/
nsresult FireShowHideEvents(nsIDOMNode *aDOMNode, PRBool aAvoidOnThisNode,
PRUint32 aEventType,
EEventFiringType aDelayedOrNormal,
PRBool aIsAsyncChange,
PRBool aForceIsFromUserInput);
/**
* If the given accessible object is a ROLE_ENTRY, fire a value change event for it

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

@ -1093,7 +1093,7 @@ nsRootAccessible::HandlePopupShownEvent(nsIAccessible *aAccessible)
// The accessible for it stays the same no matter where it moves.
// AT's expect to get an EVENT_SHOW for the tooltip.
// In event callback the tooltip's accessible will be ready.
return nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_ASYNCH_SHOW,
return nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_SHOW,
aAccessible);
}

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

@ -1688,8 +1688,7 @@ nsAccessibleWrap::FirePlatformEvent(nsIAccessibleEvent *aEvent)
// See if we're in a scrollable area with its own window
nsCOMPtr<nsIAccessible> newAccessible;
if (eventType == nsIAccessibleEvent::EVENT_ASYNCH_HIDE ||
eventType == nsIAccessibleEvent::EVENT_DOM_DESTROY) {
if (eventType == nsIAccessibleEvent::EVENT_HIDE) {
// Don't use frame from current accessible when we're hiding that
// accessible.
accessible->GetParent(getter_AddRefs(newAccessible));

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

@ -49,12 +49,9 @@ const PRUint32 kEVENT_LAST_ENTRY = 0xffffffff;
static const PRUint32 gWinEventMap[] = {
kEVENT_WIN_UNKNOWN, // nsIAccessibleEvent doesn't have 0 constant
EVENT_OBJECT_SHOW, // nsIAccessibleEvent::EVENT_DOM_CREATE
EVENT_OBJECT_HIDE, // nsIAccessibleEvent::EVENT_DOM_DESTROY
kEVENT_WIN_UNKNOWN, // nsIAccessibleEvent::EVENT_DOM_SIGNIFICANT_CHANGE
EVENT_OBJECT_SHOW, // nsIAccessibleEvent::EVENT_ASYNCH_SHOW
EVENT_OBJECT_HIDE, // nsIAccessibleEvent::EVENT_ASYNCH_HIDE
kEVENT_WIN_UNKNOWN, // nsIAccessibleEvent::EVENT_ASYNCH_LAYOUT_CHANGE
EVENT_OBJECT_SHOW, // nsIAccessibleEvent::EVENT_SHOW
EVENT_OBJECT_HIDE, // nsIAccessibleEvent::EVENT_HIDE
EVENT_OBJECT_REORDER, // nsIAccessibleEvent::EVENT_REORDER
IA2_EVENT_ACTIVE_DECENDENT_CHANGED, // nsIAccessibleEvent::EVENT_ACTIVE_DECENDENT_CHANGED
EVENT_OBJECT_FOCUS, // nsIAccessibleEvent::EVENT_FOCUS
EVENT_OBJECT_STATECHANGE, // nsIAccessibleEvent::EVENT_STATE_CHANGE
@ -140,7 +137,6 @@ static const PRUint32 gWinEventMap[] = {
IA2_EVENT_OBJECT_ATTRIBUTE_CHANGED, // nsIAccessibleEvent::EVENT_OBJECT_ATTRIBUTE_CHANGED
IA2_EVENT_PAGE_CHANGED, // nsIAccessibleEvent::EVENT_PAGE_CHANGED
kEVENT_WIN_UNKNOWN, // nsIAccessibleEvent::EVENT_INTERNAL_LOAD
EVENT_OBJECT_REORDER, // nsIAccessibleEvent::EVENT_REORDER
kEVENT_LAST_ENTRY // nsIAccessibleEvent::EVENT_LAST_ENTRY
};

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

@ -592,8 +592,7 @@ nsXULTreeAccessible::InvalidateCache(PRInt32 aRow, PRInt32 aCount)
nsAccUtils::QueryAccessible(accessNode);
nsCOMPtr<nsIAccessibleEvent> event =
new nsAccEvent(nsIAccessibleEvent::EVENT_DOM_DESTROY,
accessible, PR_FALSE);
new nsAccEvent(nsIAccessibleEvent::EVENT_HIDE, accessible, PR_FALSE);
FireAccessibleEvent(event);
accessible->Shutdown();
@ -706,8 +705,7 @@ nsXULTreeAccessible::TreeViewChanged()
// AT because it should be expensive to fire destroy events for each tree item
// in cache.
nsCOMPtr<nsIAccessibleEvent> eventDestroy =
new nsAccEvent(nsIAccessibleEvent::EVENT_DOM_DESTROY,
this, PR_FALSE);
new nsAccEvent(nsIAccessibleEvent::EVENT_HIDE, this, PR_FALSE);
if (!eventDestroy)
return;
@ -718,8 +716,7 @@ nsXULTreeAccessible::TreeViewChanged()
mTree->GetView(getter_AddRefs(mTreeView));
nsCOMPtr<nsIAccessibleEvent> eventCreate =
new nsAccEvent(nsIAccessibleEvent::EVENT_DOM_CREATE,
this, PR_FALSE);
new nsAccEvent(nsIAccessibleEvent::EVENT_SHOW, this, PR_FALSE);
if (!eventCreate)
return;

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

@ -94,12 +94,12 @@ _TEST_FILES =\
test_elm_tree.xul \
test_elm_txtcntnr.html \
test_events_caretmove.html \
test_events_coalescence.html \
test_events_doc.html \
test_events_draganddrop.html \
test_events_flush.html \
test_events_focus.xul \
test_events_mutation.html \
test_events_mutation_coalesce.html \
test_events_tree.xul \
test_events_valuechange.html \
test_groupattrs.xul \

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

@ -1,12 +1,10 @@
////////////////////////////////////////////////////////////////////////////////
// Constants
const EVENT_ASYNCH_HIDE = nsIAccessibleEvent.EVENT_ASYNCH_HIDE;
const EVENT_ASYNCH_SHOW = nsIAccessibleEvent.EVENT_ASYNCH_SHOW;
const EVENT_HIDE = nsIAccessibleEvent.EVENT_HIDE;
const EVENT_SHOW = nsIAccessibleEvent.EVENT_SHOW;
const EVENT_DOCUMENT_LOAD_COMPLETE =
nsIAccessibleEvent.EVENT_DOCUMENT_LOAD_COMPLETE;
const EVENT_DOM_CREATE = nsIAccessibleEvent.EVENT_DOM_CREATE;
const EVENT_DOM_DESTROY = nsIAccessibleEvent.EVENT_DOM_DESTROY;
const EVENT_FOCUS = nsIAccessibleEvent.EVENT_FOCUS;
const EVENT_NAME_CHANGE = nsIAccessibleEvent.EVENT_NAME_CHANGE;
const EVENT_SCROLLING_START = nsIAccessibleEvent.EVENT_SCROLLING_START;

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

@ -156,6 +156,8 @@
*/
var gQueue = null;
// gA11yEventDumpID = "eventdump"; // debug stuff
function testCaretOffset(aAccOrElmOrID, aCaretOffset)
{
var acc = getAccessible(aAccOrElmOrID, [nsIAccessibleText]);
@ -220,5 +222,6 @@
<p id="p" contentEditable="true"><span>text</span><br/>text</p>
<div id="div" contentEditable="true"><p id="p1_in_div">text</p><p id="p2_in_div">text</p></div>
<div id="eventdump"></div>
</body>
</html>

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

@ -28,6 +28,8 @@
const kAddElm = 3;
const kShowElm = 4;
const kToDo = true;
/**
* Base class to test of mutation events coalescence.
*/
@ -64,8 +66,9 @@
if (!aIsChildsToDo)
return;
var eventType = eventTypeToString(this.getEventType(aChildAction));
todo(false,
"Unexpected event " + this.getEventType(aChildAction) +
"Unexpected event " + eventType +
" for child in the test '" + this.getID() + "'");
}
@ -100,14 +103,10 @@
this.getEventType = function coalescenceBase_getEventType(aAction)
{
switch (aAction) {
case kRemoveElm:
return EVENT_DOM_DESTROY;
case kHideElm:
return EVENT_ASYNCH_HIDE;
case kAddElm:
return EVENT_DOM_CREATE;
case kShowElm:
return EVENT_ASYNCH_SHOW;
case kRemoveElm: case kHideElm:
return EVENT_HIDE;
case kAddElm: case kShowElm:
return EVENT_SHOW;
}
}
@ -152,7 +151,7 @@
/**
* Remove or hide mutation events coalescence testing.
*/
function removeOrHidecoalescenceBase(aChildID, aParentID,
function removeOrHideCoalescenceBase(aChildID, aParentID,
aChildAction, aParentAction,
aPerformActionOnChildInTheFirstPlace,
aIsChildsToDo)
@ -161,7 +160,7 @@
aPerformActionOnChildInTheFirstPlace,
aIsChildsToDo);
this.init = function removeOrHidecoalescenceBase_init()
this.init = function removeOrHideCoalescenceBase_init()
{
this.childNode = getNode(aChildID);
this.parentNode = getNode(aParentID);
@ -185,9 +184,9 @@
*/
function removeChildNParent(aChildID, aParentID)
{
this.__proto__ = new removeOrHidecoalescenceBase(aChildID, aParentID,
this.__proto__ = new removeOrHideCoalescenceBase(aChildID, aParentID,
kRemoveElm, kRemoveElm,
true, true);
true, kToDo);
}
/**
@ -195,7 +194,7 @@
*/
function removeParentNChild(aChildID, aParentID)
{
this.__proto__ = new removeOrHidecoalescenceBase(aChildID, aParentID,
this.__proto__ = new removeOrHideCoalescenceBase(aChildID, aParentID,
kRemoveElm, kRemoveElm,
false);
}
@ -205,7 +204,7 @@
*/
function hideChildNParent(aChildID, aParentID)
{
this.__proto__ = new removeOrHidecoalescenceBase(aChildID, aParentID,
this.__proto__ = new removeOrHideCoalescenceBase(aChildID, aParentID,
kHideElm, kHideElm,
true);
}
@ -215,7 +214,7 @@
*/
function hideParentNChild(aChildID, aParentID)
{
this.__proto__ = new removeOrHidecoalescenceBase(aChildID, aParentID,
this.__proto__ = new removeOrHideCoalescenceBase(aChildID, aParentID,
kHideElm, kHideElm,
false);
}
@ -225,7 +224,7 @@
*/
function hideChildNRemoveParent(aChildID, aParentID)
{
this.__proto__ = new removeOrHidecoalescenceBase(aChildID, aParentID,
this.__proto__ = new removeOrHideCoalescenceBase(aChildID, aParentID,
kHideElm, kRemoveElm,
true);
}
@ -235,9 +234,13 @@
*/
function hideParentNRemoveChild(aChildID, aParentID)
{
this.__proto__ = new removeOrHidecoalescenceBase(aChildID, aParentID,
// Because of async layout changes we handle remove child node change
// before than hide parent node change even we hide parent before we
// remove a child. Therefore mark this as todo until we have more smart
// events coalescence.
this.__proto__ = new removeOrHideCoalescenceBase(aChildID, aParentID,
kRemoveElm, kHideElm,
false, true);
false, kToDo);
}
/**
@ -245,9 +248,9 @@
*/
function removeChildNHideParent(aChildID, aParentID)
{
this.__proto__ = new removeOrHidecoalescenceBase(aChildID, aParentID,
this.__proto__ = new removeOrHideCoalescenceBase(aChildID, aParentID,
kRemoveElm, kHideElm,
true, true);
true, kToDo);
}
/**
@ -255,7 +258,7 @@
*/
function removeParentNHideChild(aChildID, aParentID)
{
this.__proto__ = new removeOrHidecoalescenceBase(aChildID, aParentID,
this.__proto__ = new removeOrHideCoalescenceBase(aChildID, aParentID,
kHideElm, kRemoveElm,
false);
}
@ -304,7 +307,7 @@
* Create and append child node to the DOM and then show parent node.
*/
function showParentNAddChild(aParentID,
aPerformActionOnChildInTheFirstPlace)
aPerformActionOnChildInTheFirstPlace)
{
this.init = function showParentNAddChild_init()
{
@ -315,8 +318,7 @@
}
this.__proto__ = new coalescenceBase(kAddElm, kShowElm,
aPerformActionOnChildInTheFirstPlace,
true);
aPerformActionOnChildInTheFirstPlace);
this.init();
this.initSequence();

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

@ -42,11 +42,8 @@
* @param aNodeOrID [in] node invoker's action is executed for
* @param aEventTypes [in] events to register (see constants above)
* @param aDoNotExpectEvents [in] boolean indicates if events are expected
* @param aIsDOMChange [in] boolean indicates if these are DOM events
* layout events.
*/
function mutateA11yTree(aNodeOrID, aEventTypes,
aDoNotExpectEvents, aIsDOMChange)
function mutateA11yTree(aNodeOrID, aEventTypes, aDoNotExpectEvents)
{
// Interface
this.DOMNode = getNode(aNodeOrID);
@ -89,19 +86,11 @@
if (aEventType == kReorderEvent)
return nsIAccessibleEvent.EVENT_REORDER;
if (this.mIsDOMChange) {
if (aEventType == kHideEvent)
return nsIAccessibleEvent.EVENT_DOM_DESTROY;
if (aEventType == kHideEvent)
return nsIAccessibleEvent.EVENT_HIDE;
if (aEventType == kShowEvent)
return nsIAccessibleEvent.EVENT_DOM_CREATE;
} else {
if (aEventType == kHideEvent)
return nsIAccessibleEvent.EVENT_ASYNCH_HIDE;
if (aEventType == kShowEvent)
return nsIAccessibleEvent.EVENT_ASYNCH_SHOW;
}
if (aEventType == kShowEvent)
return nsIAccessibleEvent.EVENT_SHOW;
}
this.getEventSeq = function mutateA11yTree_getEventSeq()
@ -109,8 +98,6 @@
return this.doNotExpectEvents ? this.unexpectedEventSeq : this.eventSeq;
}
this.mIsDOMChange = aIsDOMChange;
if (aEventTypes & kHideEvent) {
var checker = new invokerChecker(this.getA11yEventType(kHideEvent),
this.DOMNode);
@ -135,7 +122,7 @@
*/
function changeStyle(aNodeOrID, aProp, aValue, aEventTypes)
{
this.__proto__ = new mutateA11yTree(aNodeOrID, aEventTypes, false, false);
this.__proto__ = new mutateA11yTree(aNodeOrID, aEventTypes, false);
this.invoke = function changeStyle_invoke()
{
@ -153,7 +140,7 @@
*/
function changeClass(aParentNodeOrID, aNodeOrID, aClassName, aEventTypes)
{
this.__proto__ = new mutateA11yTree(aNodeOrID, aEventTypes, false, false);
this.__proto__ = new mutateA11yTree(aNodeOrID, aEventTypes, false);
this.invoke = function changeClass_invoke()
{
@ -178,7 +165,7 @@
var doNotExpectEvents = (aEventTypes == kNoEvents);
this.__proto__ = new mutateA11yTree(aNodeOrID, eventTypes,
doNotExpectEvents, true);
doNotExpectEvents);
this.invoke = function cloneAndAppendToDOM_invoke()
{
@ -213,7 +200,7 @@
var doNotExpectEvents = (aEventTypes == kNoEvents);
this.__proto__ = new mutateA11yTree(aNodeOrID, eventTypes,
doNotExpectEvents, true);
doNotExpectEvents);
this.invoke = function removeFromDOM_invoke()
{
@ -239,7 +226,7 @@
function cloneAndReplaceInDOM(aNodeOrID)
{
this.__proto__ = new mutateA11yTree(aNodeOrID, kHideAndShowEvents,
false, true);
false);
this.invoke = function cloneAndReplaceInDOM_invoke()
{
@ -292,7 +279,7 @@
* Do tests.
*/
var gQueue = null;
// var gA11yEventDumpID = "eventdump"; // debug stuff
// gA11yEventDumpID = "eventdump"; // debug stuff
function doTests()
{

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

@ -3346,7 +3346,7 @@ nsGenericElement::doRemoveChildAt(PRUint32 aIndex, PRBool aNotify,
do_GetService("@mozilla.org/accessibilityService;1");
if (accService) {
accService->InvalidateSubtreeFor(presShell, aKid,
nsIAccessibleEvent::EVENT_DOM_DESTROY);
nsIAccessibilityService::NODE_REMOVE);
}
}
}

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

@ -9106,14 +9106,14 @@ nsCSSFrameConstructor::RecreateFramesForContent(nsIContent* aContent,
#ifdef ACCESSIBILITY
if (mPresShell->IsAccessibilityActive()) {
PRUint32 event;
PRUint32 changeType;
if (frame) {
nsIFrame *newFrame = mPresShell->GetPrimaryFrameFor(aContent);
event = newFrame ? PRUint32(nsIAccessibleEvent::EVENT_ASYNCH_SIGNIFICANT_CHANGE) :
PRUint32(nsIAccessibleEvent::EVENT_ASYNCH_HIDE);
changeType = newFrame ? nsIAccessibilityService::FRAME_SIGNIFICANT_CHANGE :
nsIAccessibilityService::FRAME_HIDE;
}
else {
event = nsIAccessibleEvent::EVENT_ASYNCH_SHOW;
changeType = nsIAccessibilityService::FRAME_SHOW;
}
// A significant enough change occured that this part
@ -9121,7 +9121,7 @@ nsCSSFrameConstructor::RecreateFramesForContent(nsIContent* aContent,
nsCOMPtr<nsIAccessibilityService> accService =
do_GetService("@mozilla.org/accessibilityService;1");
if (accService) {
accService->InvalidateSubtreeFor(mPresShell, aContent, event);
accService->InvalidateSubtreeFor(mPresShell, aContent, changeType);
}
}
#endif

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

@ -1425,11 +1425,12 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
nsCOMPtr<nsIAccessibilityService> accService =
do_GetService("@mozilla.org/accessibilityService;1");
if (accService) {
PRUint32 event = isVisible ?
nsIAccessibleEvent::EVENT_ASYNCH_HIDE :
nsIAccessibleEvent::EVENT_ASYNCH_SHOW;
PRUint32 changeType = isVisible ?
nsIAccessibilityService::FRAME_HIDE :
nsIAccessibilityService::FRAME_SHOW;
accService->InvalidateSubtreeFor(mPresShell, aFrame->GetContent(),
event);
changeType);
fireAccessibilityEvents = PR_FALSE;
}
}

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

@ -3517,7 +3517,7 @@ void nsIPresShell::InvalidateAccessibleSubtree(nsIContent *aContent)
do_GetService("@mozilla.org/accessibilityService;1");
if (accService) {
accService->InvalidateSubtreeFor(this, aContent,
nsIAccessibleEvent::EVENT_ASYNCH_SIGNIFICANT_CHANGE);
nsIAccessibilityService::FRAME_SIGNIFICANT_CHANGE);
}
}
}