[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 02:06:01 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit e4893cbb04bff8c66a12eaefdfa9bb4a7e87128a
Author: cfleizach at apple.com <cfleizach at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Mar 2 01:19:25 2010 +0000

    AX: changes to WAI-ARIA grid aren't perceived correctly by VoiceOver
    https://bugs.webkit.org/show_bug.cgi?id=35514
    
    Reviewed by Darin Adler.
    
    WebCore:
    
    When a table's DOM is changed and an AX Table is not asked first for its children,
    it would return wrong information. A table needs to make sure children are up to date in
    all methods that can be called from the outside.
    
    Test: platform/mac/accessibility/stale-table-rows.html
    
    * accessibility/AccessibilityARIAGrid.cpp:
    (WebCore::AccessibilityARIAGrid::cellForColumnAndRow):
    * accessibility/AccessibilityObject.cpp:
    (WebCore::AccessibilityObject::clearChildren):
    * accessibility/AccessibilityRenderObject.cpp:
    (WebCore::AccessibilityRenderObject::clearChildren):
    (WebCore::AccessibilityRenderObject::updateChildrenIfNecessary):
    (WebCore::AccessibilityRenderObject::children):
    * accessibility/AccessibilityRenderObject.h:
    (WebCore::AccessibilityRenderObject::needsToUpdateChildren):
    (WebCore::AccessibilityRenderObject::setNeedsToUpdateChildren):
    * accessibility/AccessibilityTable.cpp:
    (WebCore::AccessibilityTable::clearChildren):
    (WebCore::AccessibilityTable::columns):
    (WebCore::AccessibilityTable::rows):
    (WebCore::AccessibilityTable::rowHeaders):
    (WebCore::AccessibilityTable::columnHeaders):
    (WebCore::AccessibilityTable::cells):
    (WebCore::AccessibilityTable::columnCount):
    (WebCore::AccessibilityTable::rowCount):
    (WebCore::AccessibilityTable::cellForColumnAndRow):
    
    WebKitTools:
    
    Add rowCount, columnCount for tables.
    
    * DumpRenderTree/AccessibilityUIElement.cpp:
    (rowCountCallback):
    (columnCountCallback):
    (AccessibilityUIElement::getJSClass):
    * DumpRenderTree/AccessibilityUIElement.h:
    * DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:
    (AccessibilityUIElement::rowCount):
    (AccessibilityUIElement::columnCount):
    * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
    (AccessibilityUIElement::rowCount):
    (AccessibilityUIElement::columnCount):
    * DumpRenderTree/win/AccessibilityUIElementWin.cpp:
    (AccessibilityUIElement::rowCount):
    (AccessibilityUIElement::columnCount):
    
    LayoutTests:
    
    * platform/mac/accessibility/stale-table-rows-expected.txt: Added.
    * platform/mac/accessibility/stale-table-rows.html: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55390 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index a6e1f68..0af5e9b 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-03-01  Chris Fleizach  <cfleizach at apple.com>
+
+        Reviewed by Darin Adler.
+
+        AX: changes to WAI-ARIA grid aren't perceived correctly by VoiceOver
+        https://bugs.webkit.org/show_bug.cgi?id=35514
+
+        * platform/mac/accessibility/stale-table-rows-expected.txt: Added.
+        * platform/mac/accessibility/stale-table-rows.html: Added.
+
 2010-03-01  José Millán Soto  <jmillan at igalia.com>
 
         Reviewed by Gustavo Noronha Silva.
diff --git a/LayoutTests/platform/mac/accessibility/stale-table-rows-expected.txt b/LayoutTests/platform/mac/accessibility/stale-table-rows-expected.txt
new file mode 100644
index 0000000..4c8e9a3
--- /dev/null
+++ b/LayoutTests/platform/mac/accessibility/stale-table-rows-expected.txt
@@ -0,0 +1,12 @@
+A B C
+This tests that when a table has its DOM changed, all the table method still return the correct data.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS rows is grid.rowCount
+PASS columns is grid.columnCount
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/mac/accessibility/stale-table-rows.html b/LayoutTests/platform/mac/accessibility/stale-table-rows.html
new file mode 100644
index 0000000..5fc8f6a
--- /dev/null
+++ b/LayoutTests/platform/mac/accessibility/stale-table-rows.html
@@ -0,0 +1,84 @@
+<!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 type="text/javascript" charset="utf-8">
+    
+var choices = ['foo', 'bar', 'baz', 'baf', 'bop', 'bip'];
+    
+function $(id){
+   return document.getElementById(id);
+}
+function node(tagName, role){
+    var el = document.createElement(tagName);
+    el.setAttribute('role', role);
+    return el;
+}
+
+function randomize(){
+
+    var d = $('myData');
+    d.innerHTML = ''; // clear it out first
+    for (var i=0; i<3; i++){
+        var row = node('tr', 'row');
+        d.appendChild(row);
+        for (var j=0; j<3; j++){
+            var cell = node('tr', 'gridcell');
+            cell.innerHTML = choices[Math.floor(Math.random()*choices.length)]; // populate cell with a random entry from 'choices' array: 'foo', 'bar', 'baz', etc.
+            row.appendChild(cell);
+        }
+    }
+}
+
+</script>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<div role="grid" tabindex=0 id="grid1">
+  <div role="rowgroup">
+    <div role="row">
+    <span role="columnheader">A</span>
+    <span role="columnheader">B</span>
+    <span role="columnheader">C</span>
+  </div>
+</div>
+<div role="rowgroup" id="myData"><!-- to be populated by script --></div>
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that when a table has its DOM changed, all the table method still return the correct data.");
+
+    if (window.accessibilityController) {
+
+          randomize();
+          
+          document.getElementById("grid1").focus();
+          var grid = accessibilityController.focusedElement;
+          var rows = grid.rowCount;
+          var columns = grid.columnCount;
+          randomize();
+
+          // this used to crash in debug mode.
+          shouldBe("rows", "grid.rowCount");
+          shouldBe("columns", "grid.columnCount");
+
+          // clear out the data so that we get the same end results for our layout test.
+          var d = $('myData');
+          d.innerHTML = '';
+
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src="../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f6a6e9a..350bbed 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,38 @@
+2010-03-01  Chris Fleizach  <cfleizach at apple.com>
+
+        Reviewed by Darin Adler.
+
+        AX: changes to WAI-ARIA grid aren't perceived correctly by VoiceOver
+        https://bugs.webkit.org/show_bug.cgi?id=35514
+
+        When a table's DOM is changed and an AX Table is not asked first for its children,
+        it would return wrong information. A table needs to make sure children are up to date in
+        all methods that can be called from the outside.
+
+        Test: platform/mac/accessibility/stale-table-rows.html
+
+        * accessibility/AccessibilityARIAGrid.cpp:
+        (WebCore::AccessibilityARIAGrid::cellForColumnAndRow):
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::clearChildren):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::clearChildren):
+        (WebCore::AccessibilityRenderObject::updateChildrenIfNecessary):
+        (WebCore::AccessibilityRenderObject::children):
+        * accessibility/AccessibilityRenderObject.h:
+        (WebCore::AccessibilityRenderObject::needsToUpdateChildren):
+        (WebCore::AccessibilityRenderObject::setNeedsToUpdateChildren):
+        * accessibility/AccessibilityTable.cpp:
+        (WebCore::AccessibilityTable::clearChildren):
+        (WebCore::AccessibilityTable::columns):
+        (WebCore::AccessibilityTable::rows):
+        (WebCore::AccessibilityTable::rowHeaders):
+        (WebCore::AccessibilityTable::columnHeaders):
+        (WebCore::AccessibilityTable::cells):
+        (WebCore::AccessibilityTable::columnCount):
+        (WebCore::AccessibilityTable::rowCount):
+        (WebCore::AccessibilityTable::cellForColumnAndRow):
+
 2010-03-01  Jakob Petsovits  <jpetsovits at rim.com>
 
         Reviewed by Adam Barth.
diff --git a/WebCore/accessibility/AccessibilityARIAGrid.cpp b/WebCore/accessibility/AccessibilityARIAGrid.cpp
index a0cf77a..58b3fa1 100644
--- a/WebCore/accessibility/AccessibilityARIAGrid.cpp
+++ b/WebCore/accessibility/AccessibilityARIAGrid.cpp
@@ -131,8 +131,7 @@ AccessibilityTableCell* AccessibilityARIAGrid::cellForColumnAndRow(unsigned colu
     if (!m_renderer)
         return 0;
     
-    if (!hasChildren())
-        addChildren();
+    updateChildrenIfNecessary();
     
     if (column >= columnCount() || row >= rowCount())
         return 0;
diff --git a/WebCore/accessibility/AccessibilityObject.cpp b/WebCore/accessibility/AccessibilityObject.cpp
index 7c616ea..70750da 100644
--- a/WebCore/accessibility/AccessibilityObject.cpp
+++ b/WebCore/accessibility/AccessibilityObject.cpp
@@ -731,8 +731,8 @@ FrameView* AccessibilityObject::documentFrameView() const
 
 void AccessibilityObject::clearChildren()
 {
-    m_haveChildren = false;
     m_children.clear();
+    m_haveChildren = false;
 }
 
 AccessibilityObject* AccessibilityObject::anchorElementForNode(Node* node)
diff --git a/WebCore/accessibility/AccessibilityRenderObject.cpp b/WebCore/accessibility/AccessibilityRenderObject.cpp
index 25a13a8..aaa28ae 100644
--- a/WebCore/accessibility/AccessibilityRenderObject.cpp
+++ b/WebCore/accessibility/AccessibilityRenderObject.cpp
@@ -2898,15 +2898,25 @@ bool AccessibilityRenderObject::canHaveChildren() const
     }
 }
 
-const AccessibilityObject::AccessibilityChildrenVector& AccessibilityRenderObject::children()
+void AccessibilityRenderObject::clearChildren()
+{
+    AccessibilityObject::clearChildren();
+    m_childrenDirty = false;
+}
+    
+void AccessibilityRenderObject::updateChildrenIfNecessary()
 {
-    if (m_childrenDirty) {
+    if (needsToUpdateChildren())
         clearChildren();        
-        m_childrenDirty = false;
-    }
     
-    if (!m_haveChildren)
-        addChildren();
+    if (!hasChildren())
+        addChildren();    
+}
+    
+const AccessibilityObject::AccessibilityChildrenVector& AccessibilityRenderObject::children()
+{
+    updateChildrenIfNecessary();
+    
     return m_children;
 }
 
diff --git a/WebCore/accessibility/AccessibilityRenderObject.h b/WebCore/accessibility/AccessibilityRenderObject.h
index 6735076..f76ba2a 100644
--- a/WebCore/accessibility/AccessibilityRenderObject.h
+++ b/WebCore/accessibility/AccessibilityRenderObject.h
@@ -195,6 +195,8 @@ public:
     virtual unsigned hierarchicalLevel() const;
 
     virtual const AccessibilityChildrenVector& children();
+    virtual void clearChildren();
+    void updateChildrenIfNecessary();
     
     virtual void setFocused(bool);
     virtual void setSelectedTextRange(const PlainTextRange&);
@@ -259,6 +261,7 @@ protected:
     
     void setRenderObject(RenderObject* renderer) { m_renderer = renderer; }
     void ariaLabeledByElements(Vector<Element*>& elements) const;
+    bool needsToUpdateChildren() const { return m_childrenDirty; }
     
     virtual bool isDetached() const { return !m_renderer; }
 
@@ -297,7 +300,6 @@ private:
     virtual bool ariaLiveRegionBusy() const;    
     
     void setNeedsToUpdateChildren() const { m_childrenDirty = true; }
-    bool needsToUpdateChildren() const { return m_childrenDirty; }
     
     mutable AccessibilityRole m_roleForMSAA;
 };
diff --git a/WebCore/accessibility/AccessibilityTable.cpp b/WebCore/accessibility/AccessibilityTable.cpp
index 9ac1046..34006ad 100644
--- a/WebCore/accessibility/AccessibilityTable.cpp
+++ b/WebCore/accessibility/AccessibilityTable.cpp
@@ -193,10 +193,9 @@ bool AccessibilityTable::isTableExposableThroughAccessibility()
     
 void AccessibilityTable::clearChildren()
 {
-    m_children.clear();
+    AccessibilityRenderObject::clearChildren();
     m_rows.clear();
     m_columns.clear();
-    m_haveChildren = false;
 }
 
 void AccessibilityTable::addChildren()
@@ -287,17 +286,15 @@ AccessibilityObject* AccessibilityTable::headerContainer()
 
 AccessibilityObject::AccessibilityChildrenVector& AccessibilityTable::columns()
 {
-    if (!hasChildren())
-        addChildren();
+    updateChildrenIfNecessary();
         
     return m_columns;
 }
 
 AccessibilityObject::AccessibilityChildrenVector& AccessibilityTable::rows()
 {
-    if (!hasChildren())
-        addChildren();
-
+    updateChildrenIfNecessary();
+    
     return m_rows;
 }
     
@@ -306,8 +303,7 @@ void AccessibilityTable::rowHeaders(AccessibilityChildrenVector& headers)
     if (!m_renderer)
         return;
     
-    if (!hasChildren())
-        addChildren();
+    updateChildrenIfNecessary();
     
     unsigned rowCount = m_rows.size();
     for (unsigned k = 0; k < rowCount; ++k) {
@@ -323,8 +319,7 @@ void AccessibilityTable::columnHeaders(AccessibilityChildrenVector& headers)
     if (!m_renderer)
         return;
     
-    if (!hasChildren())
-        addChildren();
+    updateChildrenIfNecessary();
     
     unsigned colCount = m_columns.size();
     for (unsigned k = 0; k < colCount; ++k) {
@@ -340,8 +335,7 @@ void AccessibilityTable::cells(AccessibilityObject::AccessibilityChildrenVector&
     if (!m_renderer)
         return;
     
-    if (!hasChildren())
-        addChildren();
+    updateChildrenIfNecessary();
     
     int numRows = m_rows.size();
     for (int row = 0; row < numRows; ++row) {
@@ -352,16 +346,14 @@ void AccessibilityTable::cells(AccessibilityObject::AccessibilityChildrenVector&
     
 unsigned AccessibilityTable::columnCount()
 {
-    if (!hasChildren())
-        addChildren();
+    updateChildrenIfNecessary();
     
     return m_columns.size();    
 }
     
 unsigned AccessibilityTable::rowCount()
 {
-    if (!hasChildren())
-        addChildren();
+    updateChildrenIfNecessary();
     
     return m_rows.size();
 }
@@ -371,8 +363,7 @@ AccessibilityTableCell* AccessibilityTable::cellForColumnAndRow(unsigned column,
     if (!m_renderer || !m_renderer->isTable())
         return 0;
     
-    if (!hasChildren())
-        addChildren();
+    updateChildrenIfNecessary();
     
     RenderTable* table = toRenderTable(m_renderer);
     RenderTableSection* tableSection = table->header();
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 6657993..4fa06b4 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,27 @@
+2010-03-01  Chris Fleizach  <cfleizach at apple.com>
+
+        Reviewed by Darin Adler.
+
+        AX: changes to WAI-ARIA grid aren't perceived correctly by VoiceOver
+        https://bugs.webkit.org/show_bug.cgi?id=35514
+
+        Add rowCount, columnCount for tables.
+
+        * DumpRenderTree/AccessibilityUIElement.cpp:
+        (rowCountCallback):
+        (columnCountCallback):
+        (AccessibilityUIElement::getJSClass):
+        * DumpRenderTree/AccessibilityUIElement.h:
+        * DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp:
+        (AccessibilityUIElement::rowCount):
+        (AccessibilityUIElement::columnCount):
+        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+        (AccessibilityUIElement::rowCount):
+        (AccessibilityUIElement::columnCount):
+        * DumpRenderTree/win/AccessibilityUIElementWin.cpp:
+        (AccessibilityUIElement::rowCount):
+        (AccessibilityUIElement::columnCount):
+
 2010-03-01  Dirk Pranke  <dpranke at chromium.org>
 
         Reviewed by Eric Seidel.
diff --git a/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp b/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
index 87fe05c..cac6fe5 100644
--- a/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
+++ b/WebKitTools/DumpRenderTree/AccessibilityUIElement.cpp
@@ -446,6 +446,16 @@ static JSValueRef getChildrenCountCallback(JSContextRef context, JSObjectRef thi
     return JSValueMakeNumber(context, toAXElement(thisObject)->childrenCount());
 }
 
+static JSValueRef rowCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+    return JSValueMakeNumber(context, toAXElement(thisObject)->rowCount());
+}
+
+static JSValueRef columnCountCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
+{
+    return JSValueMakeNumber(context, toAXElement(thisObject)->columnCount());
+}
+
 static JSValueRef getXCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
 {
     return JSValueMakeNumber(context, toAXElement(thisObject)->x());
@@ -637,6 +647,8 @@ JSClassRef AccessibilityUIElement::getJSClass()
         { "minValue", getMinValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "maxValue", getMaxValueCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "childrenCount", getChildrenCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "rowCount", rowCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "columnCount", columnCountCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "insertionPointLineNumber", getInsertionPointLineNumberCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "selectedTextRange", getSelectedTextRangeCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "isEnabled", getIsEnabledCallback, 0, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
diff --git a/WebKitTools/DumpRenderTree/AccessibilityUIElement.h b/WebKitTools/DumpRenderTree/AccessibilityUIElement.h
index e7d3bc7..09c924a 100644
--- a/WebKitTools/DumpRenderTree/AccessibilityUIElement.h
+++ b/WebKitTools/DumpRenderTree/AccessibilityUIElement.h
@@ -143,6 +143,8 @@ public:
     int indexInTable();
     JSStringRef rowIndexRange();
     JSStringRef columnIndexRange();
+    int rowCount();
+    int columnCount();
     
     // Tree/Outline specific attributes
     AccessibilityUIElement selectedRowAtIndex(unsigned);
diff --git a/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp b/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp
index abfe115..111936f 100644
--- a/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/AccessibilityUIElementGtk.cpp
@@ -75,6 +75,18 @@ void AccessibilityUIElement::getChildrenWithRange(Vector<AccessibilityUIElement>
     }
 }
 
+int AccessibilityUIElement::rowCount()
+{
+    // FIXME: implement
+    return 0;
+}
+
+int AccessibilityUIElement::columnCount()
+{
+    // FIXME: implement
+    return 0;
+}
+
 int AccessibilityUIElement::childrenCount()
 {
     if (!m_element)
diff --git a/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm b/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
index e9361f2..c57a6ef 100644
--- a/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/AccessibilityUIElementMac.mm
@@ -676,6 +676,16 @@ JSStringRef AccessibilityUIElement::attributesOfHeader()
     return descriptionOfElements(headerVector);
 }
 
+int AccessibilityUIElement::rowCount()
+{
+    return [m_element accessibilityArrayAttributeCount:NSAccessibilityRowsAttribute];
+}
+
+int AccessibilityUIElement::columnCount()
+{
+    return [m_element accessibilityArrayAttributeCount:NSAccessibilityColumnsAttribute];
+}
+
 int AccessibilityUIElement::indexInTable()
 {
     NSNumber* indexNumber = [m_element accessibilityAttributeValue:NSAccessibilityIndexAttribute];
diff --git a/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp b/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp
index 301112f..f47b363 100644
--- a/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/AccessibilityUIElementWin.cpp
@@ -83,6 +83,18 @@ int AccessibilityUIElement::childrenCount()
     return childCount;
 }
 
+int AccessibilityUIElement::rowCount()
+{
+    // FIXME: implement
+    return 0;
+}
+ 
+int AccessibilityUIElement::columnCount()
+{
+    // FIXME: implement
+    return 0;
+}
+
 AccessibilityUIElement AccessibilityUIElement::elementAtPoint(int x, int y)
 {
     return 0;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list