diff --git a/accessible/src/base/nsDocAccessible.cpp b/accessible/src/base/nsDocAccessible.cpp index 2f0102d7c3d..23020b72a93 100644 --- a/accessible/src/base/nsDocAccessible.cpp +++ b/accessible/src/base/nsDocAccessible.cpp @@ -1383,9 +1383,6 @@ nsDocAccessible::UnbindFromDocument(nsAccessible* aAccessible) mNodeToAccessibleMap.Get(aAccessible->GetNode()) == aAccessible) mNodeToAccessibleMap.Remove(aAccessible->GetNode()); - if (!aAccessible->IsDefunct()) - RemoveDependentIDsFor(aAccessible); - void* uniqueID = aAccessible->UniqueID(); NS_ASSERTION(!aAccessible->IsDefunct(), "Shutdown the shutdown accessible!"); @@ -1939,6 +1936,9 @@ nsDocAccessible::CacheChildrenInSubtree(nsAccessible* aRoot) void nsDocAccessible::UncacheChildrenInSubtree(nsAccessible* aRoot) { + if (aRoot->IsElement()) + RemoveDependentIDsFor(aRoot); + PRUint32 count = aRoot->GetCachedChildCount(); for (PRUint32 idx = 0; idx < count; idx++) UncacheChildrenInSubtree(aRoot->GetCachedChildAt(idx)); diff --git a/accessible/tests/mochitest/relations/test_update.html b/accessible/tests/mochitest/relations/test_update.html index 99dcd6055b6..5934e8e667e 100644 --- a/accessible/tests/mochitest/relations/test_update.html +++ b/accessible/tests/mochitest/relations/test_update.html @@ -88,6 +88,44 @@ } } + /** + * Relative accessible recreation shouldn't break accessible relations. + * Note: modify this case if the invoke function doesn't change accessible + * tree due to changes in layout module. It can be changed on any case + * when accessibles are recreated. + */ + function recreateRelatives(aContainerID, aLabelID, aElmID) + { + this.containerNode = getNode(aContainerID); + this.container = getNode(this.containerNode); + + this.eventSeq = [ + new invokerChecker(EVENT_HIDE, this.container), + new invokerChecker(EVENT_SHOW, this.containerNode) + ]; + + this.invoke = function recreateRelatives_invoke() + { + testRelation(aLabelID, RELATION_LABEL_FOR, aElmID); + testRelation(aElmID, RELATION_LABELLED_BY, aLabelID); + + this.containerNode.style.overflow = "visible"; + } + + this.finalCheck = function recreateRelatives_finalCheck() + { + testRelation(aLabelID, RELATION_LABEL_FOR, aElmID); + testRelation(aElmID, RELATION_LABELLED_BY, aLabelID); + } + + this.getID = function recreateRelatives_getID() + { + return "recreate relatives "; + } + } + + //gA11yEventDumpToConsole = true; // debug + var gQueue = null; function doTest() @@ -132,6 +170,9 @@ gQueue.push(new insertRelated("aria-flowto", "dependent12", false, RELATION_FLOWS_TO, RELATION_FLOWS_FROM)); + // Update relations when accessibles are recreated + gQueue.push(new recreateRelatives("container", "label", "input")); + gQueue.invoke(); // will call SimpleTest.finish() } @@ -149,6 +190,12 @@ title="Cache relations defined by ARIA attributes"> Mozilla Bug 573469 + + Mozilla Bug 631068 + +

@@ -158,5 +205,9 @@
   
label2
+
+ + +