Bug 1052866 - Expose IAccessibleText on tables, rows, etc. r=tbsaunde, a=RyanVM
authorAlexander Surkov <surkov.alexander@gmail.com>
Fri, 26 Oct 2018 11:07:27 +0200
changeset 498228 59be666e2781b30954d40ecf5a11543af40b5f95
parent 498227 fcb8fd2dd657df97912e2d754ed613372456c32e
child 498229 52b79f0655cb6bf92c4cd1fffafc617280feacd3
push id10077
push userryanvm@gmail.com
push dateWed, 31 Oct 2018 17:19:06 +0000
treeherdermozilla-beta@43d2c9744a7d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstbsaunde, RyanVM
bugs1052866
milestone64.0
Bug 1052866 - Expose IAccessibleText on tables, rows, etc. r=tbsaunde, a=RyanVM
accessible/generic/ARIAGridAccessible.cpp
accessible/generic/ARIAGridAccessible.h
accessible/html/HTMLTableAccessible.h
accessible/tests/mochitest/elm/test_HTMLSpec.html
accessible/tests/mochitest/textrange/test_selection.html
accessible/xpcom/xpcAccessibleTable.cpp
accessible/xpcom/xpcAccessibleTable.h
--- a/accessible/generic/ARIAGridAccessible.cpp
+++ b/accessible/generic/ARIAGridAccessible.cpp
@@ -23,17 +23,17 @@ using namespace mozilla::a11y;
 ////////////////////////////////////////////////////////////////////////////////
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // Constructor
 
 ARIAGridAccessible::
   ARIAGridAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  AccessibleWrap(aContent, aDoc)
+  HyperTextAccessibleWrap(aContent, aDoc)
 {
   mGenericTypes |= eTable;
 }
 
 role
 ARIAGridAccessible::NativeRole() const
 {
   a11y::role r = GetAccService()->MarkupRole(mContent);
@@ -529,17 +529,17 @@ ARIAGridAccessible::SetARIASelected(Acce
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // ARIARowAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 ARIARowAccessible::
   ARIARowAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-  AccessibleWrap(aContent, aDoc)
+  HyperTextAccessibleWrap(aContent, aDoc)
 {
   mGenericTypes |= eTableRow;
 }
 
 role
 ARIARowAccessible::NativeRole() const
 {
   a11y::role r = GetAccService()->MarkupRole(mContent);
--- a/accessible/generic/ARIAGridAccessible.h
+++ b/accessible/generic/ARIAGridAccessible.h
@@ -11,23 +11,23 @@
 #include "TableCellAccessible.h"
 
 namespace mozilla {
 namespace a11y {
 
 /**
  * Accessible for ARIA grid and treegrid.
  */
-class ARIAGridAccessible : public AccessibleWrap,
+class ARIAGridAccessible : public HyperTextAccessibleWrap,
                            public TableAccessible
 {
 public:
   ARIAGridAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
-  NS_INLINE_DECL_REFCOUNTING_INHERITED(ARIAGridAccessible, AccessibleWrap)
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(ARIAGridAccessible, HyperTextAccessibleWrap)
 
   // Accessible
   virtual a11y::role NativeRole() const override;
   virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() override;
   virtual TableAccessible* AsTable() override { return this; }
 
   // TableAccessible
   virtual uint32_t ColCount() const override;
@@ -63,22 +63,22 @@ protected:
   nsresult SetARIASelected(Accessible* aAccessible, bool aIsSelected,
                            bool aNotify = true);
 };
 
 
 /**
  * Accessible for ARIA row.
  */
-class ARIARowAccessible : public AccessibleWrap
+class ARIARowAccessible : public HyperTextAccessibleWrap
 {
 public:
   ARIARowAccessible(nsIContent* aContent, DocAccessible* aDoc);
 
-  NS_INLINE_DECL_REFCOUNTING_INHERITED(ARIARowAccessible, AccessibleWrap)
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(ARIARowAccessible, HyperTextAccessibleWrap)
 
   // Accessible
   virtual a11y::role NativeRole() const override;
   virtual mozilla::a11y::GroupPos GroupPosition() override;
 
 protected:
   virtual ~ARIARowAccessible() {}
 };
--- a/accessible/html/HTMLTableAccessible.h
+++ b/accessible/html/HTMLTableAccessible.h
@@ -81,27 +81,27 @@ public:
   // Accessible
   virtual a11y::role NativeRole() const override;
 };
 
 
 /**
  * HTML table row accessible (html:tr).
  */
-class HTMLTableRowAccessible : public AccessibleWrap
+class HTMLTableRowAccessible : public HyperTextAccessibleWrap
 {
 public:
   HTMLTableRowAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-    AccessibleWrap(aContent, aDoc)
+    HyperTextAccessibleWrap(aContent, aDoc)
   {
     mType = eHTMLTableRowType;
     mGenericTypes |= eTableRow;
   }
 
-  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLTableRowAccessible, AccessibleWrap)
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLTableRowAccessible, HyperTextAccessibleWrap)
 
   // Accessible
   virtual a11y::role NativeRole() const override;
   virtual mozilla::a11y::GroupPos GroupPosition() override;
 
 protected:
   virtual ~HTMLTableRowAccessible() { }
 };
@@ -111,28 +111,28 @@ protected:
  * HTML table accessible (html:table).
  */
 
 // To turn on table debugging descriptions define SHOW_LAYOUT_HEURISTIC
 // This allow release trunk builds to be used by testers to refine the
 // data vs. layout heuristic
 // #define SHOW_LAYOUT_HEURISTIC
 
-class HTMLTableAccessible : public AccessibleWrap,
+class HTMLTableAccessible : public HyperTextAccessibleWrap,
                             public TableAccessible
 {
 public:
   HTMLTableAccessible(nsIContent* aContent, DocAccessible* aDoc) :
-    AccessibleWrap(aContent, aDoc)
+    HyperTextAccessibleWrap(aContent, aDoc)
   {
     mType = eHTMLTableType;
     mGenericTypes |= eTable;
   }
 
-  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLTableAccessible, AccessibleWrap)
+  NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLTableAccessible, HyperTextAccessibleWrap)
 
   // TableAccessible
   virtual Accessible* Caption() const override;
   virtual void Summary(nsString& aSummary) override;
   virtual uint32_t ColCount() const override;
   virtual uint32_t RowCount() override;
   virtual Accessible* CellAt(uint32_t aRowIndex, uint32_t aColumnIndex) override;
   virtual int32_t CellIndexAt(uint32_t aRowIdx, uint32_t aColIdx) override;
--- a/accessible/tests/mochitest/elm/test_HTMLSpec.html
+++ b/accessible/tests/mochitest/elm/test_HTMLSpec.html
@@ -225,27 +225,28 @@
       // ////////////////////////////////////////////////////////////////////////
       // HTML:caption under table
 
       obj = {
         role: ROLE_TABLE,
         relations: {
           RELATION_LABELLED_BY: "caption",
         },
-        interfaces: nsIAccessibleTable,
+        interfaces: [ nsIAccessibleText, nsIAccessibleHyperText, nsIAccessibleTable ],
         children: [
           {
             role: ROLE_CAPTION,
             relations: {
               RELATION_LABEL_FOR: "table",
             },
             interfaces: [ nsIAccessibleText, nsIAccessibleHyperText ],
           },
           { // td inside thead
             role: ROLE_ROW,
+            interfaces: [ nsIAccessibleText, nsIAccessibleHyperText ],
             children: [
               {
                 role: ROLE_COLUMNHEADER,
                 interfaces: [ nsIAccessibleTableCell, nsIAccessibleText, nsIAccessibleHyperText ],
               },
               { role: ROLE_COLUMNHEADER },
             ],
           },
--- a/accessible/tests/mochitest/textrange/test_selection.html
+++ b/accessible/tests/mochitest/textrange/test_selection.html
@@ -88,17 +88,17 @@
       // crop a range by a table
       range.selectNode(getNode("c2"));
       a11yranges = getAccessible(document, [nsIAccessibleText]).selectionRanges;
       a11yrange = a11yranges.queryElementAt(0, nsIAccessibleTextRange);
 
       testTextRange(a11yrange, "selection range #7", document, 4, document, 5);
 
       ok(a11yrange.crop(getAccessible("table")), "Range failed to crop #7.");
-      testTextRange(a11yrange, "cropped range #7", "c2", 5, "c2", 6);
+      testTextRange(a11yrange, "cropped range #7", "table", 0, "table", 1);
 
       SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doTest);
   </script>
 </head>
--- a/accessible/xpcom/xpcAccessibleTable.cpp
+++ b/accessible/xpcom/xpcAccessibleTable.cpp
@@ -16,17 +16,17 @@
 using namespace mozilla::a11y;
 
 static const uint32_t XPC_TABLE_DEFAULT_SIZE = 40;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsISupports
 
 NS_IMPL_ISUPPORTS_INHERITED(xpcAccessibleTable,
-                            xpcAccessibleGeneric,
+                            xpcAccessibleHyperText,
                             nsIAccessibleTable)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessibleTable
 
 NS_IMETHODIMP
 xpcAccessibleTable::GetCaption(nsIAccessible** aCaption)
 {
--- a/accessible/xpcom/xpcAccessibleTable.h
+++ b/accessible/xpcom/xpcAccessibleTable.h
@@ -3,33 +3,33 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_a11y_xpcAccessibleTable_h_
 #define mozilla_a11y_xpcAccessibleTable_h_
 
 #include "nsIAccessibleTable.h"
-#include "xpcAccessibleGeneric.h"
+#include "xpcAccessibleHyperText.h"
 
 namespace mozilla {
 namespace a11y {
 
 /**
  * XPCOM wrapper around TableAccessible class.
  */
-class xpcAccessibleTable : public xpcAccessibleGeneric,
+class xpcAccessibleTable : public xpcAccessibleHyperText,
                            public nsIAccessibleTable
 {
 public:
   explicit xpcAccessibleTable(Accessible* aIntl) :
-    xpcAccessibleGeneric(aIntl) { }
+    xpcAccessibleHyperText(aIntl) { }
 
   xpcAccessibleTable(ProxyAccessible* aProxy, uint32_t aInterfaces) :
-    xpcAccessibleGeneric(aProxy, aInterfaces) {}
+    xpcAccessibleHyperText(aProxy, aInterfaces) {}
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessibleTable
   NS_IMETHOD GetCaption(nsIAccessible** aCaption) final;
   NS_IMETHOD GetSummary(nsAString& aSummary) final;
   NS_IMETHOD GetColumnCount(int32_t* aColumnCount) final;
   NS_IMETHOD GetRowCount(int32_t* aRowCount) final;