Checking bug 255088 again, but this time without leak. Original patch was r=surkov

This commit is contained in:
aaronleventhal@moonset.net 2007-04-19 10:49:13 -07:00
Родитель ee1dcb2650
Коммит aa23104e9c
1 изменённых файлов: 25 добавлений и 16 удалений

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

@ -909,17 +909,36 @@ nsDocAccessible::AttributeChanged(nsIDocument *aDocument, nsIContent* aContent,
return; // Document has been shut down return; // Document has been shut down
} }
if (aNameSpaceID == kNameSpaceID_WAIProperties) {
ARIAAttributeChanged(aContent, aAttribute);
return;
}
nsCOMPtr<nsIDOMNode> targetNode(do_QueryInterface(aContent)); nsCOMPtr<nsIDOMNode> targetNode(do_QueryInterface(aContent));
NS_ASSERTION(targetNode, "No node for attr modified"); NS_ASSERTION(targetNode, "No node for attr modified");
if (!targetNode) { if (!targetNode) {
return; return;
} }
// Universal boolean properties that don't require a role.
if (aAttribute == nsAccessibilityAtoms::disabled) {
// Fire the state change whether disabled attribute is
// set for XUL, HTML or ARIA namespace.
// Checking the namespace would not seem to gain us anything, because
// disabled really is going to mean the same thing in any namespace.
nsCOMPtr<nsIAccessibleStateChangeEvent> enabledChangeEvent =
new nsAccStateChangeEvent(targetNode,
nsIAccessibleStates::EXT_STATE_ENABLED,
PR_TRUE);
FireDelayedAccessibleEvent(enabledChangeEvent);
nsCOMPtr<nsIAccessibleStateChangeEvent> sensitiveChangeEvent =
new nsAccStateChangeEvent(targetNode,
nsIAccessibleStates::EXT_STATE_SENSITIVE,
PR_TRUE);
FireDelayedAccessibleEvent(sensitiveChangeEvent);
return;
}
if (aNameSpaceID == kNameSpaceID_WAIProperties) {
ARIAAttributeChanged(aContent, aAttribute);
return;
}
if (aNameSpaceID == kNameSpaceID_XHTML2_Unofficial || if (aNameSpaceID == kNameSpaceID_XHTML2_Unofficial ||
aNameSpaceID == kNameSpaceID_XHTML) { aNameSpaceID == kNameSpaceID_XHTML) {
if (aAttribute == nsAccessibilityAtoms::role) if (aAttribute == nsAccessibilityAtoms::role)
@ -978,16 +997,6 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
if (!targetNode) if (!targetNode)
return; return;
// Universal boolean properties that don't require a role.
if (aAttribute == nsAccessibilityAtoms::disabled) {
nsCOMPtr<nsIAccessibleStateChangeEvent> event =
new nsAccStateChangeEvent(targetNode,
nsIAccessibleStates::EXT_STATE_ENABLED,
PR_TRUE);
FireDelayedAccessibleEvent(event);
return;
}
if (aAttribute == nsAccessibilityAtoms::required) { if (aAttribute == nsAccessibilityAtoms::required) {
nsCOMPtr<nsIAccessibleStateChangeEvent> event = nsCOMPtr<nsIAccessibleStateChangeEvent> event =
new nsAccStateChangeEvent(targetNode, new nsAccStateChangeEvent(targetNode,
@ -1010,7 +1019,7 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
// The activedescendant universal property redirects accessible focus events // The activedescendant universal property redirects accessible focus events
// to the element with the id that activedescendant points to // to the element with the id that activedescendant points to
nsCOMPtr<nsIDOMNode> currentFocus = GetCurrentFocus(); nsCOMPtr<nsIDOMNode> currentFocus = GetCurrentFocus();
if (SameCOMIdentity(currentFocus, aContent)) { if (currentFocus == targetNode) {
nsRefPtr<nsRootAccessible> rootAcc = GetRootAccessible(); nsRefPtr<nsRootAccessible> rootAcc = GetRootAccessible();
if (rootAcc) if (rootAcc)
rootAcc->FireAccessibleFocusEvent(nsnull, currentFocus, nsnull, PR_TRUE); rootAcc->FireAccessibleFocusEvent(nsnull, currentFocus, nsnull, PR_TRUE);