Bug 1540180 - The role of a broken input[type="image"] doesn't depend on its display value. r=surkov,eeejay
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 01 Apr 2019 18:51:14 +0000
changeset 467424 b5298ae1354231d13c9e59a46dc2984493169541
parent 467423 238d4a1f7c02ceebdbd9f326deabb621d752f981
child 467425 f62a0f9a0e9db92217dbc11808127c1944a7837d
push id112626
push usercbrindusan@mozilla.com
push dateTue, 02 Apr 2019 08:40:51 +0000
treeherdermozilla-inbound@ea0977445697 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov, eeejay
bugs1540180
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
accessible/base/MarkupMap.h
accessible/tests/mochitest/elm/test_HTMLSpec.html
layout/generic/nsInlineFrame.cpp
--- a/accessible/base/MarkupMap.h
+++ b/accessible/base/MarkupMap.h
@@ -181,21 +181,27 @@ MARKUPMAP(h6, New_HyperText, roles::HEAD
 MARKUPMAP(hr,
           [](Element* aElement, Accessible* aContext) -> Accessible* {
             return new HTMLHRAccessible(aElement, aContext->Document());
           },
           0)
 
 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,
                                                    aContext->Document());
             }
             if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                                       nsGkAtoms::time, eIgnoreCase)) {
               return new EnumRoleAccessible<roles::GROUPING>(
                   aElement, aContext->Document());
--- a/accessible/tests/mochitest/elm/test_HTMLSpec.html
+++ b/accessible/tests/mochitest/elm/test_HTMLSpec.html
@@ -711,16 +711,17 @@
       // HTML:input@type="image"
 
       obj = {
         role: ROLE_PUSHBUTTON,
         absentStates: STATE_DEFAULT,
         actions: "press",
       };
       testElm("input_image", obj);
+      testElm("input_image_display", obj);
       testElm("input_submit", obj);
 
       obj = {
         role: ROLE_PUSHBUTTON,
         actions: "press",
         states: STATE_DEFAULT,
       };
       testElm("input_image_default", obj);
@@ -1646,16 +1647,17 @@
   <p id="i_container">normal<i>italic</i></p>
   <img id="img" src="../moz.png">
 
   <input id="input_button" type="button" value="Button">
   <input id="input_checkbox" type="checkbox">
   <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>
   <input id="input_submit" type="submit">
   <form>
     <input id="input_submit_default" type="submit">
   </form>
   <input id="input_number" type="number" value="44">
--- a/layout/generic/nsInlineFrame.cpp
+++ b/layout/generic/nsInlineFrame.cpp
@@ -850,21 +850,18 @@ nsIFrame::LogicalSides nsInlineFrame::Ge
 
 nscoord nsInlineFrame::GetLogicalBaseline(
     mozilla::WritingMode aWritingMode) const {
   return mBaseline;
 }
 
 #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;
 
   return a11y::eNoType;
 }
 #endif