Bug 736944 - make nsDocAccessible::RecreateAccessible fall into usual ContentInserted/ContentRemoved procedure, r=tbsaunde

This commit is contained in:
Alexander Surkov 2012-03-23 10:49:55 +09:00
Родитель 7b2d3bb4a1
Коммит c753d7f448
5 изменённых файлов: 49 добавлений и 29 удалений

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

@ -162,12 +162,6 @@ public:
*/
virtual void PresShellDestroyed(nsIPresShell *aPresShell) = 0;
/**
* Recreate an accessible for the given content node in the presshell.
*/
virtual void RecreateAccessible(nsIPresShell* aPresShell,
nsIContent* aContent) = 0;
/**
* Fire accessible event of the given type for the given target.
*

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

@ -676,10 +676,8 @@ nsAccessibilityService::RecreateAccessible(nsIPresShell* aPresShell,
nsIContent* aContent)
{
nsDocAccessible* document = GetDocAccessible(aPresShell->GetDocument());
if (document) {
document->HandleNotification<nsDocAccessible, nsIContent>
(document, &nsDocAccessible::RecreateAccessible, aContent);
}
if (document)
document->RecreateAccessible(aContent);
}
////////////////////////////////////////////////////////////////////////////////

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

@ -173,8 +173,10 @@ public:
*/
virtual void PresShellActivated(nsIPresShell* aPresShell);
virtual void RecreateAccessible(nsIPresShell* aPresShell,
nsIContent* aContent);
/**
* Recreate an accessible for the given content node in the presshell.
*/
void RecreateAccessible(nsIPresShell* aPresShell, nsIContent* aContent);
virtual void FireAccessibleEvent(PRUint32 aEvent, nsAccessible* aTarget);

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

@ -1467,14 +1467,8 @@ nsDocAccessible::RecreateAccessible(nsIContent* aContent)
// coalescence with normal hide and show events. Note, in this case they
// should be coalesced with normal show/hide events.
// Check if the node is in accessible document.
nsAccessible* container = GetContainerAccessible(aContent);
if (container) {
// Remove and reinsert.
UpdateTree(container, aContent, false);
container->UpdateChildren();
UpdateTree(container, aContent, true);
}
ContentRemoved(aContent->GetParent(), aContent);
ContentInserted(aContent->GetParent(), aContent, aContent->GetNextSibling());
}
void
@ -1717,8 +1711,7 @@ nsDocAccessible::UpdateAccessibleOnAttrChange(dom::Element* aElement,
// Recreate the accessible when role is changed because we might require a
// different accessible class for the new role or the accessible may expose
// a different sets of interfaces (COM restriction).
HandleNotification<nsDocAccessible, nsIContent>
(this, &nsDocAccessible::RecreateAccessible, aElement);
RecreateAccessible(aElement);
return true;
}
@ -1729,11 +1722,9 @@ nsDocAccessible::UpdateAccessibleOnAttrChange(dom::Element* aElement,
// kill use to recreate the accessible even if the attribute was used in
// the wrong namespace or an element that doesn't support it.
// Recreate accessible asynchronously to allow the content to handle
// the attribute change.
mNotificationController->ScheduleNotification<nsDocAccessible, nsIContent>
(this, &nsDocAccessible::RecreateAccessible, aElement);
// Make sure the accessible is recreated asynchronously to allow the content
// to handle the attribute change.
RecreateAccessible(aElement);
return true;
}
@ -1742,8 +1733,7 @@ nsDocAccessible::UpdateAccessibleOnAttrChange(dom::Element* aElement,
// This affects whether the accessible supports SelectAccessible.
// COM says we cannot change what interfaces are supported on-the-fly,
// so invalidate this object. A new one will be created on demand.
HandleNotification<nsDocAccessible, nsIContent>
(this, &nsDocAccessible::RecreateAccessible, aElement);
RecreateAccessible(aElement);
return true;
}

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

@ -345,6 +345,41 @@
}
}
function hideImageMap(aContainerID, aImageID)
{
this.container = getAccessible(aContainerID);
this.imageMap = null;
this.imageMapNode = getNode(aImageID);
function getImageMap(aThisObj)
{
return aThisObj.imageMap;
}
this.eventSeq = [
new invokerChecker(EVENT_HIDE, getImageMap, this),
new invokerChecker(EVENT_REORDER, aContainerID)
];
this.invoke = function hideImageMap_invoke()
{
this.imageMap = getAccessible(this.imageMapNode);
this.imageMapNode.style.display = "none";
}
this.finalCheck = function hideImageMap_finalCheck()
{
var accTree =
{ SECTION: [ ] };
testAccessibleTree(this.container, accTree);
}
this.getID = function hideImageMap_getID()
{
return "display:none image";
}
}
//gA11yEventDumpToConsole = true;
var gQueue = null;
@ -359,6 +394,7 @@
gQueue.push(new restoreNameOnMap("container", "imgmap", "map"));
gQueue.push(new removeMap("container", "imgmap", "map"));
gQueue.push(new insertMap("container", "imgmap"));
gQueue.push(new hideImageMap("container", "imgmap"));
gQueue.invoke(); // Will call SimpleTest.finish();
}