зеркало из https://github.com/mozilla/pjs.git
Bug 558036 - make HTML <output> accessible. r=MarcoZ,surkov a=davidb
This commit is contained in:
Родитель
caeb4fbd2d
Коммит
18eb4e1d3a
|
@ -138,6 +138,7 @@ ACCESSIBILITY_ATOM(object, "object")
|
||||||
ACCESSIBILITY_ATOM(ol, "ol")
|
ACCESSIBILITY_ATOM(ol, "ol")
|
||||||
ACCESSIBILITY_ATOM(optgroup, "optgroup")
|
ACCESSIBILITY_ATOM(optgroup, "optgroup")
|
||||||
ACCESSIBILITY_ATOM(option, "option")
|
ACCESSIBILITY_ATOM(option, "option")
|
||||||
|
ACCESSIBILITY_ATOM(output, "output")
|
||||||
ACCESSIBILITY_ATOM(panel, "panel") // XUL
|
ACCESSIBILITY_ATOM(panel, "panel") // XUL
|
||||||
ACCESSIBILITY_ATOM(q, "q")
|
ACCESSIBILITY_ATOM(q, "q")
|
||||||
ACCESSIBILITY_ATOM(select, "select")
|
ACCESSIBILITY_ATOM(select, "select")
|
||||||
|
|
|
@ -1648,6 +1648,12 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame,
|
||||||
return accessible;
|
return accessible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tag == nsAccessibilityAtoms::output) {
|
||||||
|
nsAccessible* accessible = new nsHTMLOutputAccessible(aContent, aWeakShell);
|
||||||
|
NS_IF_ADDREF(accessible);
|
||||||
|
return accessible;
|
||||||
|
}
|
||||||
|
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2158,9 +2158,18 @@ nsAccessible::GetRelationByType(PRUint32 aRelationType,
|
||||||
|
|
||||||
case nsIAccessibleRelation::RELATION_CONTROLLER_FOR:
|
case nsIAccessibleRelation::RELATION_CONTROLLER_FOR:
|
||||||
{
|
{
|
||||||
return nsRelUtils::
|
nsresult rv = nsRelUtils::
|
||||||
AddTargetFromIDRefsAttr(aRelationType, aRelation, mContent,
|
AddTargetFromIDRefsAttr(aRelationType, aRelation, mContent,
|
||||||
nsAccessibilityAtoms::aria_controls);
|
nsAccessibilityAtoms::aria_controls);
|
||||||
|
NS_ENSURE_SUCCESS(rv,rv);
|
||||||
|
|
||||||
|
if (rv != NS_OK_NO_RELATION_TARGET)
|
||||||
|
return NS_OK; // XXX bug 381599, avoid performance problems
|
||||||
|
|
||||||
|
return nsRelUtils::
|
||||||
|
AddTargetFromNeighbour(aRelationType, aRelation, mContent,
|
||||||
|
nsAccessibilityAtoms::_for,
|
||||||
|
nsAccessibilityAtoms::output);
|
||||||
}
|
}
|
||||||
|
|
||||||
case nsIAccessibleRelation::RELATION_FLOWS_TO:
|
case nsIAccessibleRelation::RELATION_FLOWS_TO:
|
||||||
|
|
|
@ -40,6 +40,8 @@
|
||||||
#include "nsHTMLTextAccessible.h"
|
#include "nsHTMLTextAccessible.h"
|
||||||
|
|
||||||
#include "nsDocAccessible.h"
|
#include "nsDocAccessible.h"
|
||||||
|
#include "nsAccUtils.h"
|
||||||
|
#include "nsRelUtils.h"
|
||||||
#include "nsTextEquivUtils.h"
|
#include "nsTextEquivUtils.h"
|
||||||
|
|
||||||
#include "nsIFrame.h"
|
#include "nsIFrame.h"
|
||||||
|
@ -195,6 +197,56 @@ nsHTMLLabelAccessible::NativeRole()
|
||||||
return nsIAccessibleRole::ROLE_LABEL;
|
return nsIAccessibleRole::ROLE_LABEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// nsHTMLOuputAccessible
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
nsHTMLOutputAccessible::
|
||||||
|
nsHTMLOutputAccessible(nsIContent* aContent, nsIWeakReference* aShell) :
|
||||||
|
nsHyperTextAccessibleWrap(aContent, aShell)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLOutputAccessible, nsHyperTextAccessible)
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsHTMLOutputAccessible::GetRelationByType(PRUint32 aRelationType,
|
||||||
|
nsIAccessibleRelation** aRelation)
|
||||||
|
{
|
||||||
|
nsresult rv = nsAccessibleWrap::GetRelationByType(aRelationType, aRelation);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
if (rv != NS_OK_NO_RELATION_TARGET)
|
||||||
|
return NS_OK; // XXX bug 381599, avoid performance problems
|
||||||
|
|
||||||
|
if (aRelationType == nsIAccessibleRelation::RELATION_CONTROLLED_BY) {
|
||||||
|
return nsRelUtils::
|
||||||
|
AddTargetFromIDRefsAttr(aRelationType, aRelation, mContent,
|
||||||
|
nsAccessibilityAtoms::_for);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
PRUint32
|
||||||
|
nsHTMLOutputAccessible::NativeRole()
|
||||||
|
{
|
||||||
|
return nsIAccessibleRole::ROLE_SECTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsHTMLOutputAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
|
||||||
|
{
|
||||||
|
nsresult rv = nsAccessibleWrap::GetAttributesInternal(aAttributes);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
nsAccUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::live,
|
||||||
|
NS_LITERAL_STRING("polite"));
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// nsHTMLLIAccessible
|
// nsHTMLLIAccessible
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -105,6 +105,25 @@ public:
|
||||||
virtual PRUint32 NativeRole();
|
virtual PRUint32 NativeRole();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for HTML output element.
|
||||||
|
*/
|
||||||
|
class nsHTMLOutputAccessible : public nsHyperTextAccessibleWrap
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
nsHTMLOutputAccessible(nsIContent* aContent, nsIWeakReference* aShell);
|
||||||
|
|
||||||
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
|
// nsIAccessible
|
||||||
|
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
|
||||||
|
nsIAccessibleRelation** aRelation);
|
||||||
|
|
||||||
|
// nsAccessible
|
||||||
|
virtual PRUint32 NativeRole();
|
||||||
|
virtual nsresult GetAttributesInternal(nsIPersistentProperties* aAttributes);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used for bullet of HTML list item element (for example, HTML li).
|
* Used for bullet of HTML list item element (for example, HTML li).
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
https://bugzilla.mozilla.org/show_bug.cgi?id=475006
|
https://bugzilla.mozilla.org/show_bug.cgi?id=475006
|
||||||
https://bugzilla.mozilla.org/show_bug.cgi?id=391829
|
https://bugzilla.mozilla.org/show_bug.cgi?id=391829
|
||||||
https://bugzilla.mozilla.org/show_bug.cgi?id=581952
|
https://bugzilla.mozilla.org/show_bug.cgi?id=581952
|
||||||
|
https://bugzilla.mozilla.org/show_bug.cgi?id=558036
|
||||||
-->
|
-->
|
||||||
<head>
|
<head>
|
||||||
<title>Group attributes tests</title>
|
<title>Group attributes tests</title>
|
||||||
|
@ -39,6 +40,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=581952
|
||||||
testAttrs("sortOther", {"sort" : "other"}, true);
|
testAttrs("sortOther", {"sort" : "other"}, true);
|
||||||
|
|
||||||
// live object attribute
|
// live object attribute
|
||||||
|
|
||||||
|
// HTML
|
||||||
|
testAttrs("output", {"live" : "polite"}, true);
|
||||||
|
|
||||||
|
// ARIA
|
||||||
testAttrs("live", {"live" : "polite"}, true);
|
testAttrs("live", {"live" : "polite"}, true);
|
||||||
testAttrs("live2", {"live" : "polite"}, true);
|
testAttrs("live2", {"live" : "polite"}, true);
|
||||||
testAbsentAttrs("live3", {"live" : ""});
|
testAbsentAttrs("live3", {"live" : ""});
|
||||||
|
@ -108,6 +114,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=581952
|
||||||
title="Make explicit that aria-label is not an object attribute">
|
title="Make explicit that aria-label is not an object attribute">
|
||||||
Mozilla Bug 475006
|
Mozilla Bug 475006
|
||||||
</a>
|
</a>
|
||||||
|
<a target="_blank"
|
||||||
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=558036"
|
||||||
|
title="make HTML <output> accessible">
|
||||||
|
Mozilla Bug 558036
|
||||||
|
</a>
|
||||||
|
|
||||||
<p id="display"></p>
|
<p id="display"></p>
|
||||||
<div id="content" style="display: none"></div>
|
<div id="content" style="display: none"></div>
|
||||||
|
@ -130,6 +141,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=581952
|
||||||
<div id="sortNone" role="columnheader" aria-sort="none"></div>
|
<div id="sortNone" role="columnheader" aria-sort="none"></div>
|
||||||
<div id="sortOther" role="columnheader" aria-sort="other"></div>
|
<div id="sortOther" role="columnheader" aria-sort="other"></div>
|
||||||
|
|
||||||
|
<!-- html -->
|
||||||
|
<output id="output"></output>
|
||||||
|
|
||||||
|
<!-- back to aria -->
|
||||||
<div id="live" aria-live="polite">excuse <div id="liveChild">me</div></div>
|
<div id="live" aria-live="polite">excuse <div id="liveChild">me</div></div>
|
||||||
<div id="live2" role="marquee" aria-live="polite">excuse <div id="live2Child">me</div></div>
|
<div id="live2" role="marquee" aria-live="polite">excuse <div id="live2Child">me</div></div>
|
||||||
<div id="live3" role="region">excuse</div>
|
<div id="live3" role="region">excuse</div>
|
||||||
|
|
|
@ -85,6 +85,11 @@
|
||||||
// 'default button' relation
|
// 'default button' relation
|
||||||
testRelation("input", RELATION_DEFAULT_BUTTON, "submit");
|
testRelation("input", RELATION_DEFAULT_BUTTON, "submit");
|
||||||
|
|
||||||
|
// output 'for' relations
|
||||||
|
testRelation("output", RELATION_CONTROLLED_BY, ["input", "input2"]);
|
||||||
|
testRelation("input", RELATION_CONTROLLER_FOR, "output");
|
||||||
|
testRelation("input2", RELATION_CONTROLLER_FOR, "output");
|
||||||
|
|
||||||
// 'described by'/'description for' relation for html:table and
|
// 'described by'/'description for' relation for html:table and
|
||||||
// html:caption
|
// html:caption
|
||||||
testRelation("caption", RELATION_DESCRIPTION_FOR, "table");
|
testRelation("caption", RELATION_DESCRIPTION_FOR, "table");
|
||||||
|
@ -125,6 +130,11 @@
|
||||||
title="mochitests for accessible relations">
|
title="mochitests for accessible relations">
|
||||||
Mozilla Bug 475298
|
Mozilla Bug 475298
|
||||||
</a>
|
</a>
|
||||||
|
<a target="_blank"
|
||||||
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=558036"
|
||||||
|
title="make HTML <output> accessible">
|
||||||
|
Mozilla Bug 558036
|
||||||
|
</a>
|
||||||
<p id="display"></p>
|
<p id="display"></p>
|
||||||
<div id="content" style="display: none"></div>
|
<div id="content" style="display: none"></div>
|
||||||
<pre id="test">
|
<pre id="test">
|
||||||
|
@ -189,9 +199,11 @@
|
||||||
<span id="flowfrom1">flow from</span>
|
<span id="flowfrom1">flow from</span>
|
||||||
<span id="flowfrom2">flow from</span>
|
<span id="flowfrom2">flow from</span>
|
||||||
|
|
||||||
<form>
|
<form id="form">
|
||||||
<input id="input" />
|
<input id="input" />
|
||||||
|
<input id="input2" />
|
||||||
<input type="submit" id="submit" />
|
<input type="submit" id="submit" />
|
||||||
|
<output id="output" style="display:block" for="input input2"></output>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<table id="table">
|
<table id="table">
|
||||||
|
|
|
@ -61,6 +61,16 @@
|
||||||
};
|
};
|
||||||
testAccessibleTree("image_submit", accTree);
|
testAccessibleTree("image_submit", accTree);
|
||||||
|
|
||||||
|
accTree = {
|
||||||
|
role: ROLE_SECTION,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
role: ROLE_TEXT_LEAF
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
testAccessibleTree("output", accTree);
|
||||||
|
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +90,11 @@
|
||||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=524521">
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=524521">
|
||||||
Mozilla Bug 524521
|
Mozilla Bug 524521
|
||||||
</a>
|
</a>
|
||||||
|
<a target="_blank"
|
||||||
|
href="https://bugzilla.mozilla.org/show_bug.cgi?id=558036"
|
||||||
|
title="make HTML <output> accessible">
|
||||||
|
Mozilla Bug 558036
|
||||||
|
</a>
|
||||||
<p id="display"></p>
|
<p id="display"></p>
|
||||||
<div id="content" style="display: none"></div>
|
<div id="content" style="display: none"></div>
|
||||||
<pre id="test">
|
<pre id="test">
|
||||||
|
@ -92,5 +107,6 @@
|
||||||
|
|
||||||
<input type="submit" id="submit">
|
<input type="submit" id="submit">
|
||||||
<input type="image" id="image_submit">
|
<input type="image" id="image_submit">
|
||||||
|
<output id="output">1337</output>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче