Bug 1105273 - Accessibility mapping for aria-modal, r=davidb
authorAlexander Surkov <surkov.alexander@gmail.com>
Fri, 28 Nov 2014 10:01:43 -0500
changeset 218034 0b5312cb24e4e72932ff1c2b9b51ee86cc2a03eb
parent 218033 1289066eccbe1353e276dc3c3306fcde2e31933f
child 218035 96b859f97454df928321fc39551de6aaf294b82d
push id10218
push userphilringnalda@gmail.com
push dateFri, 28 Nov 2014 23:17:57 +0000
treeherderfx-team@6dededc47e3d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidb
bugs1105273
milestone36.0a1
Bug 1105273 - Accessibility mapping for aria-modal, r=davidb
accessible/base/ARIAMap.cpp
accessible/base/ARIAMap.h
accessible/base/ARIAStateMap.cpp
accessible/base/ARIAStateMap.h
accessible/tests/mochitest/attributes/test_obj.html
accessible/tests/mochitest/states.js
accessible/tests/mochitest/states/test_aria.html
dom/base/nsGkAtomList.h
--- a/accessible/base/ARIAMap.cpp
+++ b/accessible/base/ARIAMap.cpp
@@ -676,16 +676,17 @@ nsRoleMapEntry aria::gEmptyRoleMap = {
  * whether there is an ARIA role or not:
  */
 static const EStateRule sWAIUnivStateMap[] = {
   eARIABusy,
   eARIADisabled,
   eARIAExpanded,  // Currently under spec review but precedent exists
   eARIAHasPopup,  // Note this is technically a "property"
   eARIAInvalid,
+  eARIAModal,
   eARIARequired,  // XXX not global, Bug 553117
   eARIANone
 };
 
 
 /**
  * ARIA attribute map for attribute characteristics.
  * @note ARIA attributes that don't have any flags are not included here.
@@ -711,16 +712,17 @@ static const AttrCharacteristics gWAIUni
   {&nsGkAtoms::aria_grabbed,                            ATTR_VALTOKEN | ATTR_GLOBAL },
   {&nsGkAtoms::aria_haspopup,          ATTR_BYPASSOBJ | ATTR_VALTOKEN | ATTR_GLOBAL },
   {&nsGkAtoms::aria_hidden,   ATTR_BYPASSOBJ_IF_FALSE | ATTR_VALTOKEN | ATTR_GLOBAL },
   {&nsGkAtoms::aria_invalid,           ATTR_BYPASSOBJ | ATTR_VALTOKEN | ATTR_GLOBAL },
   {&nsGkAtoms::aria_label,             ATTR_BYPASSOBJ                 | ATTR_GLOBAL },
   {&nsGkAtoms::aria_labelledby,        ATTR_BYPASSOBJ                 | ATTR_GLOBAL },
   {&nsGkAtoms::aria_level,             ATTR_BYPASSOBJ                               }, /* handled via groupPosition */
   {&nsGkAtoms::aria_live,                               ATTR_VALTOKEN | ATTR_GLOBAL },
+  {&nsGkAtoms::aria_modal,             ATTR_BYPASSOBJ | ATTR_VALTOKEN | ATTR_GLOBAL },
   {&nsGkAtoms::aria_multiline,         ATTR_BYPASSOBJ | ATTR_VALTOKEN               },
   {&nsGkAtoms::aria_multiselectable,   ATTR_BYPASSOBJ | ATTR_VALTOKEN               },
   {&nsGkAtoms::aria_owns,              ATTR_BYPASSOBJ                 | ATTR_GLOBAL },
   {&nsGkAtoms::aria_orientation,                        ATTR_VALTOKEN               },
   {&nsGkAtoms::aria_posinset,          ATTR_BYPASSOBJ                               }, /* handled via groupPosition */
   {&nsGkAtoms::aria_pressed,           ATTR_BYPASSOBJ | ATTR_VALTOKEN               },
   {&nsGkAtoms::aria_readonly,          ATTR_BYPASSOBJ | ATTR_VALTOKEN               },
   {&nsGkAtoms::aria_relevant,          ATTR_BYPASSOBJ                 | ATTR_GLOBAL },
--- a/accessible/base/ARIAMap.h
+++ b/accessible/base/ARIAMap.h
@@ -223,25 +223,25 @@ uint64_t UniversalStatesFor(mozilla::dom
  *
  * @param aAtom  ARIA attribute
  * @return       A bitflag representing the attribute characteristics
  *               (see above for possible bit masks, prefixed "ATTR_")
  */
 uint8_t AttrCharacteristicsFor(nsIAtom* aAtom);
 
  /**
-  * Represents a simple enumerator for iterating through ARIA attributes 
-  * exposed as object attributes on a given accessible. 
+  * Represents a simple enumerator for iterating through ARIA attributes
+  * exposed as object attributes on a given accessible.
   */
 class AttrIterator
 {
 public:
-  explicit AttrIterator(nsIContent* aContent) : 
-    mContent(aContent), mAttrIdx(0) 
-  { 
+  explicit AttrIterator(nsIContent* aContent) :
+    mContent(aContent), mAttrIdx(0)
+  {
     mAttrCount = mContent->GetAttrCount();
   }
 
   bool Next(nsAString& aAttrName, nsAString& aAttrValue);
 
 private:
   AttrIterator() MOZ_DELETE;
   AttrIterator(const AttrIterator&) MOZ_DELETE;
--- a/accessible/base/ARIAStateMap.cpp
+++ b/accessible/base/ARIAStateMap.cpp
@@ -180,16 +180,26 @@ aria::MapToState(EStateRule aRule, dom::
       static const TokenTypeData data(
         nsGkAtoms::aria_invalid, eBoolType,
         0, states::INVALID);
 
       MapTokenType(aElement, aState, data);
       return true;
     }
 
+    case eARIAModal:
+    {
+      static const TokenTypeData data(
+        nsGkAtoms::aria_modal, eBoolType,
+        0, states::MODAL);
+
+      MapTokenType(aElement, aState, data);
+      return true;
+    }
+
     case eARIAMultiline:
     {
       static const TokenTypeData data(
         nsGkAtoms::aria_multiline, eBoolType | eDefinedIfAbsent,
         0, states::MULTI_LINE, states::SINGLE_LINE);
 
       MapTokenType(aElement, aState, data);
       return true;
--- a/accessible/base/ARIAStateMap.h
+++ b/accessible/base/ARIAStateMap.h
@@ -28,16 +28,17 @@ enum EStateRule
   eARIABusy,
   eARIACheckableBool,
   eARIACheckableMixed,
   eARIACheckedMixed,
   eARIADisabled,
   eARIAExpanded,
   eARIAHasPopup,
   eARIAInvalid,
+  eARIAModal,
   eARIAMultiline,
   eARIAMultiSelectable,
   eARIAOrientation,
   eARIAPressed,
   eARIAReadonly,
   eARIAReadonlyOrEditable,
   eARIAReadonlyOrEditableIfDefined,
   eARIARequired,
--- a/accessible/tests/mochitest/attributes/test_obj.html
+++ b/accessible/tests/mochitest/attributes/test_obj.html
@@ -23,26 +23,28 @@ https://bugzilla.mozilla.org/show_bug.cg
     {
       // aria
       testAttrs("atomic", {"atomic" : "true", "container-atomic" : "true"}, true);
       testAttrs(getNode("atomic").firstChild, {"container-atomic" : "true"}, true);
       testAbsentAttrs("atomic_false", {"atomic" : "false", "container-atomic" : "false"});
       testAbsentAttrs(getNode("atomic_false").firstChild, {"container-atomic" : "false"});
 
       testAttrs("autocomplete", {"autocomplete" : "true"}, true);
-      testAttrs("checkbox", {"checkable" : "true"}, true); 
-      testAttrs("checkedCheckbox", {"checkable" : "true"}, true); 
-      testAttrs("checkedMenuitem", {"checkable" : "true"}, true); 
-      testAttrs("checkedOption", {"checkable" : "true"}, true); 
-      testAttrs("checkedRadio", {"checkable" : "true"}, true); 
-      testAttrs("checkedTreeitem", {"checkable" : "true"}, true); 
+      testAttrs("checkbox", {"checkable" : "true"}, true);
+      testAttrs("checkedCheckbox", {"checkable" : "true"}, true);
+      testAttrs("checkedMenuitem", {"checkable" : "true"}, true);
+      testAttrs("checkedOption", {"checkable" : "true"}, true);
+      testAttrs("checkedRadio", {"checkable" : "true"}, true);
+      testAttrs("checkedTreeitem", {"checkable" : "true"}, true);
       testAttrs("dropeffect", {"dropeffect" : "copy"}, true);
       testAttrs("grabbed", {"grabbed" : "true"}, true);
+      testAbsentAttrs("haspopup", { "haspopup": "false" });
       testAttrs("hidden", {"hidden" : "true"}, true);
       testAbsentAttrs("hidden_false", { "hidden": "false" });
+      testAbsentAttrs("modal", {"modal" : "true"});
       testAttrs("sortAscending", {"sort" : "ascending"}, true);
       testAttrs("sortDescending", {"sort" : "descending"}, true);
       testAttrs("sortNone", {"sort" : "none"}, true);
       testAttrs("sortOther", {"sort" : "other"}, true);
 
       // inherited attributes by subdocuments
       var subdoc = getAccessible("iframe").firstChild;
       testAttrs(subdoc, {"busy" : "true"}, true);
@@ -193,18 +195,20 @@ https://bugzilla.mozilla.org/show_bug.cg
   <div id="checkbox" role="checkbox"></div>
   <div id="checkedCheckbox" role="checkbox" aria-checked="true"></div>
   <div id="checkedMenuitem" role="menuitem" aria-checked="true"></div>
   <div id="checkedOption" role="option" aria-checked="true"></div>
   <div id="checkedRadio" role="radio" aria-checked="true"></div>
   <div id="checkedTreeitem" role="treeitem" aria-checked="true"></div>
   <div id="dropeffect" aria-dropeffect="copy"></div>
   <div id="grabbed" aria-grabbed="true"></div>
+  <div id="haspopup" aria-haspopup="true"></div>
   <div id="hidden" aria-hidden="true"></div>
   <div id="hidden_false" aria-hidden="false"></div>
+  <div id="modal" aria-modal="true"></div>
   <div id="sortAscending" role="columnheader" aria-sort="ascending"></div>
   <div id="sortDescending" role="columnheader" aria-sort="descending"></div>
   <div id="sortNone" role="columnheader" aria-sort="none"></div>
   <div id="sortOther" role="columnheader" aria-sort="other"></div>
 
   <!-- inherited from iframe -->
   <iframe id="iframe" src="data:text/html,<html><body></body></html>"
           aria-busy="true"></iframe>
--- a/accessible/tests/mochitest/states.js
+++ b/accessible/tests/mochitest/states.js
@@ -37,16 +37,17 @@ const STATE_TRAVERSED = nsIAccessibleSta
 const STATE_UNAVAILABLE = nsIAccessibleStates.STATE_UNAVAILABLE;
 
 const EXT_STATE_ACTIVE = nsIAccessibleStates.EXT_STATE_ACTIVE;
 const EXT_STATE_DEFUNCT = nsIAccessibleStates.EXT_STATE_DEFUNCT;
 const EXT_STATE_EDITABLE = nsIAccessibleStates.EXT_STATE_EDITABLE;
 const EXT_STATE_ENABLED = nsIAccessibleStates.EXT_STATE_ENABLED;
 const EXT_STATE_EXPANDABLE = nsIAccessibleStates.EXT_STATE_EXPANDABLE;
 const EXT_STATE_HORIZONTAL = nsIAccessibleStates.EXT_STATE_HORIZONTAL;
+const EXT_STATE_MODAL = nsIAccessibleStates.EXT_STATE_MODAL;
 const EXT_STATE_MULTI_LINE = nsIAccessibleStates.EXT_STATE_MULTI_LINE;
 const EXT_STATE_PINNED = nsIAccessibleStates.EXT_STATE_PINNED;
 const EXT_STATE_SENSITIVE = nsIAccessibleStates.EXT_STATE_SENSITIVE;
 const EXT_STATE_SINGLE_LINE = nsIAccessibleStates.EXT_STATE_SINGLE_LINE;
 const EXT_STATE_STALE = nsIAccessibleStates.EXT_STATE_STALE;
 const EXT_STATE_SUPPORTS_AUTOCOMPLETION =
   nsIAccessibleStates.EXT_STATE_SUPPORTS_AUTOCOMPLETION;
 const EXT_STATE_VERTICAL = nsIAccessibleStates.EXT_STATE_VERTICAL;
--- a/accessible/tests/mochitest/states/test_aria.html
+++ b/accessible/tests/mochitest/states/test_aria.html
@@ -92,16 +92,20 @@
       // aria-checked
       testStates("aria_checked_checkbox", STATE_CHECKED);
       testStates("aria_mixed_checkbox", STATE_MIXED);
 
       // test disabled group and all its descendants to see if they are
       // disabled, too. See bug 429285.
       testAriaDisabledTree("group");
 
+      // aria-modal
+      testStates("aria_modal", 0, EXT_STATE_MODAL);
+      testStates("aria_modal_false", 0, 0, 0, EXT_STATE_MODAL);
+
       // aria-multiline
       testStates("aria_multiline_textbox", 0, EXT_STATE_MULTI_LINE);
 
       // aria-multiselectable
       testStates("aria_multiselectable_listbox",
                  STATE_MULTISELECTABLE | STATE_EXTSELECTABLE);
 
       // aria-pressed
@@ -374,16 +378,18 @@
 
   <div id="aria_checked_checkbox" role="checkbox" aria-checked="true">
     I agree
   </div>
 
   <div id="aria_mixed_checkbox" role="checkbox" aria-checked="mixed">
     I might agree
   </div>
+  <div id="aria_modal" aria-modal="true">modal stuff</div>
+  <div id="aria_modal_false" aria-modal="false">non modal stuff</div>div>
   <div id="aria_multiline_textbox" role="textbox" aria-multiline="true"></div>
   <div id="aria_multiselectable_listbox" role="listbox" aria-multiselectable="true"></div>
   <div id="aria_pressed_button" role="button" aria-pressed="true">Button</div>
   <button id="aria_pressed_native_button" aria-pressed="true">Button</button>
 
   <div id="aria_readonly_textbox"
        role="textbox" aria-readonly="true">This text should be readonly</div>
 
--- a/dom/base/nsGkAtomList.h
+++ b/dom/base/nsGkAtomList.h
@@ -2230,16 +2230,17 @@ GK_ATOM(aria_flowto, "aria-flowto")
 GK_ATOM(aria_grabbed, "aria-grabbed")
 GK_ATOM(aria_haspopup, "aria-haspopup")
 GK_ATOM(aria_hidden, "aria-hidden")
 GK_ATOM(aria_invalid, "aria-invalid")
 GK_ATOM(aria_label, "aria-label")
 GK_ATOM(aria_labelledby, "aria-labelledby")
 GK_ATOM(aria_level, "aria-level")
 GK_ATOM(aria_live, "aria-live")
+GK_ATOM(aria_modal, "aria-modal")
 GK_ATOM(aria_multiline, "aria-multiline")
 GK_ATOM(aria_multiselectable, "aria-multiselectable")
 GK_ATOM(aria_orientation, "aria-orientation")
 GK_ATOM(aria_owns, "aria-owns")
 GK_ATOM(aria_posinset, "aria-posinset")
 GK_ATOM(aria_pressed, "aria-pressed")
 GK_ATOM(aria_readonly, "aria-readonly")
 GK_ATOM(aria_relevant, "aria-relevant")