Bug 1573337 - remove XBL anon content filtering support from accessible tree traversal r=Jamie
authorAlexander Surkov <surkov.alexander@gmail.com>
Thu, 15 Aug 2019 00:58:28 +0000
changeset 488177 9406ccf380bbc14f54eeecd3eec671750b22f53f
parent 488176 3769178b9a30790002c9c9555a11a045d460d5a3
child 488178 6a2dcba5612bf6f00e0740137c04ea739bdf4d91
push id113904
push userncsoregi@mozilla.com
push dateThu, 15 Aug 2019 19:41:00 +0000
treeherdermozilla-inbound@b283a7ef186c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersJamie
bugs1573337
milestone70.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 1573337 - remove XBL anon content filtering support from accessible tree traversal r=Jamie Differential Revision: https://phabricator.services.mozilla.com/D42022
accessible/base/TreeWalker.cpp
accessible/generic/Accessible.h
accessible/xul/XULComboboxAccessible.cpp
accessible/xul/XULListboxAccessible.cpp
accessible/xul/XULMenuAccessible.cpp
--- a/accessible/base/TreeWalker.cpp
+++ b/accessible/base/TreeWalker.cpp
@@ -23,18 +23,17 @@ using namespace mozilla::a11y;
 TreeWalker::TreeWalker(Accessible* aContext)
     : mDoc(aContext->Document()),
       mContext(aContext),
       mAnchorNode(nullptr),
       mARIAOwnsIdx(0),
       mChildFilter(nsIContent::eSkipPlaceholderContent),
       mFlags(0),
       mPhase(eAtStart) {
-  mChildFilter |=
-      mContext->NoXBLKids() ? nsIContent::eAllButXBL : nsIContent::eAllChildren;
+  mChildFilter |= nsIContent::eAllChildren;
 
   mAnchorNode = mContext->IsDoc() ? mDoc->DocumentNode()->GetRootElement()
                                   : mContext->GetContent();
 
   MOZ_COUNT_CTOR(TreeWalker);
 }
 
 TreeWalker::TreeWalker(Accessible* aContext, nsIContent* aAnchorNode,
@@ -45,18 +44,17 @@ TreeWalker::TreeWalker(Accessible* aCont
       mARIAOwnsIdx(0),
       mChildFilter(nsIContent::eSkipPlaceholderContent),
       mFlags(aFlags),
       mPhase(eAtStart) {
   MOZ_ASSERT(mFlags & eWalkCache,
              "This constructor cannot be used for tree creation");
   MOZ_ASSERT(aAnchorNode, "No anchor node for the accessible tree walker");
 
-  mChildFilter |=
-      mContext->NoXBLKids() ? nsIContent::eAllButXBL : nsIContent::eAllChildren;
+  mChildFilter |= nsIContent::eAllChildren;
 
   MOZ_COUNT_CTOR(TreeWalker);
 }
 
 TreeWalker::TreeWalker(DocAccessible* aDocument, nsIContent* aAnchorNode)
     : mDoc(aDocument),
       mContext(nullptr),
       mAnchorNode(aAnchorNode),
--- a/accessible/generic/Accessible.h
+++ b/accessible/generic/Accessible.h
@@ -922,22 +922,16 @@ class Accessible : public nsISupports {
   void SetRelocated(bool aRelocated) {
     if (aRelocated)
       mStateFlags |= eRelocated;
     else
       mStateFlags &= ~eRelocated;
   }
 
   /**
-   * Return true if the accessible doesn't allow accessible children from XBL
-   * anonymous subtree.
-   */
-  bool NoXBLKids() const { return mStateFlags & eNoXBLKids; }
-
-  /**
    * Return true if the accessible allows accessible children from subtree of
    * a DOM element of this accessible.
    */
   bool KidsFromDOM() const { return !(mStateFlags & eNoKidsFromDOM); }
 
   /**
    * Return true if this accessible has a parent whose name depends on this
    * accessible.
@@ -1032,21 +1026,20 @@ class Accessible : public nsISupports {
     eIsNotInDocument = 1 << 1,  // accessible is not in document
     eSharedNode = 1 << 2,  // accessible shares DOM node from another accessible
     eNotNodeMapEntry = 1 << 3,   // accessible shouldn't be in document node map
     eHasNumericValue = 1 << 4,   // accessible has a numeric value
     eGroupInfoDirty = 1 << 5,    // accessible needs to update group info
     eKidsMutating = 1 << 6,      // subtree is being mutated
     eIgnoreDOMUIEvent = 1 << 7,  // don't process DOM UI events for a11y events
     eRelocated = 1 << 8,         // accessible was moved in tree
-    eNoXBLKids = 1 << 9,         // accessible don't allows XBL children
-    eNoKidsFromDOM = 1 << 10,    // accessible doesn't allow children from DOM
-    eHasTextKids = 1 << 11,      // accessible have a text leaf in children
+    eNoKidsFromDOM = 1 << 9,    // accessible doesn't allow children from DOM
+    eHasTextKids = 1 << 10,      // accessible have a text leaf in children
 
-    eLastStateFlag = eNoKidsFromDOM
+    eLastStateFlag = eHasTextKids
   };
 
   /**
    * Flags used for contextual information about the accessible.
    */
   enum ContextFlags {
     eHasNameDependentParent =
         1 << 0,  // Parent's name depends on this accessible.
@@ -1140,17 +1133,17 @@ class Accessible : public nsISupports {
   // Data Members
   nsCOMPtr<nsIContent> mContent;
   RefPtr<DocAccessible> mDoc;
 
   Accessible* mParent;
   nsTArray<Accessible*> mChildren;
   int32_t mIndexInParent;
 
-  static const uint8_t kStateFlagsBits = 12;
+  static const uint8_t kStateFlagsBits = 11;
   static const uint8_t kContextFlagsBits = 2;
   static const uint8_t kTypeBits = 6;
   static const uint8_t kGenericTypesBits = 16;
 
   /**
    * Non-NO_ROLE_MAP_ENTRY_INDEX indicates author-supplied role;
    * possibly state & value as well
    */
--- a/accessible/xul/XULComboboxAccessible.cpp
+++ b/accessible/xul/XULComboboxAccessible.cpp
@@ -25,23 +25,16 @@ using namespace mozilla::a11y;
 XULComboboxAccessible::XULComboboxAccessible(nsIContent* aContent,
                                              DocAccessible* aDoc)
     : AccessibleWrap(aContent, aDoc) {
   if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                                          nsGkAtoms::autocomplete, eIgnoreCase))
     mGenericTypes |= eAutoComplete;
   else
     mGenericTypes |= eCombobox;
-
-  // The XUL <textbox type="autocomplete"> uses XULComboboxAccessible. We need
-  // to walk the anonymous children for these so that the entry field is a
-  // child. Otherwise no XBL children.
-  if (!mContent->NodeInfo()->Equals(nsGkAtoms::textbox, kNameSpaceID_XUL)) {
-    mStateFlags |= eNoXBLKids;
-  }
 }
 
 role XULComboboxAccessible::NativeRole() const {
   return IsAutoComplete() ? roles::AUTOCOMPLETE : roles::COMBOBOX;
 }
 
 uint64_t XULComboboxAccessible::NativeState() const {
   // As a nsComboboxAccessible we can have the following states:
--- a/accessible/xul/XULListboxAccessible.cpp
+++ b/accessible/xul/XULListboxAccessible.cpp
@@ -432,20 +432,16 @@ Accessible* XULListboxAccessible::Contai
 ////////////////////////////////////////////////////////////////////////////////
 
 XULListitemAccessible::XULListitemAccessible(nsIContent* aContent,
                                              DocAccessible* aDoc)
     : XULMenuitemAccessible(aContent, aDoc) {
   mIsCheckbox = mContent->AsElement()->AttrValueIs(
       kNameSpaceID_None, nsGkAtoms::type, nsGkAtoms::checkbox, eCaseMatters);
   mType = eXULListItemType;
-
-  // Walk XBL anonymous children for list items. Overrides the flag value from
-  // base XULMenuitemAccessible class.
-  mStateFlags &= ~eNoXBLKids;
 }
 
 XULListitemAccessible::~XULListitemAccessible() {}
 
 Accessible* XULListitemAccessible::GetListAccessible() const {
   if (IsDefunct()) return nullptr;
 
   nsCOMPtr<nsIDOMXULSelectControlItemElement> listItem =
--- a/accessible/xul/XULMenuAccessible.cpp
+++ b/accessible/xul/XULMenuAccessible.cpp
@@ -32,17 +32,16 @@ using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULMenuitemAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 XULMenuitemAccessible::XULMenuitemAccessible(nsIContent* aContent,
                                              DocAccessible* aDoc)
     : AccessibleWrap(aContent, aDoc) {
-  mStateFlags |= eNoXBLKids;
 }
 
 uint64_t XULMenuitemAccessible::NativeState() const {
   uint64_t state = Accessible::NativeState();
 
   // Has Popup?
   if (mContent->NodeInfo()->Equals(nsGkAtoms::menu, kNameSpaceID_XUL)) {
     state |= states::HASPOPUP;
@@ -346,18 +345,16 @@ XULMenupopupAccessible::XULMenupopupAcce
       parent && parent->AsElement() ? parent->AsElement()->AsXULSelectControl()
                                     : nullptr;
   if (selectControl) {
     mSelectControl = parent->AsElement();
   } else {
     mSelectControl = nullptr;
     mGenericTypes &= ~eSelect;
   }
-
-  mStateFlags |= eNoXBLKids;
 }
 
 uint64_t XULMenupopupAccessible::NativeState() const {
   uint64_t state = Accessible::NativeState();
 
 #ifdef DEBUG
   // We are onscreen if our parent is active
   bool isActive =