зеркало из https://github.com/mozilla/gecko-dev.git
bug 431615 - HTML 4.01 MAP element prevents links from displaying using a screen reader, patch by Alexander Surkov <surkov.alexander@gmail.com>, r=me, r=aaronlev, sr=jst
This commit is contained in:
Родитель
a6a9ad8eae
Коммит
86ba7aa703
|
@ -1328,15 +1328,6 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
|||
}
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
|
||||
if (content && content->Tag() == nsAccessibilityAtoms::map) {
|
||||
// Don't walk into maps, they take up no space.
|
||||
// The nsHTMLAreaAccessible's they contain are attached as
|
||||
// children of the appropriate nsHTMLImageAccessible.
|
||||
*aIsHidden = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Check to see if we already have an accessible for this
|
||||
// node in the cache
|
||||
nsCOMPtr<nsIAccessNode> accessNode;
|
||||
|
@ -1351,6 +1342,8 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
|
||||
|
||||
// No cache entry, so we must create the accessible
|
||||
// Check to see if hidden first
|
||||
nsCOMPtr<nsIDocument> nodeIsDoc;
|
||||
|
@ -1461,6 +1454,27 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
|||
return InitAccessible(newAcc, aAccessible, nsnull);
|
||||
}
|
||||
|
||||
PRBool isHTML = content->IsNodeOfType(nsINode::eHTML);
|
||||
if (isHTML && content->Tag() == nsAccessibilityAtoms::map) {
|
||||
// Create hyper text accessible for HTML map if it is used to group links
|
||||
// (see http://www.w3.org/TR/WCAG10-HTML-TECHS/#group-bypass). If the HTML
|
||||
// map doesn't have 'name' attribute (or has empty name attribute) then we
|
||||
// suppose it is used for links grouping. Otherwise we think it is used in
|
||||
// conjuction with HTML image element and in this case we don't create any
|
||||
// accessible for it and don't walk into it. The accessibles for HTML area
|
||||
// (nsHTMLAreaAccessible) the map contains are attached as children of the
|
||||
// appropriate accessible for HTML image (nsHTMLImageAccessible).
|
||||
nsAutoString name;
|
||||
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::name, name);
|
||||
if (!name.IsEmpty()) {
|
||||
*aIsHidden = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv = CreateHyperTextAccessible(frame, getter_AddRefs(newAcc));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
nsRoleMapEntry *roleMapEntry = nsAccUtils::GetRoleMapEntry(aNode);
|
||||
if (roleMapEntry && !nsCRT::strcmp(roleMapEntry->roleString, "presentation") &&
|
||||
!content->IsFocusable()) { // For presentation only
|
||||
|
@ -1474,8 +1488,7 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
|||
// say what kind of accessible to create.
|
||||
nsresult rv = GetAccessibleByType(aNode, getter_AddRefs(newAcc));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRBool isHTML = content->IsNodeOfType(nsINode::eHTML);
|
||||
|
||||
if (!newAcc && !isHTML) {
|
||||
if (content->GetNameSpaceID() == kNameSpaceID_SVG &&
|
||||
content->Tag() == nsAccessibilityAtoms::svg) {
|
||||
|
|
|
@ -255,6 +255,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
|
|||
(state_selectable),
|
||||
(ext_state_horizontal), (state_focusable | state_linked));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Maps to group links (bug 431615).
|
||||
var linksMapElement = document.getElementById("linksmap");
|
||||
var linksMapAcc;
|
||||
try {
|
||||
linksMapAcc = accService.getAccessibleFor(linksMapElement);
|
||||
} catch(e) { }
|
||||
|
||||
ok(linksMapAcc, "no accessible for map grouping links!");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
@ -299,5 +308,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
|
|||
<a id="LinkWithSpan" href="http://www.heise.de/"><span lang="de">Heise Online</span></a>
|
||||
<br>Named anchor, must not have "linked" state for it to be exposed correctly:<br>
|
||||
<a id="namedAnchor" name="named_anchor">This should never be of state_linked</a>
|
||||
|
||||
<br>Map that is used to group links (www.w3.org/TR/WCAG10-HTML-TECHS/#group-bypass),
|
||||
also see the bug 431615:<br>
|
||||
<map id="linksmap" title="Site navigation">
|
||||
<ul>
|
||||
<li><a href="http://mozilla.org">About the project</a></li>
|
||||
<li><a href="http://mozilla.org">Sites and sounds</a></li>
|
||||
</ul>
|
||||
</map>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
Загрузка…
Ссылка в новой задаче