Bug 1587791 - remove XBL backed accessible relations support r=MarcoZ
authorAlexander Surkov <surkov.alexander@gmail.com>
Thu, 10 Oct 2019 14:08:17 +0000
changeset 497120 f14bfae6f0402d1503d5cfbbd7a47c7715fdd5f9
parent 497119 2421742b70dd0c497b178745615405360c343460
child 497121 5ef33867cacb34b48a89fef0c5aa08f38df67544
push id97673
push userasurkov@mozilla.com
push dateThu, 10 Oct 2019 14:10:52 +0000
treeherderautoland@f14bfae6f040 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMarcoZ
bugs1587791
milestone71.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 1587791 - remove XBL backed accessible relations support r=MarcoZ Differential Revision: https://phabricator.services.mozilla.com/D48840
accessible/base/AccIterator.cpp
accessible/base/AccIterator.h
accessible/base/moz.build
accessible/tests/mochitest/name/a11y.ini
accessible/tests/mochitest/name/general.css
accessible/tests/mochitest/name/general.xbl
accessible/tests/mochitest/name/test_general.xul
accessible/tests/mochitest/name/test_tree.xul
accessible/tests/mochitest/relations/a11y.ini
accessible/tests/mochitest/relations/test_bindings.xhtml
--- a/accessible/base/AccIterator.cpp
+++ b/accessible/base/AccIterator.cpp
@@ -67,52 +67,41 @@ AccIterator::IteratorState::IteratorStat
 ////////////////////////////////////////////////////////////////////////////////
 
 RelatedAccIterator::RelatedAccIterator(DocAccessible* aDocument,
                                        nsIContent* aDependentContent,
                                        nsAtom* aRelAttr)
     : mDocument(aDocument),
       mRelAttr(aRelAttr),
       mProviders(nullptr),
-      mBindingParent(nullptr),
       mIndex(0) {
-  mBindingParent = aDependentContent->IsInAnonymousSubtree()
-                       ? aDependentContent->GetBindingParent()
-                       : nullptr;
-  nsAtom* IDAttr = mBindingParent ? nsGkAtoms::anonid : nsGkAtoms::id;
-
   nsAutoString id;
   if (aDependentContent->IsElement() &&
-      aDependentContent->AsElement()->GetAttr(kNameSpaceID_None, IDAttr, id)) {
+      aDependentContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::id, id)) {
     mProviders = mDocument->GetRelProviders(aDependentContent->AsElement(), id);
   }
 }
 
 Accessible* RelatedAccIterator::Next() {
   if (!mProviders) return nullptr;
 
   while (mIndex < mProviders->Length()) {
     DocAccessible::AttrRelProvider* provider = (*mProviders)[mIndex++];
 
-    // Return related accessible for the given attribute and if the provider
-    // content is in the same binding in the case of XBL usage.
+    // Return related accessible for the given attribute.
     if (provider->mRelAttr == mRelAttr) {
-      nsIContent* bindingParent = provider->mContent->IsInAnonymousSubtree()
-                                      ? provider->mContent->GetBindingParent()
-                                      : nullptr;
-      bool inScope = mBindingParent == bindingParent ||
-                     mBindingParent == provider->mContent;
+      Accessible* related = mDocument->GetAccessible(provider->mContent);
+      if (related) {
+        return related;
+      }
 
-      if (inScope) {
-        Accessible* related = mDocument->GetAccessible(provider->mContent);
-        if (related) return related;
-
-        // If the document content is pointed by relation then return the
-        // document itself.
-        if (provider->mContent == mDocument->GetContent()) return mDocument;
+      // If the document content is pointed by relation then return the
+      // document itself.
+      if (provider->mContent == mDocument->GetContent()) {
+        return mDocument;
       }
     }
   }
 
   return nullptr;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -259,46 +248,21 @@ dom::Element* IDRefsIterator::GetElem(ns
                                       const nsAString& aID) {
   // Get elements in DOM tree by ID attribute if this is an explicit content.
   // In case of bound element check its anonymous subtree.
   if (!aContent->IsInAnonymousSubtree()) {
     dom::DocumentOrShadowRoot* docOrShadowRoot =
         aContent->GetUncomposedDocOrConnectedShadowRoot();
     if (docOrShadowRoot) {
       dom::Element* refElm = docOrShadowRoot->GetElementById(aID);
-      if (refElm
-#ifdef MOZ_XBL
-          || !aContent->GetXBLBinding()
-#endif
-      )
+      if (refElm) {
         return refElm;
+      }
     }
   }
-
-#ifdef MOZ_XBL
-  // If content is in anonymous subtree or an element having anonymous subtree
-  // then use "anonid" attribute to get elements in anonymous subtree.
-
-  // Check inside the binding the element is contained in.
-  nsIContent* bindingParent = aContent->GetBindingParent();
-  if (bindingParent) {
-    dom::Element* refElm =
-        bindingParent->OwnerDoc()->GetAnonymousElementByAttribute(
-            bindingParent, nsGkAtoms::anonid, aID);
-
-    if (refElm) return refElm;
-  }
-
-  // Check inside the binding of the element.
-  if (aContent->GetXBLBinding()) {
-    return aContent->OwnerDoc()->GetAnonymousElementByAttribute(
-        aContent, nsGkAtoms::anonid, aID);
-  }
-#endif
-
   return nullptr;
 }
 
 dom::Element* IDRefsIterator::GetElem(const nsDependentSubstring& aID) {
   return GetElem(mContent, aID);
 }
 
 Accessible* IDRefsIterator::Next() {
--- a/accessible/base/AccIterator.h
+++ b/accessible/base/AccIterator.h
@@ -92,17 +92,16 @@ class RelatedAccIterator : public AccIte
  private:
   RelatedAccIterator();
   RelatedAccIterator(const RelatedAccIterator&);
   RelatedAccIterator& operator=(const RelatedAccIterator&);
 
   DocAccessible* mDocument;
   nsAtom* mRelAttr;
   DocAccessible::AttrRelProviders* mProviders;
-  nsIContent* mBindingParent;
   uint32_t mIndex;
 };
 
 /**
  * Used to iterate through HTML labels associated with the given accessible.
  */
 class HTMLLabelIterator : public AccIterable {
  public:
--- a/accessible/base/moz.build
+++ b/accessible/base/moz.build
@@ -85,19 +85,16 @@ LOCAL_INCLUDES += [
     '/ipc/chromium/src',
     '/layout/generic',
     '/layout/style',
     '/layout/svg',
     '/layout/xul',
     '/layout/xul/tree/',
 ]
 
-if CONFIG['MOZ_XBL']:
-    LOCAL_INCLUDES += ['/dom/xbl']
-
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk':
     LOCAL_INCLUDES += [
         '/accessible/atk',
     ]
     CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
     LOCAL_INCLUDES += [
         '/accessible/windows/ia2',
--- a/accessible/tests/mochitest/name/a11y.ini
+++ b/accessible/tests/mochitest/name/a11y.ini
@@ -1,12 +1,10 @@
 [DEFAULT]
 support-files =
-  general.css
-  general.xbl
   markup.js
   markuprules.xml
   !/accessible/tests/mochitest/*.js
   !/accessible/tests/mochitest/moz.png
 
 [test_ARIACore_examples.html]
 [test_browserui.xul]
 skip-if = (os == 'linux' && !debug) || (verify && !debug && (os == 'win')) # Bug1429575
deleted file mode 100644
--- a/accessible/tests/mochitest/name/general.css
+++ /dev/null
@@ -1,11 +0,0 @@
-box.first {
-  -moz-binding: url('general.xbl#first');
-}
-
-.second {
-  -moz-binding: url('general.xbl#second');
-}
-
-.third {
-  -moz-binding: url('general.xbl#third');
-}
deleted file mode 100644
--- a/accessible/tests/mochitest/name/general.xbl
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-
-<bindings xmlns="http://www.mozilla.org/xbl"
-          xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-
-  <binding id="first">
-    <content>
-      <xul:textbox anonid="labeled" class="bottom"/>
-      <xul:label control="labeled" value="Label"/>
-      <children/>
-    </content>
-  </binding>
-
-  <binding id="second">
-    <content>
-      <xul:box class="first">
-        <xul:label control="toplabeled" value="Top textbox"/>
-        <xul:textbox anonid="toplabeled" class="top"/>
-      </xul:box>
-      <children/>
-    </content>
-  </binding>
-
-  <binding id="third">
-    <content>
-      <xul:description anonid="label" value="It's a " />
-      <xul:description anonid="label2" value="cool button" />
-      <xul:button anonid="button" aria-labelledby="label label2"
-                  value="button" />
-    </content>
-  </binding>
-</bindings>
--- a/accessible/tests/mochitest/name/test_general.xul
+++ b/accessible/tests/mochitest/name/test_general.xul
@@ -1,15 +1,12 @@
 <?xml version="1.0"?>
 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
                  type="text/css"?>
-<?xml-stylesheet href="general.css"
-                 type="text/css"?>
-
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="Accessibility Name Calculating Test.">
 
   <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
 
   <script type="application/javascript"
@@ -42,20 +39,16 @@
       // of elements. Gets the name from text nodes of those elements.
       testName("btn_labelledby_texts", "text1 text2");
 
       // Trick cases. Self and recursive referencing.
       testName("rememberHistoryDays", "Remember 3 days");
       testName("historyDays", "Remember 3 days");
       testName("rememberAfter", "days");
 
-      // Anonymous content (see name.xbl#third)
-      var anonBtn = getAccessible("labelledby_box_anon").lastChild;
-      testName(anonBtn, "It's a cool button");
-
       //////////////////////////////////////////////////////////////////////////
       // Name from subtree (single relation labelled_by).
 
       // Gets the name from text nodes contained by nested elements.
       testName("btn_labelledby_mixed", "nomore text");
 
       // Gets the name from text nodes and selected item of menulist
       // (other items are ignored).
@@ -192,19 +185,16 @@
           aria-labelledby="labelledby_text"/>
 
   <!-- aria-labelledby, multiple relations -->
   <description id="labelledby_text1">text1</description>
   <description id="labelledby_text2">text2</description>
   <button id="btn_labelledby_texts"
           aria-labelledby="labelledby_text1 labelledby_text2"/>
 
-  <!-- aria-labelledby, multiple relations -->
-  <box class="third" id="labelledby_box_anon" role="group" />
-
   <!-- trick aria-labelledby -->
   <checkbox id="rememberHistoryDays"
             label="Remember "
             aria-labelledby="rememberHistoryDays historyDays rememberAfter"/>
   <html:input id="historyDays" value="3"
               aria-labelledby="rememberHistoryDays historyDays rememberAfter"/>
   <label id="rememberAfter">days</label>
 
--- a/accessible/tests/mochitest/name/test_tree.xul
+++ b/accessible/tests/mochitest/name/test_tree.xul
@@ -1,15 +1,12 @@
 <?xml version="1.0"?>
 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
                  type="text/css"?>
-<?xml-stylesheet href="general.css"
-                 type="text/css"?>
-
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         title="Accessibility Name Calculating Test.">
 
   <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
 
   <script type="application/javascript"
           src="../treeview.js" />
--- a/accessible/tests/mochitest/relations/a11y.ini
+++ b/accessible/tests/mochitest/relations/a11y.ini
@@ -1,13 +1,12 @@
 [DEFAULT]
 support-files =
   !/accessible/tests/mochitest/*.js
 
-[test_bindings.xhtml]
 [test_embeds.xul]
 skip-if = os == 'linux' && !debug # bug 1411145
 [test_general.html]
 [test_general.xul]
 [test_tabbrowser.xul]
 [test_tree.xul]
 [test_ui_modalprompt.html]
 [test_shadowdom.html]
deleted file mode 100644
--- a/accessible/tests/mochitest/relations/test_bindings.xhtml
+++ /dev/null
@@ -1,100 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-
-<head>
-  <title>Accessible relations for bindings</title>
-
-  <link rel="stylesheet" type="text/css"
-        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-
-  <style>
-    .button {
-      -moz-binding: url('#custombutton');
-    }
-
-    .button2 {
-      -moz-binding: url('#custombutton2');
-    }
-  </style>
-
-  <bindings xmlns="http://www.mozilla.org/xbl">
-    <binding id="custombutton">
-      <content aria-labelledby="button.label label">
-        <label xmlns="http://www.w3.org/1999/xhtml" anonid="button.label">
-          anon label
-        </label>
-        <button xmlns="http://www.w3.org/1999/xhtml" anonid="button.button"
-                aria-labelledby="button.label label">
-          a button
-        </button>
-        <div xmlns="http://www.w3.org/1999/xhtml"
-             anonid="button.button2" class="button2"
-             aria-labelledby="button.label"></div>
-        <div xmlns="http://www.w3.org/1999/xhtml"
-             anonid="button.button3" class="button2"></div>
-      </content>
-    </binding>
-    <binding id="custombutton2">
-      <content aria-labelledby="button2.label">
-        <label xmlns="http://www.w3.org/1999/xhtml" anonid="button2.label">
-          nested anon label
-        </label>
-      </content>
-    </binding>
-  </bindings>
-
-  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-  <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
-
-  <script type="application/javascript"
-          src="../common.js"></script>
-  <script type="application/javascript"
-          src="../relations.js"></script>
-
-  <script type="application/javascript">
-    function doTests() {
-      var button = document.getElementById("button");
-      var anonLabel = document.
-        getAnonymousElementByAttribute(button, "anonid", "button.label");
-      var anonButton = document.
-        getAnonymousElementByAttribute(button, "anonid", "button.button");
-      var anonButton2 = document.
-        getAnonymousElementByAttribute(button, "anonid", "button.button2");
-      var anonButton3 = document.
-        getAnonymousElementByAttribute(button, "anonid", "button.button3");
-      var anonAnonLabel = document.
-        getAnonymousElementByAttribute(anonButton3, "anonid", "button2.label");
-
-      testRelation("label", RELATION_LABEL_FOR, button);
-      testRelation(anonLabel, RELATION_LABEL_FOR, [button, anonButton, anonButton2]);
-      testRelation(button, RELATION_LABELLED_BY, [anonLabel, "label"]);
-      testRelation(anonButton, RELATION_LABELLED_BY, anonLabel);
-      testRelation(anonButton2, RELATION_LABELLED_BY, anonLabel);
-      testRelation(anonButton3, RELATION_LABELLED_BY, anonAnonLabel);
-      testRelation(anonAnonLabel, RELATION_LABEL_FOR, anonButton3);
-
-      SimpleTest.finish();
-    }
-
-    SimpleTest.waitForExplicitFinish();
-    addA11yLoadEvent(doTests);
-  </script>
-</head>
-
-<body>
-
-  <a target="_blank"
-     href="https://bugzilla.mozilla.org/show_bug.cgi?id=421242"
-     title="Allow relations in anonymous content for binding parent">
-    Mozilla Bug 421242
-  </a>
-
-  <p id="display"></p>
-  <div id="content" style="display: none"></div>
-  <pre id="test">
-  </pre>
-  <div id="eventdump"></div>
-
-  <label id="label">explicit label</label>
-  <div id="button" class="button"></div>
-</body>
-</html>