зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1563598: Display 'container-live' attribute on descendents of implicitly-live elements. r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D45609 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
dd9d61742f
Коммит
5523b6c1ff
|
@ -20,6 +20,7 @@
|
|||
#include "nsIPersistentProperties2.h"
|
||||
#include "mozilla/a11y/PDocAccessibleChild.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsAccessibilityService.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
|
@ -138,7 +139,11 @@ void nsAccUtils::SetLiveContainerAttributes(
|
|||
live);
|
||||
} else if (role) {
|
||||
GetLiveAttrValue(role->liveAttRule, live);
|
||||
} else if (nsStaticAtom* value = GetAccService()->MarkupAttribute(
|
||||
ancestor, nsGkAtoms::live)) {
|
||||
value->ToString(live);
|
||||
}
|
||||
|
||||
if (!live.IsEmpty()) {
|
||||
SetAccAttr(aAttributes, nsGkAtoms::containerLive, live);
|
||||
if (role) {
|
||||
|
@ -488,6 +493,9 @@ bool nsAccUtils::IsARIALive(const Accessible* aAccessible) {
|
|||
docLive);
|
||||
} else if (role) {
|
||||
GetLiveAttrValue(role->liveAttRule, docLive);
|
||||
} else if (nsStaticAtom* value = GetAccService()->MarkupAttribute(
|
||||
ancestor, nsGkAtoms::live)) {
|
||||
value->ToString(docLive);
|
||||
}
|
||||
if (!docLive.IsEmpty()) {
|
||||
live = docLive;
|
||||
|
|
|
@ -245,6 +245,25 @@ class nsAccessibilityService final : public mozilla::a11y::DocManager,
|
|||
return markupMap ? markupMap->role : mozilla::a11y::roles::NOTHING;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the associated value for a given attribute if
|
||||
* it appears in the MarkupMap. Otherwise, it returns null.
|
||||
*/
|
||||
nsStaticAtom* MarkupAttribute(const nsIContent* aContent,
|
||||
nsStaticAtom* aAtom) const {
|
||||
const mozilla::a11y::HTMLMarkupMapInfo* markupMap =
|
||||
mHTMLMarkupMap.Get(aContent->NodeInfo()->NameAtom());
|
||||
if (markupMap) {
|
||||
for (size_t i = 0; i < mozilla::ArrayLength(markupMap->attrs); i++) {
|
||||
const mozilla::a11y::MarkupAttrInfo* info = markupMap->attrs + i;
|
||||
if (info->name == aAtom) {
|
||||
return info->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the object attribute defined by markup for the given element.
|
||||
*/
|
||||
|
|
|
@ -88,6 +88,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
|
|||
testAttrs("statusChild", {"container-live": "polite"}, true);
|
||||
testAttrs("timerChild", {"container-live": "off"}, true);
|
||||
testAbsentAttrs("tablistChild", {"container-live": "polite"});
|
||||
testAttrs("containerLiveOutput", {"container-live": "polite"}, true);
|
||||
testAttrs("containerLiveOutput1", {"container-live": "polite"}, true);
|
||||
testAttrs("containerLiveOutput2", {"container-live": "polite"}, true);
|
||||
|
||||
// container-live-role object attribute
|
||||
testAttrs("log", {"container-live-role": "log"}, true);
|
||||
|
@ -166,6 +169,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
|
|||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<!-- container live -->
|
||||
<output id="containerLiveOutput"><div id="containerLiveOutput1"><div id="containerLiveOutput2">Test</div></div></output>
|
||||
|
||||
<!-- aria -->
|
||||
<div id="atomic" aria-atomic="true">live region</div>
|
||||
<div id="atomic_false" aria-atomic="false">live region</div>
|
||||
|
|
Загрузка…
Ссылка в новой задаче