Bug 1616829: Don't remove ATK_STATE_EDITABLE from list items in editors. r=MarcoZ
authorJames Teh <jteh@mozilla.com>
Thu, 26 Mar 2020 20:54:02 +0000
changeset 520643 3789a12084e4c4af0fcc4cf17f3be13d5e7f4f8b
parent 520642 00bde57608b3936cefbe06a383f3b3f351045dcf
child 520644 7bff013c356df29de2e492e71aebce4320497b70
push id37254
push usernerli@mozilla.com
push dateFri, 27 Mar 2020 04:48:07 +0000
treeherdermozilla-central@2d758b42bd73 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMarcoZ
bugs1616829
milestone76.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 1616829: Don't remove ATK_STATE_EDITABLE from list items in editors. r=MarcoZ Differential Revision: https://phabricator.services.mozilla.com/D68327
accessible/atk/AccessibleWrap.cpp
--- a/accessible/atk/AccessibleWrap.cpp
+++ b/accessible/atk/AccessibleWrap.cpp
@@ -813,20 +813,24 @@ gint getIndexInParentCB(AtkObject* aAtkO
   }
 
   Accessible* parent = accWrap->Parent();
   if (!parent) return -1;  // No parent
 
   return parent->GetIndexOfEmbeddedChild(accWrap);
 }
 
-static void TranslateStates(uint64_t aState, AtkStateSet* aStateSet) {
+static void TranslateStates(uint64_t aState, roles::Role aRole,
+                            AtkStateSet* aStateSet) {
   // atk doesn't have a read only state so read only things shouldn't be
-  // editable.
-  if (aState & states::READONLY) aState &= ~states::EDITABLE;
+  // editable. However, we don't do this for list items because Gecko always
+  // exposes those as read only.
+  if ((aState & states::READONLY) && aRole != roles::LISTITEM) {
+    aState &= ~states::EDITABLE;
+  }
 
   // Convert every state to an entry in AtkStateMap
   uint64_t bitMask = 1;
   for (auto stateIndex = 0U; stateIndex < gAtkStateMapLen; stateIndex++) {
     if (gAtkStateMap[stateIndex]
             .atkState) {  // There's potentially an ATK state for this
       bool isStateOn = (aState & bitMask) != 0;
       if (gAtkStateMap[stateIndex].stateMapEntryType == kMapOpposite) {
@@ -840,22 +844,23 @@ static void TranslateStates(uint64_t aSt
   }
 }
 
 AtkStateSet* refStateSetCB(AtkObject* aAtkObj) {
   AtkStateSet* state_set = nullptr;
   state_set = ATK_OBJECT_CLASS(parent_class)->ref_state_set(aAtkObj);
 
   AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
-  if (accWrap)
-    TranslateStates(accWrap->State(), state_set);
-  else if (ProxyAccessible* proxy = GetProxy(aAtkObj))
-    TranslateStates(proxy->State(), state_set);
-  else
-    TranslateStates(states::DEFUNCT, state_set);
+  if (accWrap) {
+    TranslateStates(accWrap->State(), accWrap->Role(), state_set);
+  } else if (ProxyAccessible* proxy = GetProxy(aAtkObj)) {
+    TranslateStates(proxy->State(), proxy->Role(), state_set);
+  } else {
+    TranslateStates(states::DEFUNCT, roles::NOTHING, state_set);
+  }
 
   return state_set;
 }
 
 static void UpdateAtkRelation(RelationType aType, Accessible* aAcc,
                               AtkRelationType aAtkType,
                               AtkRelationSet* aAtkSet) {
   if (aAtkType == ATK_RELATION_NULL) return;