Bug 1540180 - The role of a broken input[type="image"] doesn't depend on its display value. r=surkov,eeejay

Differential Revision: https://phabricator.services.mozilla.com/D25517

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-04-01 18:51:14 +00:00
parent a649207dc6
commit 50f8f6a6d3
3 changed files with 10 additions and 5 deletions

View File

@ -186,10 +186,16 @@ MARKUPMAP(hr,
MARKUPMAP(input,
[](Element* aElement, Accessible* aContext) -> Accessible* {
// TODO(emilio): This would be faster if it used
// HTMLInputElement's already-parsed representation.
if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
nsGkAtoms::checkbox, eIgnoreCase)) {
return new CheckboxAccessible(aElement, aContext->Document());
}
if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
nsGkAtoms::image, eIgnoreCase)) {
return new HTMLButtonAccessible(aElement, aContext->Document());
}
if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
nsGkAtoms::radio, eIgnoreCase)) {
return new HTMLRadioButtonAccessible(aElement,

View File

@ -716,6 +716,7 @@
actions: "press",
};
testElm("input_image", obj);
testElm("input_image_display", obj);
testElm("input_submit", obj);
obj = {
@ -1651,6 +1652,7 @@
<input id="input_checkbox_true" type="checkbox" checked>
<input id="input_file" type="file">
<input id="input_image" type="image">
<input id="input_image_display" type="image" style="display: block">
<form>
<input id="input_image_default" type="image">
</form>

View File

@ -855,11 +855,8 @@ nscoord nsInlineFrame::GetLogicalBaseline(
#ifdef ACCESSIBILITY
a11y::AccType nsInlineFrame::AccessibleType() {
// Broken image accessibles are created here, because layout
// replaces the image or image control frame with an inline frame
if (mContent->IsHTMLElement(
nsGkAtoms::input)) // Broken <input type=image ... />
return a11y::eHTMLButtonType;
// FIXME(emilio): This is broken, if the image has its default `display` value
// overridden. Should be somewhere else.
if (mContent->IsHTMLElement(
nsGkAtoms::img)) // Create accessible for broken <img>
return a11y::eHyperTextType;