Bug 805373 - don't expose explicit-name on unintentional empty name accessible, r=tbsaunde

This commit is contained in:
Alexander Surkov 2012-10-26 21:38:29 +09:00
parent fcf3dd7c7c
commit 001efa50a8
5 changed files with 8 additions and 14 deletions

View File

@ -32,7 +32,7 @@ nsTextEquivUtils::GetNameFromSubtree(Accessible* aAccessible,
return NS_OK;
gInitiatorAcc = aAccessible;
if (IsNameFromSubtreeAllowed(aAccessible)) {
if (GetRoleRule(aAccessible->Role()) == eFromSubtree) {
//XXX: is it necessary to care the accessible is not a document?
if (aAccessible->IsContent()) {
nsAutoString name;

View File

@ -89,14 +89,6 @@ public:
static nsresult AppendTextEquivFromTextContent(nsIContent *aContent,
nsAString *aString);
/**
* Return true if the given accessible allows name from subtree.
*/
static bool IsNameFromSubtreeAllowed(Accessible* aAccessible)
{
return GetRoleRule(aAccessible->Role()) == eFromSubtree;
}
private:
/**
* Iterates accessible children and calculates text equivalent from each

View File

@ -1254,8 +1254,8 @@ Accessible::NativeAttributes()
}
// Expose 'explicit-name' attribute.
if (!nsTextEquivUtils::IsNameFromSubtreeAllowed(this) ||
Name(unused) != eNameFromSubtree) {
nsAutoString name;
if (Name(name) != eNameFromSubtree && !name.IsVoid()) {
attributes->SetStringProperty(NS_LITERAL_CSTRING("explicit-name"),
NS_LITERAL_STRING("true"), unused);
}

View File

@ -58,6 +58,10 @@ var gTestIterator =
this.ruleIdx++;
if (this.ruleIdx == this.ruleElms.length) {
// When test is finished then name is empty and no explict-name.
testName(this.elm, null, "No name test. ");
testAbsentAttrs(this.elm, {"explicit-name" : "true"});
this.markupIdx++;
if (this.markupIdx == this.markupElms.length) {
SimpleTest.finish();

View File

@ -202,7 +202,6 @@
</html:select>
</markup>
<!-- Temporarily disabled for causing bug 733848
<markup ref="html:img" ruleset="htmlimage">
<html:span id="l1" a11yname="test2">test2</html:span>
<html:span id="l2" a11yname="test3">test3</html:span>
@ -224,7 +223,6 @@
alt=""
src="../moz.png"/>
</markup>
-->
<markup ref="html:table/html:tr/html:td" ruleset="htmlelm"
id="markup4test">
@ -290,6 +288,6 @@
</html:tr>
</html:table>
</markup>
</rulesample>
</rulesample>
</rules>