Bug 334386. Repeating DHTML accessibility alerts not being spoken. r=ginn.chen, sr=bz

This commit is contained in:
aaronleventhal%moonset.net 2006-04-21 17:39:32 +00:00
parent 034ef90a2a
commit 733ab9365f
2 changed files with 22 additions and 16 deletions

View File

@ -1144,25 +1144,31 @@ NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
}
if (aChangeEventType == nsIAccessibleEvent::EVENT_SHOW && aChild) {
// Fire EVENT_SHOW, EVENT_MENUPOPUPSTART or EVENT_ALERT event for
// newly visible content.
nsAutoString role;
aChild->GetAttr(kNameSpaceID_XHTML2_Unofficial, nsAccessibilityAtoms::role, role);
PRUint32 event = 0;
if (StringEndsWith(role, NS_LITERAL_STRING(":alert"), nsCaseInsensitiveStringComparator())) {
event = nsIAccessibleEvent::EVENT_ALERT;
}
else if (StringEndsWith(role, NS_LITERAL_STRING(":menu"), nsCaseInsensitiveStringComparator())) {
event = nsIAccessibleEvent::EVENT_MENUPOPUPSTART;
}
// Fire EVENT_SHOW, EVENT_MENUPOPUPSTART 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
// STATE_INVISIBLE for the event's accessible object.
FireDelayedToolkitEvent(nsIAccessibleEvent::EVENT_SHOW, childNode, nsnull);
if (event) {
FireDelayedToolkitEvent(event, childNode, nsnull);
nsAutoString role;
aChild->GetAttr(kNameSpaceID_XHTML2_Unofficial, nsAccessibilityAtoms::role, role);
if (StringEndsWith(role, NS_LITERAL_STRING(":menu"), nsCaseInsensitiveStringComparator())) {
FireDelayedToolkitEvent(nsIAccessibleEvent::EVENT_MENUPOPUPSTART, childNode, nsnull);
}
}
// Check to see if change occured inside an alert, and fire an EVENT_ALERT if it did
if (aChangeEventType != nsIAccessibleEvent::EVENT_HIDE) {
nsIContent *ancestor = aChild;
nsAutoString role;
while (ancestor) {
ancestor->GetAttr(kNameSpaceID_XHTML2_Unofficial, nsAccessibilityAtoms::role, role);
if (StringEndsWith(role, NS_LITERAL_STRING(":alert"), nsCaseInsensitiveStringComparator())) {
nsCOMPtr<nsIDOMNode> alertNode(do_QueryInterface(ancestor));
FireDelayedToolkitEvent(nsIAccessibleEvent::EVENT_ALERT, alertNode, nsnull);
break;
}
ancestor = ancestor->GetParent();
}
}

View File

@ -770,7 +770,7 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
}
}
else if (eventType.LowerCaseEqualsLiteral("focus") ||
eventType.LowerCaseEqualsLiteral("dommenuitemactive")) {
eventType.LowerCaseEqualsLiteral("dommenuitemactive")) {
if (treeItemAccessible) { // use focused treeitem
privAcc = do_QueryInterface(treeItemAccessible);
privAcc->FireToolkitEvent(nsIAccessibleEvent::EVENT_FOCUS,
@ -779,7 +779,7 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
else if (anchorElement) {
nsCOMPtr<nsIAccessibleHyperText> hyperText(do_QueryInterface(accessible));
if (hyperText) {
nsCOMPtr<nsIDOMNode> focusedNode(do_QueryInterface(anchorElement));
nsCOMPtr<nsIDOMNode> focusedNode(do_QueryInterface(anchorElement));
NS_IF_RELEASE(gLastFocusedNode);
gLastFocusedNode = focusedNode;
NS_IF_ADDREF(gLastFocusedNode);