зеркало из https://github.com/mozilla/pjs.git
Bug 548291 - Support ARIA on area (map) elements; r=marcoz,surkov
This commit is contained in:
Родитель
b962e844a9
Коммит
2d994fe819
|
@ -138,6 +138,18 @@ nsHTMLAreaAccessible::GetBounds(PRInt32 *x, PRInt32 *y,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessible public implementation
|
||||
|
||||
nsresult
|
||||
nsHTMLAreaAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
|
||||
{
|
||||
// Bypass the link states specialization for non links.
|
||||
if (mRoleMapEntry && mRoleMapEntry->role != nsIAccessibleRole::ROLE_NOTHING
|
||||
&& mRoleMapEntry->role != nsIAccessibleRole::ROLE_LINK) {
|
||||
return nsAccessible::GetStateInternal(aState,aExtraState);
|
||||
}
|
||||
|
||||
return nsHTMLLinkAccessible::GetStateInternal(aState,aExtraState);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLAreaAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
PRBool aDeepestChild,
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
|
||||
// nsAccessible
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
|
||||
virtual nsresult GetChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
PRBool aDeepestChild,
|
||||
nsIAccessible **aChild);
|
||||
|
|
|
@ -165,17 +165,15 @@ nsHTMLImageAccessible::CacheChildren()
|
|||
PRUint32 areaCount = 0;
|
||||
mapAreas->GetLength(&areaCount);
|
||||
|
||||
nsCOMPtr<nsIAccessible> areaAccessible;
|
||||
nsRefPtr<nsAccessible> areaAcc;
|
||||
nsRefPtr<nsAccessible> areaAccessible;
|
||||
|
||||
for (PRUint32 areaIdx = 0; areaIdx < areaCount; areaIdx++) {
|
||||
areaAccessible = GetAreaAccessible(mapAreas, areaIdx);
|
||||
if (!areaAccessible)
|
||||
return;
|
||||
|
||||
areaAcc = nsAccUtils::QueryObject<nsAccessible>(areaAccessible);
|
||||
mChildren.AppendElement(areaAcc);
|
||||
areaAcc->SetParent(this);
|
||||
mChildren.AppendElement(areaAccessible);
|
||||
areaAccessible->SetParent(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -288,8 +286,7 @@ nsHTMLImageAccessible::GetAnchor(PRInt32 aIndex, nsIAccessible **aAccessible)
|
|||
|
||||
nsCOMPtr<nsIDOMHTMLCollection> mapAreas = GetAreaCollection();
|
||||
if (mapAreas) {
|
||||
nsCOMPtr<nsIAccessible> accessible;
|
||||
accessible = GetAreaAccessible(mapAreas, aIndex);
|
||||
nsRefPtr<nsAccessible> accessible = GetAreaAccessible(mapAreas, aIndex);
|
||||
if (!accessible)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
|
@ -374,7 +371,7 @@ nsHTMLImageAccessible::GetAreaCollection()
|
|||
return mapAreas;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIAccessible>
|
||||
already_AddRefed<nsAccessible>
|
||||
nsHTMLImageAccessible::GetAreaAccessible(nsIDOMHTMLCollection *aAreaCollection,
|
||||
PRInt32 aAreaNum)
|
||||
{
|
||||
|
@ -387,21 +384,28 @@ nsHTMLImageAccessible::GetAreaAccessible(nsIDOMHTMLCollection *aAreaCollection,
|
|||
return nsnull;
|
||||
|
||||
void* key = reinterpret_cast<void*>(aAreaNum);
|
||||
nsRefPtr<nsAccessNode> accessNode = mAccessNodeCache->GetWeak(key);
|
||||
nsRefPtr<nsAccessible> accessible =
|
||||
nsAccUtils::QueryObject<nsAccessible>(mAccessNodeCache->GetWeak(key));
|
||||
|
||||
if (!accessNode) {
|
||||
accessNode = new nsHTMLAreaAccessible(domNode, this, mWeakShell);
|
||||
if (!accessNode)
|
||||
if (!accessible) {
|
||||
accessible = new nsHTMLAreaAccessible(domNode, this, mWeakShell);
|
||||
if (!accessible)
|
||||
return nsnull;
|
||||
|
||||
nsresult rv = accessNode->Init();
|
||||
if (NS_FAILED(rv))
|
||||
nsresult rv = accessible->Init();
|
||||
if (NS_FAILED(rv)) {
|
||||
accessible->Shutdown();
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
mAccessNodeCache->Put(key, accessNode);
|
||||
// We should respect ARIA on area elements (for the canvas map technique)
|
||||
accessible->SetRoleMapEntry(nsAccUtils::GetRoleMapEntry(domNode));
|
||||
|
||||
if (!mAccessNodeCache->Put(key, accessible)) {
|
||||
return nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAccessible> accessible = do_QueryInterface(accessNode);
|
||||
return accessible.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,11 @@ protected:
|
|||
|
||||
// nsHTMLImageAccessible
|
||||
already_AddRefed<nsIDOMHTMLCollection> GetAreaCollection();
|
||||
already_AddRefed<nsIAccessible>
|
||||
|
||||
/*
|
||||
* Return the accessible for the area element.
|
||||
*/
|
||||
already_AddRefed<nsAccessible>
|
||||
GetAreaAccessible(nsIDOMHTMLCollection* aAreaNodes, PRInt32 aAreaNum);
|
||||
|
||||
// Reference on linked map element if any.
|
||||
|
|
|
@ -48,6 +48,7 @@ include $(DEPTH)/config/autoconf.mk
|
|||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TEST_FILES =\
|
||||
formimage.png \
|
||||
letters.gif \
|
||||
moz.png \
|
||||
$(topsrcdir)/content/media/test/bug461281.ogg \
|
||||
|
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 20 KiB |
|
@ -47,6 +47,7 @@ include $(topsrcdir)/config/rules.mk
|
|||
|
||||
_TEST_FILES =\
|
||||
test_aria.html \
|
||||
test_aria_imagemap.html \
|
||||
test_doc.html \
|
||||
test_docarticle.html \
|
||||
test_editablebody.html \
|
||||
|
|
|
@ -46,6 +46,7 @@ include $(DEPTH)/config/autoconf.mk
|
|||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TEST_FILES =\
|
||||
test_aria_imagemap.html \
|
||||
test_button.xul \
|
||||
test_colorpicker.xul \
|
||||
test_combobox.xul \
|
||||
|
|
Загрузка…
Ссылка в новой задаче