Avoid confusion between AccessibilityObject::isTable() / isAccessibilityTable()
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Oct 2014 21:45:20 +0000 (21:45 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Oct 2014 21:45:20 +0000 (21:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=137899

Reviewed by Darin Adler.

Avoid confusion between AccessibilityObject::isTable() and
isAccessibilityTable(). isTable() is equivalent to
is<AccessibilityTable>(), while isAccessibilityTable() is an
AccessibilityTable that is exposed as an AccessibilityTable to the
platform.

This patch is renaming isAccessibilityTable() to
isExposableThroughAccessibility(), makes it non-virtual and defines it
on AccessibilityTable only, for clarity.

This patch also renames isTableExposableThroughAccessibility() to
computeIisTableExposableThroughAccessibility() as it is called only
once to initialize the m_isExposableThroughAccessibility data member.

No new tests, no behavior change.

* accessibility/AccessibilityARIAGrid.cpp:
(WebCore::AccessibilityARIAGrid::addChildren):
* accessibility/AccessibilityARIAGrid.h:
* accessibility/AccessibilityARIAGridCell.cpp:
(WebCore::AccessibilityARIAGridCell::parentTable):
(WebCore::AccessibilityARIAGridCell::rowIndexRange):
(WebCore::AccessibilityARIAGridCell::columnIndexRange):
* accessibility/AccessibilityARIAGridRow.cpp:
(WebCore::AccessibilityARIAGridRow::disclosedRows):
(WebCore::AccessibilityARIAGridRow::disclosedByRow):
(WebCore::AccessibilityARIAGridRow::parentTable):
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::shouldUseAccessiblityObjectInnerText):
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::isAccessibilityObjectSearchMatchAtIndex):
(WebCore::appendChildrenToArray):
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::isAccessibilityTable): Deleted.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::ariaSelectedRows):
* accessibility/AccessibilityTable.cpp:
(WebCore::AccessibilityTable::AccessibilityTable):
(WebCore::AccessibilityTable::init):
(WebCore::AccessibilityTable::isExposableThroughAccessibility):
(WebCore::AccessibilityTable::computeIsTableExposableThroughAccessibility):
(WebCore::AccessibilityTable::addChildren):
(WebCore::AccessibilityTable::tableLevel):
(WebCore::AccessibilityTable::roleValue):
(WebCore::AccessibilityTable::computeAccessibilityIsIgnored):
(WebCore::AccessibilityTable::title):
(WebCore::AccessibilityTable::isAccessibilityTable): Deleted.
(WebCore::AccessibilityTable::isTableExposableThroughAccessibility): Deleted.
* accessibility/AccessibilityTable.h:
* accessibility/AccessibilityTableCell.cpp:
(WebCore::AccessibilityTableCell::isTableCell):
* accessibility/AccessibilityTableColumn.cpp:
(WebCore::AccessibilityTableColumn::headerObject):
(WebCore::AccessibilityTableColumn::addChildren):
* accessibility/AccessibilityTableHeaderContainer.cpp:
(WebCore::AccessibilityTableHeaderContainer::addChildren):
* accessibility/AccessibilityTableRow.cpp:
(WebCore::AccessibilityTableRow::isTableRow):
(WebCore::AccessibilityTableRow::parentTable):
* accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
(webkitAccessibleGetNChildren):
(webkitAccessibleRefChild):
(webkitAccessibleGetAttributes):
* accessibility/mac/AXObjectCacheMac.mm:
(WebCore::AXObjectCache::postPlatformNotification):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
(-[WebAccessibilityObjectWrapper accessibilityParameterizedAttributeNames]):
(-[WebAccessibilityObjectWrapper accessibilitySetValue:forAttribute:]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175068 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityARIAGrid.cpp
Source/WebCore/accessibility/AccessibilityARIAGrid.h
Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp
Source/WebCore/accessibility/AccessibilityARIAGridRow.cpp
Source/WebCore/accessibility/AccessibilityNodeObject.cpp
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/accessibility/AccessibilityObject.h
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/accessibility/AccessibilityTable.cpp
Source/WebCore/accessibility/AccessibilityTable.h
Source/WebCore/accessibility/AccessibilityTableCell.cpp
Source/WebCore/accessibility/AccessibilityTableColumn.cpp
Source/WebCore/accessibility/AccessibilityTableHeaderContainer.cpp
Source/WebCore/accessibility/AccessibilityTableRow.cpp
Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
Source/WebCore/accessibility/mac/AXObjectCacheMac.mm
Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

index 5c20d86..0c7074a 100644 (file)
@@ -1,5 +1,85 @@
 2014-10-22  Chris Dumez  <cdumez@apple.com>
 
+        Avoid confusion between AccessibilityObject::isTable() / isAccessibilityTable()
+        https://bugs.webkit.org/show_bug.cgi?id=137899
+
+        Reviewed by Darin Adler.
+
+        Avoid confusion between AccessibilityObject::isTable() and
+        isAccessibilityTable(). isTable() is equivalent to
+        is<AccessibilityTable>(), while isAccessibilityTable() is an
+        AccessibilityTable that is exposed as an AccessibilityTable to the
+        platform.
+
+        This patch is renaming isAccessibilityTable() to
+        isExposableThroughAccessibility(), makes it non-virtual and defines it
+        on AccessibilityTable only, for clarity.
+
+        This patch also renames isTableExposableThroughAccessibility() to
+        computeIisTableExposableThroughAccessibility() as it is called only
+        once to initialize the m_isExposableThroughAccessibility data member.
+
+        No new tests, no behavior change.
+
+        * accessibility/AccessibilityARIAGrid.cpp:
+        (WebCore::AccessibilityARIAGrid::addChildren):
+        * accessibility/AccessibilityARIAGrid.h:
+        * accessibility/AccessibilityARIAGridCell.cpp:
+        (WebCore::AccessibilityARIAGridCell::parentTable):
+        (WebCore::AccessibilityARIAGridCell::rowIndexRange):
+        (WebCore::AccessibilityARIAGridCell::columnIndexRange):
+        * accessibility/AccessibilityARIAGridRow.cpp:
+        (WebCore::AccessibilityARIAGridRow::disclosedRows):
+        (WebCore::AccessibilityARIAGridRow::disclosedByRow):
+        (WebCore::AccessibilityARIAGridRow::parentTable):
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::shouldUseAccessiblityObjectInnerText):
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::isAccessibilityObjectSearchMatchAtIndex):
+        (WebCore::appendChildrenToArray):
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::isAccessibilityTable): Deleted.
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::ariaSelectedRows):
+        * accessibility/AccessibilityTable.cpp:
+        (WebCore::AccessibilityTable::AccessibilityTable):
+        (WebCore::AccessibilityTable::init):
+        (WebCore::AccessibilityTable::isExposableThroughAccessibility):
+        (WebCore::AccessibilityTable::computeIsTableExposableThroughAccessibility):
+        (WebCore::AccessibilityTable::addChildren):
+        (WebCore::AccessibilityTable::tableLevel):
+        (WebCore::AccessibilityTable::roleValue):
+        (WebCore::AccessibilityTable::computeAccessibilityIsIgnored):
+        (WebCore::AccessibilityTable::title):
+        (WebCore::AccessibilityTable::isAccessibilityTable): Deleted.
+        (WebCore::AccessibilityTable::isTableExposableThroughAccessibility): Deleted.
+        * accessibility/AccessibilityTable.h:
+        * accessibility/AccessibilityTableCell.cpp:
+        (WebCore::AccessibilityTableCell::isTableCell):
+        * accessibility/AccessibilityTableColumn.cpp:
+        (WebCore::AccessibilityTableColumn::headerObject):
+        (WebCore::AccessibilityTableColumn::addChildren):
+        * accessibility/AccessibilityTableHeaderContainer.cpp:
+        (WebCore::AccessibilityTableHeaderContainer::addChildren):
+        * accessibility/AccessibilityTableRow.cpp:
+        (WebCore::AccessibilityTableRow::isTableRow):
+        (WebCore::AccessibilityTableRow::parentTable):
+        * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
+        (webkitAccessibleGetNChildren):
+        (webkitAccessibleRefChild):
+        (webkitAccessibleGetAttributes):
+        * accessibility/mac/AXObjectCacheMac.mm:
+        (WebCore::AXObjectCache::postPlatformNotification):
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+        (-[WebAccessibilityObjectWrapper accessibilityParameterizedAttributeNames]):
+        (-[WebAccessibilityObjectWrapper accessibilitySetValue:forAttribute:]):
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
+
+2014-10-22  Chris Dumez  <cdumez@apple.com>
+
         Avoid repeated is<MutableStyleProperties>() checks in StyleProperties
         https://bugs.webkit.org/show_bug.cgi?id=137978
 
index 636ce35..9adb81f 100644 (file)
@@ -100,7 +100,7 @@ void AccessibilityARIAGrid::addChildren()
 {
     ASSERT(!m_haveChildren); 
     
-    if (!isAccessibilityTable()) {
+    if (!isExposableThroughAccessibility()) {
         AccessibilityRenderObject::addChildren();
         return;
     }
index d8dc467..03fe400 100644 (file)
@@ -53,7 +53,7 @@ private:
     // ARIA treegrids and grids support selected rows.
     virtual bool supportsSelectedRows() override { return true; }
     virtual bool isMultiSelectable() const override { return true; }
-    virtual bool isTableExposableThroughAccessibility() const override { return true; }
+    virtual bool computeIsTableExposableThroughAccessibility() const override { return true; }
     
     void addRowDescendant(AccessibilityObject*, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount);
     bool addTableCellChild(AccessibilityObject*, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount);
index d1dc939..a52dd24 100644 (file)
@@ -55,14 +55,14 @@ AccessibilityTable* AccessibilityARIAGridCell::parentTable() const
     if (!parent)
         return nullptr;
     
-    if (parent->isAccessibilityTable())
+    if (is<AccessibilityTable>(*parent) && downcast<AccessibilityTable>(*parent).isExposableThroughAccessibility())
         return downcast<AccessibilityTable>(parent);
 
     // It could happen that we hadn't reached the parent table yet (in
     // case objects for rows were not ignoring accessibility) so for
     // that reason we need to run parentObjectUnignored once again.
     parent = parent->parentObjectUnignored();
-    if (!parent || !parent->isAccessibilityTable())
+    if (!(is<AccessibilityTable>(parent) && downcast<AccessibilityTable>(*parent).isExposableThroughAccessibility()))
         return nullptr;
     
     return downcast<AccessibilityTable>(parent);
@@ -77,7 +77,7 @@ void AccessibilityARIAGridCell::rowIndexRange(std::pair<unsigned, unsigned>& row
     if (is<AccessibilityTableRow>(*parent)) {
         // We already got a table row, use its API.
         rowRange.first = downcast<AccessibilityTableRow>(*parent).rowIndex();
-    } else if (parent->isAccessibilityTable()) {
+    } else if (is<AccessibilityTable>(*parent) && downcast<AccessibilityTable>(*parent).isExposableThroughAccessibility()) {
         // We reached the parent table, so we need to inspect its
         // children to determine the row index for the cell in it.
         unsigned columnCount = downcast<AccessibilityTable>(*parent).columnCount();
@@ -104,7 +104,8 @@ void AccessibilityARIAGridCell::columnIndexRange(std::pair<unsigned, unsigned>&
     if (!parent)
         return;
 
-    if (!parent->isTableRow() && !parent->isAccessibilityTable())
+    if (!is<AccessibilityTableRow>(*parent)
+        && !(is<AccessibilityTable>(*parent) && downcast<AccessibilityTable>(*parent).isExposableThroughAccessibility()))
         return;
 
     const AccessibilityChildrenVector& siblings = parent->children();
index 092ca44..b725a17 100644 (file)
@@ -63,7 +63,7 @@ void AccessibilityARIAGridRow::disclosedRows(AccessibilityChildrenVector& disclo
     // The contiguous disclosed rows will be the rows in the table that 
     // have an aria-level of plus 1 from this row.
     AccessibilityObject* parent = parentObjectUnignored();
-    if (!parent || !parent->isAccessibilityTable())
+    if (!is<AccessibilityTable>(*parent) || !downcast<AccessibilityTable>(*parent).isExposableThroughAccessibility())
         return;
     
     // Search for rows that match the correct level. 
@@ -90,7 +90,7 @@ AccessibilityObject* AccessibilityARIAGridRow::disclosedByRow() const
     // The row that discloses this one is the row in the table
     // that is aria-level subtract 1 from this row.
     AccessibilityObject* parent = parentObjectUnignored();
-    if (!parent || !parent->isAccessibilityTable())
+    if (!is<AccessibilityTable>(*parent) || !downcast<AccessibilityTable>(*parent).isExposableThroughAccessibility())
         return nullptr;
     
     // If the level is 1 or less, than nothing discloses this row.
@@ -120,8 +120,11 @@ AccessibilityTable* AccessibilityARIAGridRow::parentTable() const
     // only have "row" elements, but if not, we still should handle it gracefully by finding the right table.
     for (AccessibilityObject* parent = parentObject(); parent; parent = parent->parentObject()) {
         // The parent table for an ARIA grid row should be an ARIA table.
-        if (parent->isAccessibilityTable() && downcast<AccessibilityTable>(*parent).isAriaTable())
-            return downcast<AccessibilityTable>(parent);
+        if (is<AccessibilityTable>(*parent)) {
+            AccessibilityTable& tableParent = downcast<AccessibilityTable>(*parent);
+            if (tableParent.isExposableThroughAccessibility() && tableParent.isAriaTable())
+                return &tableParent;
+        }
     }
     
     return nullptr;
index 07966cf..0d61c31 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "AXObjectCache.h"
 #include "AccessibilityImageMapLink.h"
+#include "AccessibilityList.h"
 #include "AccessibilityListBox.h"
 #include "AccessibilitySpinButton.h"
 #include "AccessibilityTable.h"
@@ -1623,7 +1624,13 @@ static bool shouldUseAccessiblityObjectInnerText(AccessibilityObject* obj, Acces
         return false;
 
     // Skip big container elements like lists, tables, etc.
-    if (obj->isList() || obj->isAccessibilityTable() || obj->isTree() || obj->isCanvas())
+    if (is<AccessibilityList>(*obj))
+        return false;
+
+    if (is<AccessibilityTable>(*obj) && downcast<AccessibilityTable>(*obj).isExposableThroughAccessibility())
+        return false;
+
+    if (obj->isTree() || obj->isCanvas())
         return false;
 
     return true;
index 2baf44a..63af7dd 100644 (file)
@@ -231,11 +231,11 @@ bool AccessibilityObject::isAccessibilityObjectSearchMatchAtIndex(AccessibilityO
         
     case TableSameLevelSearchKey:
         return criteria->startObject
-            && axObject->isAccessibilityTable()
-            && axObject->tableLevel() == criteria->startObject->tableLevel();
+            && is<AccessibilityTable>(*axObject) && downcast<AccessibilityTable>(*axObject).isExposableThroughAccessibility()
+            && downcast<AccessibilityTable>(*axObject).tableLevel() == criteria->startObject->tableLevel();
         
     case TableSearchKey:
-        return axObject->isAccessibilityTable();
+        return is<AccessibilityTable>(*axObject) && downcast<AccessibilityTable>(*axObject).isExposableThroughAccessibility();
         
     case TextFieldSearchKey:
         return axObject->isTextControl();
@@ -502,7 +502,7 @@ static void appendChildrenToArray(AccessibilityObject* object, bool isForward, A
 {
     // A table's children includes elements whose own children are also the table's children (due to the way the Mac exposes tables).
     // The rows from the table should be queried, since those are direct descendants of the table, and they contain content.
-    const auto& searchChildren = object->isAccessibilityTable() ? downcast<AccessibilityTable>(*object).rows() : object->children();
+    const auto& searchChildren = is<AccessibilityTable>(*object) && downcast<AccessibilityTable>(*object).isExposableThroughAccessibility() ? downcast<AccessibilityTable>(*object).rows() : object->children();
 
     size_t childrenSize = searchChildren.size();
 
index 0234bb3..85fe463 100644 (file)
@@ -475,7 +475,6 @@ public:
     virtual bool isControl() const { return false; }
     virtual bool isList() const { return false; }
     virtual bool isTable() const { return false; }
-    virtual bool isAccessibilityTable() const { return false; }
     virtual bool isDataTable() const { return false; }
     virtual bool isTableRow() const { return false; }
     virtual bool isTableColumn() const { return false; }
index aac1d2d..abeecab 100644 (file)
@@ -3144,8 +3144,11 @@ void AccessibilityRenderObject::ariaSelectedRows(AccessibilityChildrenVector& re
         AccessibilityChildrenVector allRows;
         ariaTreeRows(allRows);
         rowsIteration(allRows);
-    } else if (isAccessibilityTable() && downcast<AccessibilityTable>(*this).supportsSelectedRows())
-        rowsIteration(downcast<AccessibilityTable>(*this).rows());
+    } else if (is<AccessibilityTable>(*this)) {
+        auto& thisTable = downcast<AccessibilityTable>(*this);
+        if (thisTable.isExposableThroughAccessibility() && thisTable.supportsSelectedRows())
+            rowsIteration(thisTable.rows());
+    }
 }
     
 void AccessibilityRenderObject::ariaListboxSelectedChildren(AccessibilityChildrenVector& result)
index 0b7be3a..1d5300e 100644 (file)
@@ -51,7 +51,7 @@ using namespace HTMLNames;
 AccessibilityTable::AccessibilityTable(RenderObject* renderer)
     : AccessibilityRenderObject(renderer)
     , m_headerContainer(nullptr)
-    , m_isAccessibilityTable(true)
+    , m_isExposableThroughAccessibility(true)
 {
 }
 
@@ -62,7 +62,7 @@ AccessibilityTable::~AccessibilityTable()
 void AccessibilityTable::init()
 {
     AccessibilityRenderObject::init();
-    m_isAccessibilityTable = isTableExposableThroughAccessibility();
+    m_isExposableThroughAccessibility = computeIsTableExposableThroughAccessibility();
 }
 
 PassRefPtr<AccessibilityTable> AccessibilityTable::create(RenderObject* renderer)
@@ -82,12 +82,12 @@ bool AccessibilityTable::hasARIARole() const
     return false;
 }
 
-bool AccessibilityTable::isAccessibilityTable() const
+bool AccessibilityTable::isExposableThroughAccessibility() const
 {
     if (!m_renderer)
         return false;
     
-    return m_isAccessibilityTable;
+    return m_isExposableThroughAccessibility;
 }
 
 HTMLTableElement* AccessibilityTable::tableElement() const
@@ -309,7 +309,7 @@ bool AccessibilityTable::isDataTable() const
     return false;
 }
     
-bool AccessibilityTable::isTableExposableThroughAccessibility() const
+bool AccessibilityTable::computeIsTableExposableThroughAccessibility() const
 {
     // The following is a heuristic used to determine if a
     // <table> should be exposed as an AXTable. The goal
@@ -347,7 +347,7 @@ void AccessibilityTable::clearChildren()
 
 void AccessibilityTable::addChildren()
 {
-    if (!isAccessibilityTable()) {
+    if (!isExposableThroughAccessibility()) {
         AccessibilityRenderObject::addChildren();
         return;
     }
@@ -525,7 +525,7 @@ int AccessibilityTable::tableLevel() const
 {
     int level = 0;
     for (AccessibilityObject* obj = static_cast<AccessibilityObject*>(const_cast<AccessibilityTable*>(this)); obj; obj = obj->parentObject()) {
-        if (obj->isAccessibilityTable())
+        if (is<AccessibilityTable>(*obj) && downcast<AccessibilityTable>(*obj).isExposableThroughAccessibility())
             ++level;
     }
     
@@ -568,7 +568,7 @@ AccessibilityTableCell* AccessibilityTable::cellForColumnAndRow(unsigned column,
 
 AccessibilityRole AccessibilityTable::roleValue() const
 {
-    if (!isAccessibilityTable())
+    if (!isExposableThroughAccessibility())
         return AccessibilityRenderObject::roleValue();
 
     return TableRole;
@@ -582,7 +582,7 @@ bool AccessibilityTable::computeAccessibilityIsIgnored() const
     if (decision == IgnoreObject)
         return true;
     
-    if (!isAccessibilityTable())
+    if (!isExposableThroughAccessibility())
         return AccessibilityRenderObject::computeAccessibilityIsIgnored();
         
     return false;
@@ -597,7 +597,7 @@ void AccessibilityTable::titleElementText(Vector<AccessibilityText>& textOrder)
 
 String AccessibilityTable::title() const
 {
-    if (!isAccessibilityTable())
+    if (!isExposableThroughAccessibility())
         return AccessibilityRenderObject::title();
     
     String title;
index b026f52..33f64ba 100644 (file)
@@ -60,7 +60,7 @@ public:
     virtual bool supportsSelectedRows() { return false; }
     unsigned columnCount();
     unsigned rowCount();
-    virtual int tableLevel() const override;
+    virtual int tableLevel() const override final;
     
     virtual String title() const override;
     
@@ -75,15 +75,15 @@ public:
     // an object that contains, as children, all the objects that act as headers
     AccessibilityObject* headerContainer();
 
-    // isAccessibilityTable is whether it is exposed as an AccessibilityTable to the platform.
-    virtual bool isAccessibilityTable() const override final;
+    // isExposableThroughAccessibility() is whether it is exposed as an AccessibilityTable to the platform.
+    bool isExposableThroughAccessibility() const;
 
 protected:
     AccessibilityChildrenVector m_rows;
     AccessibilityChildrenVector m_columns;
 
     RefPtr<AccessibilityObject> m_headerContainer;
-    bool m_isAccessibilityTable;
+    bool m_isExposableThroughAccessibility;
 
     bool hasARIARole() const;
 
@@ -92,11 +92,10 @@ protected:
     // isDataTable is whether it is exposed as an AccessibilityTable because the heuristic
     // think this "looks" like a data-based table (instead of a table used for layout).
     virtual bool isDataTable() const override;
-
-    virtual bool isTableExposableThroughAccessibility() const;
     virtual bool computeAccessibilityIsIgnored() const override;
 
 private:
+    virtual bool computeIsTableExposableThroughAccessibility() const;
     virtual void titleElementText(Vector<AccessibilityText>&) const override;
     HTMLTableElement* tableElement() const;
     void addChildrenFromSection(RenderTableSection*, unsigned& maxColumnCount);
index 6837be0..f5d272f 100644 (file)
@@ -100,7 +100,7 @@ bool AccessibilityTableCell::isTableCell() const
     // This used to check if the unignoredParent was a row, but that exploded performance if
     // this was in nested tables. This check should be just as good.
     AccessibilityObject* parentTable = this->parentTable();
-    return parentTable && parentTable->isAccessibilityTable();
+    return is<AccessibilityTable>(parentTable) && downcast<AccessibilityTable>(*parentTable).isExposableThroughAccessibility();
 }
     
 AccessibilityRole AccessibilityTableCell::determineAccessibilityRole()
index b02f9ef..b51eb75 100644 (file)
@@ -75,11 +75,13 @@ AccessibilityObject* AccessibilityTableColumn::headerObject()
     RenderObject* renderer = m_parent->renderer();
     if (!renderer)
         return nullptr;
-    
-    if (!m_parent->isAccessibilityTable())
+    if (!is<AccessibilityTable>(*m_parent))
         return nullptr;
-    
+
     auto& parentTable = downcast<AccessibilityTable>(*m_parent);
+    if (!parentTable.isExposableThroughAccessibility())
+        return nullptr;
+    
     if (parentTable.isAriaTable()) {
         for (const auto& cell : children()) {
             if (cell->ariaRoleAttribute() == ColumnHeaderRole)
@@ -170,10 +172,13 @@ void AccessibilityTableColumn::addChildren()
     ASSERT(!m_haveChildren); 
     
     m_haveChildren = true;
-    if (!m_parent || !m_parent->isAccessibilityTable())
+    if (!is<AccessibilityTable>(m_parent))
+        return;
+
+    auto& parentTable = downcast<AccessibilityTable>(*m_parent);
+    if (!parentTable.isExposableThroughAccessibility())
         return;
     
-    AccessibilityTable& parentTable = downcast<AccessibilityTable>(*m_parent);
     int numRows = parentTable.rowCount();
     
     for (int i = 0; i < numRows; ++i) {
index 083bd98..3d0307f 100644 (file)
@@ -70,10 +70,14 @@ void AccessibilityTableHeaderContainer::addChildren()
     ASSERT(!m_haveChildren); 
     
     m_haveChildren = true;
-    if (!m_parent || !m_parent->isAccessibilityTable())
+    if (!is<AccessibilityTable>(m_parent))
+        return;
+
+    auto& parentTable = downcast<AccessibilityTable>(*m_parent);
+    if (!parentTable.isExposableThroughAccessibility())
         return;
     
-    downcast<AccessibilityTable>(*m_parent).columnHeaders(m_children);
+    parentTable.columnHeaders(m_children);
     
     for (const auto& child : m_children)
         m_headerRect.unite(child->elementRect());
index b1241d1..641a014 100644 (file)
@@ -73,10 +73,7 @@ AccessibilityRole AccessibilityTableRow::determineAccessibilityRole()
 bool AccessibilityTableRow::isTableRow() const
 {
     AccessibilityObject* table = parentTable();
-    if (!table || !table->isAccessibilityTable())
-        return false;
-    
-    return true;
+    return is<AccessibilityTable>(table)  && downcast<AccessibilityTable>(*table).isExposableThroughAccessibility();
 }
     
 AccessibilityObject* AccessibilityTableRow::observableObject() const
@@ -106,8 +103,12 @@ AccessibilityTable* AccessibilityTableRow::parentTable() const
     for (AccessibilityObject* parent = parentObject(); parent; parent = parent->parentObject()) {
         // If this is a table object, but not an accessibility table, we should stop because we don't want to
         // choose another ancestor table as this row's table.
-        if (is<AccessibilityTable>(*parent))
-            return downcast<AccessibilityTable>(*parent).isAccessibilityTable() ? downcast<AccessibilityTable>(parent) : nullptr;
+        if (is<AccessibilityTable>(*parent)) {
+            auto& parentTable = downcast<AccessibilityTable>(*parent);
+            if (parentTable.isExposableThroughAccessibility())
+                return &parentTable;
+            break;
+        }
     }
     
     return nullptr;
index 0846289..0433ce2 100644 (file)
@@ -37,6 +37,7 @@
 #include "AXObjectCache.h"
 #include "AccessibilityList.h"
 #include "AccessibilityListBoxOption.h"
+#include "AccessibilityTable.h"
 #include "Document.h"
 #include "Frame.h"
 #include "FrameView.h"
@@ -355,7 +356,7 @@ static gint webkitAccessibleGetNChildren(AtkObject* object)
 
     // Tables should be treated in a different way because rows should
     // be bypassed when exposing the accessible hierarchy.
-    if (coreObject->isAccessibilityTable())
+    if (is<AccessibilityTable>(*coreObject) && downcast<AccessibilityTable>(*coreObject).isExposableThroughAccessibility())
         return getNChildrenForTable(coreObject);
 
     return coreObject->children().size();
@@ -398,7 +399,7 @@ static AtkObject* webkitAccessibleRefChild(AtkObject* object, gint index)
 
     // Tables are special cases because rows should be bypassed, but
     // still taking their cells into account.
-    if (coreObject->isAccessibilityTable())
+    if (is<AccessibilityTable>(*coreObject) && downcast<AccessibilityTable>(*coreObject).isExposableThroughAccessibility())
         coreChild = getChildForTable(coreObject, index);
     else {
         const AccessibilityObject::AccessibilityChildrenVector& children = coreObject->children();
@@ -520,7 +521,7 @@ static AtkAttributeSet* webkitAccessibleGetAttributes(AtkObject* object)
 
     // Set the 'layout-guess' attribute to help Assistive
     // Technologies know when an exposed table is not data table.
-    if (coreObject->isAccessibilityTable() && !coreObject->isDataTable())
+    if (is<AccessibilityTable>(*coreObject) && downcast<AccessibilityTable>(*coreObject).isExposableThroughAccessibility() && !coreObject->isDataTable())
         attributeSet = addToAtkAttributeSet(attributeSet, "layout-guess", "true");
 
     String placeholder = coreObject->placeholderValue();
index dac1b5c..2c74430 100644 (file)
@@ -29,6 +29,7 @@
 #if HAVE(ACCESSIBILITY)
 
 #import "AccessibilityObject.h"
+#import "AccessibilityTable.h"
 #import "RenderObject.h"
 #import "WebAccessibilityObjectWrapperMac.h"
 #import "WebCoreSystemInterface.h"
@@ -96,7 +97,7 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotific
             macNotification = @"AXInvalidStatusChanged";
             break;
         case AXSelectedChildrenChanged:
-            if (obj->isAccessibilityTable())
+            if (is<AccessibilityTable>(*obj) && downcast<AccessibilityTable>(*obj).isExposableThroughAccessibility())
                 macNotification = NSAccessibilitySelectedRowsChangedNotification;
             else
                 macNotification = NSAccessibilitySelectedChildrenChangedNotification;
index 3f9dbd6..3210b7c 100644 (file)
@@ -1199,7 +1199,7 @@ static id textMarkerRangeFromVisiblePositions(AXObjectCache *cache, VisiblePosit
     if (m_object->supportsARIADropping())
         [additional addObject:NSAccessibilityDropEffectsAttribute];
     
-    if (m_object->isAccessibilityTable() && downcast<AccessibilityTable>(*m_object).supportsSelectedRows())
+    if (is<AccessibilityTable>(*m_object) && downcast<AccessibilityTable>(*m_object).isExposableThroughAccessibility() && downcast<AccessibilityTable>(*m_object).supportsSelectedRows())
         [additional addObject:NSAccessibilitySelectedRowsAttribute];
     
     if (m_object->supportsARIALiveRegion()) {
@@ -1590,7 +1590,7 @@ static id textMarkerRangeFromVisiblePositions(AXObjectCache *cache, VisiblePosit
     else if (m_object->isAnchor() || m_object->isImage() || m_object->isLink())
         objectAttributes = anchorAttrs;
     
-    else if (m_object->isAccessibilityTable())
+    else if (is<AccessibilityTable>(*m_object) && downcast<AccessibilityTable>(*m_object).isExposableThroughAccessibility())
         objectAttributes = tableAttrs;
     else if (m_object->isTableColumn())
         objectAttributes = tableColAttrs;
@@ -2554,7 +2554,7 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         }
     }
     
-    if (m_object->isAccessibilityTable()) {
+    if (is<AccessibilityTable>(*m_object) && downcast<AccessibilityTable>(*m_object).isExposableThroughAccessibility()) {
         auto& table = downcast<AccessibilityTable>(*m_object);
         if ([attributeName isEqualToString:NSAccessibilityRowsAttribute])
             return convertToNSArray(table.rows());
@@ -3128,7 +3128,7 @@ static NSString* roleValueToNSString(AccessibilityRole value)
     if (m_object->isTextControl())
         return textParamAttrs;
     
-    if (m_object->isAccessibilityTable())
+    if (is<AccessibilityTable>(*m_object) && downcast<AccessibilityTable>(*m_object).isExposableThroughAccessibility())
         return tableParamAttrs;
     
     if (m_object->isMenuRelated())
@@ -3314,7 +3314,7 @@ static NSString* roleValueToNSString(AccessibilityRole value)
     else if ([attributeName isEqualToString:NSAccessibilitySelectedRowsAttribute]) {
         AccessibilityObject::AccessibilityChildrenVector selectedRows;
         convertToVector(array, selectedRows);
-        if (m_object->isTree() || m_object->isAccessibilityTable())
+        if (m_object->isTree() || (is<AccessibilityTable>(*m_object) && downcast<AccessibilityTable>(*m_object).isExposableThroughAccessibility()))
             m_object->setSelectedRows(selectedRows);
     } else if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute])
         m_object->setARIAGrabbed([number boolValue]);
@@ -3703,7 +3703,7 @@ static RenderObject* rendererForView(NSView* view)
         return [self textMarkerForVisiblePosition:visiblePosRange.end];
     }
     
-    if (m_object->isAccessibilityTable()) {
+    if (is<AccessibilityTable>(*m_object) && downcast<AccessibilityTable>(*m_object).isExposableThroughAccessibility()) {
         if ([attribute isEqualToString:NSAccessibilityCellForColumnAndRowParameterizedAttribute]) {
             if (array == nil || [array count] != 2)
                 return nil;