[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

cfleizach at apple.com cfleizach at apple.com
Thu Apr 8 00:37:05 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit b33e652ce4d8fa980a0f07dada918020d0110e4f
Author: cfleizach at apple.com <cfleizach at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Dec 15 18:07:26 2009 +0000

    WAI-ARIA: implement treegrid
    https://bugs.webkit.org/show_bug.cgi?id=31299
    
    Reviewed by Darin Adler.
    
    WebCore:
    
    Test: platform/mac/accessibility/aria-treegrid.html
    
    * accessibility/AXObjectCache.cpp:
    (WebCore::AXObjectCache::getOrCreate):
    * accessibility/AccessibilityARIAGrid.h:
    (WebCore::AccessibilityARIAGrid::supportsSelectedRows):
    * accessibility/AccessibilityARIAGridRow.cpp:
    (WebCore::AccessibilityARIAGridRow::isARIATreeGridRow):
    (WebCore::AccessibilityARIAGridRow::disclosedRows):
    (WebCore::AccessibilityARIAGridRow::disclosedByRow):
    * accessibility/AccessibilityARIAGridRow.h:
    * accessibility/AccessibilityObject.cpp:
    (WebCore::createARIARoleMap):
    * accessibility/AccessibilityObject.h:
    (WebCore::):
    (WebCore::AccessibilityObject::isARIATreeGridRow):
    * accessibility/AccessibilityRenderObject.cpp:
    (WebCore::AccessibilityRenderObject::isMultiSelectable):
    (WebCore::AccessibilityRenderObject::setIsExpanded):
    (WebCore::AccessibilityRenderObject::setSelectedRows):
    (WebCore::AccessibilityRenderObject::ariaSelectedRows):
    (WebCore::AccessibilityRenderObject::ariaListboxSelectedChildren):
    (WebCore::AccessibilityRenderObject::selectedChildren):
    * accessibility/AccessibilityRenderObject.h:
    * accessibility/AccessibilityTable.h:
    (WebCore::AccessibilityTable::supportsSelectedRows):
    * accessibility/mac/AccessibilityObjectWrapper.mm:
    (-[AccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
    (-[AccessibilityObjectWrapper accessibilityAttributeNames]):
    (-[AccessibilityObjectWrapper accessibilityAttributeValue:]):
    (-[AccessibilityObjectWrapper accessibilitySetValue:forAttribute:]):
    
    LayoutTests:
    
    * platform/mac-leopard/Skipped:
    * platform/mac/accessibility/aria-treegrid-expected.txt: Added.
    * platform/mac/accessibility/aria-treegrid.html: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52159 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index b92c21a..7397b68 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2009-12-15  Chris Fleizach  <cfleizach at apple.com>
+
+        Reviewed by Darin Adler.
+
+        WAI-ARIA: implement treegrid
+        https://bugs.webkit.org/show_bug.cgi?id=31299
+
+        * platform/mac-leopard/Skipped:
+        * platform/mac/accessibility/aria-treegrid-expected.txt: Added.
+        * platform/mac/accessibility/aria-treegrid.html: Added.
+
 2009-12-15  Eric Seidel  <eric at webkit.org>
 
         No review, rolling out r52140.
diff --git a/LayoutTests/platform/mac-leopard/Skipped b/LayoutTests/platform/mac-leopard/Skipped
index 2bb4933..53e6308 100644
--- a/LayoutTests/platform/mac-leopard/Skipped
+++ b/LayoutTests/platform/mac-leopard/Skipped
@@ -27,6 +27,7 @@ media/media-fullscreen-not-in-document.html
 
 # Tests of accessibility functionality not supported on Leopard
 accessibility/aria-list-and-listitem.html
+platform/mac/accessibility/aria-treegrid.html
 
 # This test requires ogg codecs
 media/media-can-play-ogg.html
diff --git a/LayoutTests/platform/mac/accessibility/aria-treegrid-expected.txt b/LayoutTests/platform/mac/accessibility/aria-treegrid-expected.txt
new file mode 100644
index 0000000..89eb2d2
--- /dev/null
+++ b/LayoutTests/platform/mac/accessibility/aria-treegrid-expected.txt
@@ -0,0 +1,23 @@
+Book Name / ISBN	Author	Price ($)
++ A Question of Love
+978-3-453-40540-0	Nora Roberts	
+9.99
+This tests that the treegrid ARIA role does what it should (be exposed as a AXTable and support AXSelectedRows)
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS treegrid.isAttributeSupported('AXSelectedRows') is true
+PASS treegrid.selectedRowAtIndex(0).isEqual(selectedRow) is true
+PASS selectedRow.isExpanded is false
+PASS selectedRow.hierarchicalLevel is 1
+PASS secondRow.isExpanded is true
+PASS secondRow.hierarchicalLevel is 1
+PASS thirdRow.isExpanded is true
+PASS thirdRow.hierarchicalLevel is 2
+PASS thirdRow.disclosedByRow().isEqual(secondRow) is true
+PASS secondRow.disclosedRowAtIndex(0).isEqual(thirdRow) is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/mac/accessibility/aria-treegrid.html b/LayoutTests/platform/mac/accessibility/aria-treegrid.html
new file mode 100644
index 0000000..476efa3
--- /dev/null
+++ b/LayoutTests/platform/mac/accessibility/aria-treegrid.html
@@ -0,0 +1,66 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+<script>
+var successfullyParsed = false;
+</script>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<table tabindex=0 id="grid-1" role="treegrid" aria-labelledby="grid-1-header" border="1" aria-activedescendant="row1">
+<thead>
+    <tr ca="tr" role="row" aria-level="1" id="row1">
+        <th id="grid-1-isbn_id">Book Name / ISBN</th><th id="grid-1-author_id">Author</th><th id="grid-1-price_id" class="numeric" >Price ($)</th>
+    </tr>
+</thead>
+<tbody>
+    <tr ca="to" role="row" aria-level="1" aria-expanded="true">
+         <td headers="grid-1-title_id" id="table_entry" role="gridcell" colspan="3"  tabindex="0">
+         <span class="expand">+</span> A Question of Love</td>                  
+     </tr>
+     <tr ca="ti" role="row"  aria-level="2" aria-expanded="true">
+         <td headers="grid-1-isbn_id" role="gridcell">978-3-453-40540-0</td>
+         <td headers="grid-1-author_id" role="gridcell">Nora Roberts</td>
+         <td headers="grid-1-price_id" class="numeric" role="gridcell" ca="te"><div>9.99</div></td>
+     </tr>
+</tbody>
+</table>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that the treegrid ARIA role does what it should (be exposed as a AXTable and support AXSelectedRows)");
+
+    if (window.accessibilityController) {
+
+          document.getElementById("grid-1").focus();
+          var treegrid = accessibilityController.focusedElement;
+          var selectedRow = treegrid.childAtIndex(0);
+          shouldBe("treegrid.isAttributeSupported('AXSelectedRows')", "true");
+          shouldBe("treegrid.selectedRowAtIndex(0).isEqual(selectedRow)", "true");
+          shouldBe("selectedRow.isExpanded", "false");
+          shouldBe("selectedRow.hierarchicalLevel", "1");
+
+          var secondRow = treegrid.childAtIndex(1);
+          shouldBe("secondRow.isExpanded", "true");
+          shouldBe("secondRow.hierarchicalLevel", "1");
+
+          var thirdRow = treegrid.childAtIndex(2);
+          shouldBe("thirdRow.isExpanded", "true");
+          shouldBe("thirdRow.hierarchicalLevel", "2");
+
+          // Make sure that the row disclosure works correctly.
+          shouldBe("thirdRow.disclosedByRow().isEqual(secondRow)", "true");
+          shouldBe("secondRow.disclosedRowAtIndex(0).isEqual(thirdRow)", "true");
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src="../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 0be4d05..04b1fb8 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,42 @@
+2009-12-15  Chris Fleizach  <cfleizach at apple.com>
+
+        Reviewed by Darin Adler.
+
+        WAI-ARIA: implement treegrid
+        https://bugs.webkit.org/show_bug.cgi?id=31299
+
+        Test: platform/mac/accessibility/aria-treegrid.html
+
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AXObjectCache::getOrCreate):
+        * accessibility/AccessibilityARIAGrid.h:
+        (WebCore::AccessibilityARIAGrid::supportsSelectedRows):
+        * accessibility/AccessibilityARIAGridRow.cpp:
+        (WebCore::AccessibilityARIAGridRow::isARIATreeGridRow):
+        (WebCore::AccessibilityARIAGridRow::disclosedRows):
+        (WebCore::AccessibilityARIAGridRow::disclosedByRow):
+        * accessibility/AccessibilityARIAGridRow.h:
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::createARIARoleMap):
+        * accessibility/AccessibilityObject.h:
+        (WebCore::):
+        (WebCore::AccessibilityObject::isARIATreeGridRow):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::isMultiSelectable):
+        (WebCore::AccessibilityRenderObject::setIsExpanded):
+        (WebCore::AccessibilityRenderObject::setSelectedRows):
+        (WebCore::AccessibilityRenderObject::ariaSelectedRows):
+        (WebCore::AccessibilityRenderObject::ariaListboxSelectedChildren):
+        (WebCore::AccessibilityRenderObject::selectedChildren):
+        * accessibility/AccessibilityRenderObject.h:
+        * accessibility/AccessibilityTable.h:
+        (WebCore::AccessibilityTable::supportsSelectedRows):
+        * accessibility/mac/AccessibilityObjectWrapper.mm:
+        (-[AccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
+        (-[AccessibilityObjectWrapper accessibilityAttributeNames]):
+        (-[AccessibilityObjectWrapper accessibilityAttributeValue:]):
+        (-[AccessibilityObjectWrapper accessibilitySetValue:forAttribute:]):
+
 2009-12-15  Zoltan Horvath  <zoltan at webkit.org>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/accessibility/AXObjectCache.cpp b/WebCore/accessibility/AXObjectCache.cpp
index 6ec325a..e46fc41 100644
--- a/WebCore/accessibility/AXObjectCache.cpp
+++ b/WebCore/accessibility/AXObjectCache.cpp
@@ -148,7 +148,7 @@ AccessibilityObject* AXObjectCache::getOrCreate(RenderObject* renderer)
             newObj = AccessibilityList::create(renderer);
         
         // aria tables
-        else if (nodeIsAriaType(node, "grid"))
+        else if (nodeIsAriaType(node, "grid") || nodeIsAriaType(node, "treegrid"))
             newObj = AccessibilityARIAGrid::create(renderer);
         else if (nodeIsAriaType(node, "row"))
             newObj = AccessibilityARIAGridRow::create(renderer);
diff --git a/WebCore/accessibility/AccessibilityARIAGrid.h b/WebCore/accessibility/AccessibilityARIAGrid.h
index 32c8ce9..3511f0f 100644
--- a/WebCore/accessibility/AccessibilityARIAGrid.h
+++ b/WebCore/accessibility/AccessibilityARIAGrid.h
@@ -52,6 +52,9 @@ public:
     virtual AccessibilityTableCell* cellForColumnAndRow(unsigned column, unsigned row);
 
 private:
+    // ARIA treegrids and grids support selected rows.
+    virtual bool supportsSelectedRows() { return true; }    
+
     void addChild(AccessibilityObject* object, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount);
 };
 
diff --git a/WebCore/accessibility/AccessibilityARIAGridRow.cpp b/WebCore/accessibility/AccessibilityARIAGridRow.cpp
index 6e1f1c8..7d562d9 100644
--- a/WebCore/accessibility/AccessibilityARIAGridRow.cpp
+++ b/WebCore/accessibility/AccessibilityARIAGridRow.cpp
@@ -30,6 +30,7 @@
 #include "AccessibilityARIAGridRow.h"
 
 #include "AccessibilityObject.h"
+#include "AccessibilityTable.h"
 #include "RenderObject.h"
 
 using namespace std;
@@ -50,6 +51,71 @@ PassRefPtr<AccessibilityARIAGridRow> AccessibilityARIAGridRow::create(RenderObje
     return adoptRef(new AccessibilityARIAGridRow(renderer));
 }
 
+bool AccessibilityARIAGridRow::isARIATreeGridRow() const
+{
+    AccessibilityObject* parent = parentTable();
+    if (!parent)
+        return false;
+    
+    return parent->ariaRoleAttribute() == TreeGridRole;
+}
+    
+void AccessibilityARIAGridRow::disclosedRows(AccessibilityChildrenVector& disclosedRows)
+{
+    // 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->isDataTable())
+        return;
+    
+    // Search for rows that match the correct level. 
+    // Only take the subsequent rows from this one that are +1 from this row's level.
+    int index = rowIndex();
+    if (index < 0)
+        return;
+    
+    unsigned level = hierarchicalLevel();
+    AccessibilityChildrenVector& allRows = static_cast<AccessibilityTable*>(parent)->rows();
+    int rowCount = allRows.size();
+    for (int k = index + 1; k < rowCount; ++k) {
+        AccessibilityObject* row = allRows[k].get();
+        // Stop at the first row that doesn't match the correct level.
+        if (row->hierarchicalLevel() != level + 1)
+            break;
+
+        disclosedRows.append(row);
+    }
+}
+    
+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->isDataTable())
+        return 0;
+    
+    // If the level is 1 or less, than nothing discloses this row.
+    unsigned level = hierarchicalLevel();
+    if (level <= 1)
+        return 0;
+    
+    // Search for the previous row that matches the correct level.
+    int index = rowIndex();
+    AccessibilityChildrenVector& allRows = static_cast<AccessibilityTable*>(parent)->rows();
+    int rowCount = allRows.size();
+    if (index >= rowCount)
+        return 0;
+    
+    for (int k = index - 1; k >= 0; --k) {
+        AccessibilityObject* row = allRows[k].get();
+        if (row->hierarchicalLevel() == level - 1)
+            return row;
+    }
+    
+    return 0;
+}
+    
 AccessibilityObject* AccessibilityARIAGridRow::parentTable() const
 {
     AccessibilityObject* parent = parentObjectUnignored();
diff --git a/WebCore/accessibility/AccessibilityARIAGridRow.h b/WebCore/accessibility/AccessibilityARIAGridRow.h
index c2ca8b8..f89ea92 100644
--- a/WebCore/accessibility/AccessibilityARIAGridRow.h
+++ b/WebCore/accessibility/AccessibilityARIAGridRow.h
@@ -41,8 +41,14 @@ public:
     static PassRefPtr<AccessibilityARIAGridRow> create(RenderObject*);
     virtual ~AccessibilityARIAGridRow();
     
+    void disclosedRows(AccessibilityChildrenVector&);
+    AccessibilityObject* disclosedByRow() const;
+    
     virtual AccessibilityObject* headerObject();
     virtual AccessibilityObject* parentTable() const;    
+    
+private:
+    virtual bool isARIATreeGridRow() const;
 }; 
     
 } // namespace WebCore 
diff --git a/WebCore/accessibility/AccessibilityObject.cpp b/WebCore/accessibility/AccessibilityObject.cpp
index 585e4cb..ce91026 100644
--- a/WebCore/accessibility/AccessibilityObject.cpp
+++ b/WebCore/accessibility/AccessibilityObject.cpp
@@ -912,6 +912,7 @@ static ARIARoleMap* createARIARoleMap()
         { "toolbar", ToolbarRole },
         { "tooltip", UserInterfaceTooltipRole },
         { "tree", TreeRole },
+        { "treegrid", TreeGridRole },
         { "treeitem", TreeItemRole }
     };
     ARIARoleMap* roleMap = new ARIARoleMap;
diff --git a/WebCore/accessibility/AccessibilityObject.h b/WebCore/accessibility/AccessibilityObject.h
index 8e46311..79bb5c3 100644
--- a/WebCore/accessibility/AccessibilityObject.h
+++ b/WebCore/accessibility/AccessibilityObject.h
@@ -165,6 +165,7 @@ enum AccessibilityRole {
     TabListRole,
     TabPanelRole,
     TreeRole,
+    TreeGridRole,
     TreeItemRole,
     DirectoryRole,
     
@@ -279,6 +280,7 @@ public:
     virtual bool isTableCell() const { return false; }
     virtual bool isFieldset() const { return false; }
     virtual bool isGroup() const { return false; }
+    virtual bool isARIATreeGridRow() const { return false; }
     bool isTabList() const { return roleValue() == TabListRole; }
     bool isTabItem() const { return roleValue() == TabRole; }
     bool isRadioGroup() const { return roleValue() == RadioGroupRole; }
diff --git a/WebCore/accessibility/AccessibilityRenderObject.cpp b/WebCore/accessibility/AccessibilityRenderObject.cpp
index a235b92..ce5761c 100644
--- a/WebCore/accessibility/AccessibilityRenderObject.cpp
+++ b/WebCore/accessibility/AccessibilityRenderObject.cpp
@@ -375,9 +375,16 @@ bool AccessibilityRenderObject::isHovered() const
     return m_renderer->node() && m_renderer->node()->hovered();
 }
 
-bool AccessibilityRenderObject::isMultiSelect() const
+bool AccessibilityRenderObject::isMultiSelectable() const
 {
     ASSERT(m_renderer);
+    
+    const AtomicString& ariaMultiSelectable = getAttribute(aria_multiselectableAttr);
+    if (equalIgnoringCase(ariaMultiSelectable, "true"))
+        return true;
+    if (equalIgnoringCase(ariaMultiSelectable, "false"))
+        return false;
+    
     if (!m_renderer->isListBox())
         return false;
     return m_renderer->node() && static_cast<HTMLSelectElement*>(m_renderer->node())->multiple();
@@ -1753,13 +1760,18 @@ bool AccessibilityRenderObject::elementAttributeValue(const QualifiedName& attri
     
 void AccessibilityRenderObject::setIsExpanded(bool isExpanded)
 {
-    // Combo boxes and tree items can be expanded (in different ways on different platforms).
+    // Combo boxes, tree items and rows can be expanded (in different ways on different platforms).
     // That action translates into setting the aria-expanded attribute to true.
     AccessibilityRole role = roleValue();
-    if (role != ComboBoxRole && role != TreeItemRole)
-        return;
-    
-    setElementAttributeValue(aria_expandedAttr, isExpanded);
+    switch (role) {
+    case ComboBoxRole:
+    case TreeItemRole:
+    case RowRole:
+        setElementAttributeValue(aria_expandedAttr, isExpanded);
+        break;
+    default:
+        break;
+    }
 }
     
 bool AccessibilityRenderObject::isRequired() const
@@ -1884,13 +1896,14 @@ void AccessibilityRenderObject::setSelected(bool enabled)
 
 void AccessibilityRenderObject::setSelectedRows(AccessibilityChildrenVector& selectedRows)
 {
-    // Setting selected rows only works on trees for now.
-    if (roleValue() != TreeRole)
+    // Setting selected only makes sense in trees and tables (and tree-tables).
+    AccessibilityRole role = roleValue();
+    if (role != TreeRole && role != TreeGridRole && role != TableRole)
         return;
     
-    bool isMultiselectable = elementAttributeValue(aria_multiselectableAttr);
+    bool isMulti = isMultiSelectable();
     unsigned count = selectedRows.size();
-    if (count > 1 && !isMultiselectable)
+    if (count > 1 && !isMulti)
         count = 1;
     
     for (unsigned k = 0; k < count; ++k)
@@ -2860,20 +2873,20 @@ void AccessibilityRenderObject::addChildren()
     }
 }
 
-void AccessibilityRenderObject::ariaTreeSelectedRows(AccessibilityChildrenVector& result)
+void AccessibilityRenderObject::ariaSelectedRows(AccessibilityChildrenVector& result)
 {
     // Get all the rows. 
     AccessibilityChildrenVector allRows;
     ariaTreeRows(allRows);
 
     // Determine which rows are selected.
-    bool isMultiselectable = elementAttributeValue(aria_multiselectableAttr);
+    bool isMulti = isMultiSelectable();
 
     // Prefer active descendant over aria-selected.
     AccessibilityObject* activeDesc = activeDescendant();
-    if (activeDesc && activeDesc->isTreeItem()) {
+    if (activeDesc && (activeDesc->isTreeItem() || activeDesc->isTableRow())) {
         result.append(activeDesc);    
-        if (!isMultiselectable)
+        if (!isMulti)
             return;
     }
 
@@ -2881,7 +2894,7 @@ void AccessibilityRenderObject::ariaTreeSelectedRows(AccessibilityChildrenVector
     for (unsigned k = 0; k < count; ++k) {
         if (allRows[k]->isSelected()) {
             result.append(allRows[k]);
-            if (!isMultiselectable)
+            if (!isMulti)
                 break;
         }
     }
@@ -2895,7 +2908,7 @@ void AccessibilityRenderObject::ariaListboxSelectedChildren(AccessibilityChildre
     if (!element || !element->isElementNode()) // do this check to ensure safety of static_cast above
         return;
 
-    bool isMultiselectable = elementAttributeValue(aria_multiselectableAttr);
+    bool isMulti = isMultiSelectable();
     
     while (child) {
         // every child should have aria-role option, and if so, check for selected attribute/state
@@ -2909,7 +2922,7 @@ void AccessibilityRenderObject::ariaListboxSelectedChildren(AccessibilityChildre
                 String selectedAttrString = childElement->getAttribute(aria_selectedAttr).string();
                 if (equalIgnoringCase(selectedAttrString, "true")) {
                     result.append(child);
-                    if (isMultiselectable)
+                    if (isMulti)
                         return;
                 }
             }
@@ -2926,8 +2939,8 @@ void AccessibilityRenderObject::selectedChildren(AccessibilityChildrenVector& re
     AccessibilityRole role = roleValue();
     if (role == ListBoxRole) // native list boxes would be AccessibilityListBoxes, so only check for aria list boxes
         ariaListboxSelectedChildren(result);
-    else if (role == TreeRole)
-        ariaTreeSelectedRows(result);
+    else if (role == TreeRole || role == TreeGridRole || role == TableRole)
+        ariaSelectedRows(result);
 }
 
 void AccessibilityRenderObject::ariaListboxVisibleChildren(AccessibilityChildrenVector& result)      
diff --git a/WebCore/accessibility/AccessibilityRenderObject.h b/WebCore/accessibility/AccessibilityRenderObject.h
index 58aa557..85592d7 100644
--- a/WebCore/accessibility/AccessibilityRenderObject.h
+++ b/WebCore/accessibility/AccessibilityRenderObject.h
@@ -96,7 +96,7 @@ public:
     virtual bool isHovered() const;
     virtual bool isIndeterminate() const;
     virtual bool isLoaded() const;
-    virtual bool isMultiSelect() const;
+    virtual bool isMultiSelectable() const;
     virtual bool isOffScreen() const;
     virtual bool isPressed() const;
     virtual bool isReadOnly() const;
@@ -280,7 +280,7 @@ private:
     AccessibilityObject* accessibilityImageMapHitTest(HTMLAreaElement*, const IntPoint&) const;
     AccessibilityObject* accessibilityParentForImageMap(HTMLMapElement* map) const;
 
-    void ariaTreeSelectedRows(AccessibilityChildrenVector&);
+    void ariaSelectedRows(AccessibilityChildrenVector&);
     
     bool elementAttributeValue(const QualifiedName&);
     void setElementAttributeValue(const QualifiedName&, bool);
diff --git a/WebCore/accessibility/AccessibilityTable.h b/WebCore/accessibility/AccessibilityTable.h
index b6aa3ca..42edf2a 100644
--- a/WebCore/accessibility/AccessibilityTable.h
+++ b/WebCore/accessibility/AccessibilityTable.h
@@ -63,6 +63,7 @@ public:
     AccessibilityChildrenVector& columns();
     AccessibilityChildrenVector& rows();
     
+    virtual bool supportsSelectedRows() { return false; }
     unsigned columnCount();
     unsigned rowCount();
     
diff --git a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
index 6099b3d..db429d9 100644
--- a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
+++ b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
@@ -32,6 +32,7 @@
 #if HAVE(ACCESSIBILITY)
 
 #import "AXObjectCache.h"
+#import "AccessibilityARIAGridRow.h"
 #import "AccessibilityListBox.h"
 #import "AccessibilityList.h"
 #import "AccessibilityRenderObject.h"
@@ -599,6 +600,9 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(VisiblePositi
     if (m_object->supportsARIADropping())
         [additional addObject:NSAccessibilityDropEffectsAttribute];
 
+    if (m_object->isDataTable() && static_cast<AccessibilityTable*>(m_object)->supportsSelectedRows())
+        [additional addObject:NSAccessibilitySelectedRowsAttribute];        
+    
     return additional;
 }
 
@@ -863,7 +867,6 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(VisiblePositi
     }
     if (outlineRowAttrs == nil) {
         tempArray = [[NSMutableArray alloc] initWithArray:tableRowAttrs];
-        [tempArray addObject:NSAccessibilityIndexAttribute];
         [tempArray addObject:NSAccessibilityDisclosingAttribute];
         [tempArray addObject:NSAccessibilityDisclosedByRowAttribute];
         [tempArray addObject:NSAccessibilityDisclosureLevelAttribute];
@@ -888,12 +891,17 @@ static WebCoreTextMarkerRange* textMarkerRangeFromVisiblePositions(VisiblePositi
 
     else if (m_object->isDataTable())
         objectAttributes = tableAttrs;
-    else if (m_object->isTableRow())
-        objectAttributes = tableRowAttrs;
     else if (m_object->isTableColumn())
         objectAttributes = tableColAttrs;
     else if (m_object->isTableCell())
         objectAttributes = tableCellAttrs;
+    else if (m_object->isTableRow()) {
+        // An ARIA table row can be collapsed and expanded, so it needs the extra attributes.
+        if (m_object->isARIATreeGridRow())
+            objectAttributes = outlineRowAttrs;
+        else
+            objectAttributes = tableRowAttrs;
+    }
     
     else if (m_object->isTree())
         objectAttributes = outlineAttrs;
@@ -1568,9 +1576,14 @@ static NSString* roleValueToNSString(AccessibilityRole value)
             return convertToNSArray(static_cast<AccessibilityTable*>(m_object)->columns());
         }
         
+        if ([attributeName isEqualToString:NSAccessibilitySelectedRowsAttribute]) {
+            AccessibilityObject::AccessibilityChildrenVector selectedChildrenCopy;
+            m_object->selectedChildren(selectedChildrenCopy);
+            return convertToNSArray(selectedChildrenCopy);
+        }
+        
         // HTML tables don't support these
         if ([attributeName isEqualToString:NSAccessibilitySelectedColumnsAttribute] || 
-            [attributeName isEqualToString:NSAccessibilitySelectedRowsAttribute] ||
             [attributeName isEqualToString:NSAccessibilitySelectedCellsAttribute])
             return nil;
         
@@ -1600,11 +1613,6 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         }        
     }
     
-    if (m_object->isTableRow()) {
-        if ([attributeName isEqualToString:NSAccessibilityIndexAttribute])
-            return [NSNumber numberWithInt:static_cast<AccessibilityTableRow*>(m_object)->rowIndex()];
-    }
-    
     if (m_object->isTableColumn()) {
         if ([attributeName isEqualToString:NSAccessibilityIndexAttribute])
             return [NSNumber numberWithInt:static_cast<AccessibilityTableColumn*>(m_object)->columnIndex()];
@@ -1652,8 +1660,8 @@ static NSString* roleValueToNSString(AccessibilityRole value)
             return [NSArray array];
     }
 
-    if (m_object->isTreeItem()) {
-        if ([attributeName isEqualToString:NSAccessibilityIndexAttribute]) {
+    if ([attributeName isEqualToString:NSAccessibilityIndexAttribute]) {
+        if (m_object->isTreeItem()) {
             AccessibilityObject* parent = m_object->parentObject();
             for (; parent && !parent->isTree(); parent = parent->parentObject())
             { }
@@ -1671,16 +1679,28 @@ static NSString* roleValueToNSString(AccessibilityRole value)
             
             return nil;
         }
-        
-        // The rows that are considered inside this row. 
-        if ([attributeName isEqualToString:NSAccessibilityDisclosedRowsAttribute]) {
+        if (m_object->isTableRow()) {
+            if ([attributeName isEqualToString:NSAccessibilityIndexAttribute])
+                return [NSNumber numberWithInt:static_cast<AccessibilityTableRow*>(m_object)->rowIndex()];
+        }
+    }    
+    
+    // The rows that are considered inside this row. 
+    if ([attributeName isEqualToString:NSAccessibilityDisclosedRowsAttribute]) {
+        if (m_object->isTreeItem()) {
             AccessibilityObject::AccessibilityChildrenVector rowsCopy;
             m_object->ariaTreeItemDisclosedRows(rowsCopy);
             return convertToNSArray(rowsCopy);    
+        } else if (m_object->isARIATreeGridRow()) {
+            AccessibilityObject::AccessibilityChildrenVector rowsCopy;
+            static_cast<AccessibilityARIAGridRow*>(m_object)->disclosedRows(rowsCopy);
+            return convertToNSArray(rowsCopy);    
         }
-
-        // The row that contains this row. It should be the same as the first parent that is a treeitem.
-        if ([attributeName isEqualToString:NSAccessibilityDisclosedByRowAttribute]) {
+    }
+    
+    // The row that contains this row. It should be the same as the first parent that is a treeitem.
+    if ([attributeName isEqualToString:NSAccessibilityDisclosedByRowAttribute]) {
+        if (m_object->isTreeItem()) {
             AccessibilityObject* parent = m_object->parentObject();
             while (parent) {
                 if (parent->isTreeItem())
@@ -1691,12 +1711,18 @@ static NSString* roleValueToNSString(AccessibilityRole value)
                 parent = parent->parentObject();
             }
             return nil;
+        } else if (m_object->isARIATreeGridRow()) {
+            AccessibilityObject* row = static_cast<AccessibilityARIAGridRow*>(m_object)->disclosedByRow();
+            if (!row)
+                return nil;
+            return row->wrapper();
         }
-        if ([attributeName isEqualToString:NSAccessibilityDisclosureLevelAttribute])
-            return [NSNumber numberWithInt:m_object->hierarchicalLevel()];
-        if ([attributeName isEqualToString:NSAccessibilityDisclosingAttribute])
-            return [NSNumber numberWithBool:m_object->isExpanded()];
     }
+
+    if ([attributeName isEqualToString:NSAccessibilityDisclosureLevelAttribute])
+        return [NSNumber numberWithInt:m_object->hierarchicalLevel()];
+    if ([attributeName isEqualToString:NSAccessibilityDisclosingAttribute])
+        return [NSNumber numberWithBool:m_object->isExpanded()];
     
     if ((m_object->isListBox() || m_object->isList()) && [attributeName isEqualToString:NSAccessibilityOrientationAttribute])
         return NSAccessibilityVerticalOrientationValue;
@@ -2153,7 +2179,7 @@ static NSString* roleValueToNSString(AccessibilityRole value)
     else if ([attributeName isEqualToString:NSAccessibilitySelectedRowsAttribute]) {
         AccessibilityObject::AccessibilityChildrenVector selectedRows;
         convertToVector(array, selectedRows);
-        if (m_object->isTree())
+        if (m_object->isTree() || m_object->isDataTable())
             m_object->setSelectedRows(selectedRows);
     } else if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute])
         m_object->setARIAGrabbed([number boolValue]);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list