AX: Propagate aria-readonly to grid descendants
authorjdiggs@igalia.com <jdiggs@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 May 2017 16:43:07 +0000 (16:43 +0000)
committerjdiggs@igalia.com <jdiggs@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 May 2017 16:43:07 +0000 (16:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=171189

Reviewed by Chris Fleizach.

Source/WebCore:

Propagate aria-readonly to grid descendants if the property is not
explicitly set on the descendant.

Test: accessibility/gtk/aria-readonly-propagated.html
      Additional test cases also added to accessibility/aria-readonly.html

* accessibility/AccessibilityARIAGridCell.cpp:
(WebCore::AccessibilityARIAGridCell::ariaReadOnlyValue):
* accessibility/AccessibilityARIAGridCell.h:
* accessibility/AccessibilityObject.h:

LayoutTests:

Add new test cases to aria-readonly.html. In addition, because the platform-specific
test expectations seem due to how platforms treat whitespace from the test file, hide
the test cases after the test is run so that there are no extraneous characters and
a single expectations file can be shared.

* accessibility/aria-readonly-expected.txt: Updated.
* accessibility/aria-readonly.html: Updated.
* accessibility/gtk/aria-readonly-propagated-expected.txt: Added.
* accessibility/gtk/aria-readonly-propagated.html: Added.
* platform/mac-elcapitan/accessibility/aria-readonly-expected.txt: Removed.
* platform/mac/accessibility/aria-readonly-expected.txt: Removed.
* platform/win/accessibility/aria-readonly-expected.txt: Removed.

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

12 files changed:
LayoutTests/ChangeLog
LayoutTests/accessibility/aria-readonly-expected.txt
LayoutTests/accessibility/aria-readonly.html
LayoutTests/accessibility/gtk/aria-readonly-propagated-expected.txt [new file with mode: 0644]
LayoutTests/accessibility/gtk/aria-readonly-propagated.html [new file with mode: 0644]
LayoutTests/platform/mac-elcapitan/accessibility/aria-readonly-expected.txt [deleted file]
LayoutTests/platform/mac/accessibility/aria-readonly-expected.txt [deleted file]
LayoutTests/platform/win/accessibility/aria-readonly-expected.txt [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityARIAGridCell.cpp
Source/WebCore/accessibility/AccessibilityARIAGridCell.h
Source/WebCore/accessibility/AccessibilityObject.h

index d77c22a..9d9b4dd 100644 (file)
@@ -1,3 +1,23 @@
+2017-05-08  Joanmarie Diggs  <jdiggs@igalia.com>
+
+        AX: Propagate aria-readonly to grid descendants
+        https://bugs.webkit.org/show_bug.cgi?id=171189
+
+        Reviewed by Chris Fleizach.
+
+        Add new test cases to aria-readonly.html. In addition, because the platform-specific
+        test expectations seem due to how platforms treat whitespace from the test file, hide
+        the test cases after the test is run so that there are no extraneous characters and
+        a single expectations file can be shared.
+
+        * accessibility/aria-readonly-expected.txt: Updated.
+        * accessibility/aria-readonly.html: Updated.
+        * accessibility/gtk/aria-readonly-propagated-expected.txt: Added.
+        * accessibility/gtk/aria-readonly-propagated.html: Added.
+        * platform/mac-elcapitan/accessibility/aria-readonly-expected.txt: Removed.
+        * platform/mac/accessibility/aria-readonly-expected.txt: Removed.
+        * platform/win/accessibility/aria-readonly-expected.txt: Removed.
+
 2017-05-06  Zalan Bujtas  <zalan@apple.com>
 
         Ensure clean tree before AX cache update.
index 894c940..e1f93c4 100644 (file)
@@ -1,10 +1,9 @@
-              
 This tests that the readonly state of the AXValue property is correctly reported for native and non-native elements.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-Elements to test: 35
+Elements to test: 47
 
 PASS htmlEditableDivIsWritable is true
 PASS htmlEditableDiv2IsWritable is false
@@ -41,6 +40,18 @@ PASS ariaGridIsWritable is false
 PASS ariaGrid2IsWritable is true
 PASS ariaTreeGridIsWritable is false
 PASS ariaTreeGrid2IsWritable is true
+PASS ariaGridCell3IsWritable is false
+PASS ariaGridCell4IsWritable is true
+PASS ariaGridCell5IsWritable is false
+PASS ariaGridCell6IsWritable is true
+PASS ariaColumnHeader3IsWritable is false
+PASS ariaColumnHeader4IsWritable is true
+PASS ariaColumnHeader5IsWritable is false
+PASS ariaColumnHeader6IsWritable is true
+PASS ariaRowHeader3IsWritable is false
+PASS ariaRowHeader4IsWritable is true
+PASS ariaRowHeader5IsWritable is false
+PASS ariaRowHeader6IsWritable is true
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 496664a..36b6c16 100644 (file)
@@ -4,6 +4,7 @@
 <script src="../resources/js-test-pre.js"></script>
 </head>
 <body id="body">
+<div id="content">
 
 <!-- These reflect the native writable state, but can be overridden by @aria-readonly. -->
 <div contenteditable id="htmlEditableDiv" data-expectedwritable="true"></div>
 <div role="treegrid" aria-readonly="false" id="ariaTreeGrid2" tabindex="0" data-expectedwritable="true"><div role="row"><div role="gridcell"></div></div></div>
 
 
-
+<!--aria-readonly should be propagated to gridcells if the property is not set on the gridcell -->
+<div role="grid" aria-readonly="true"><div role="row"><div role="gridcell" id="ariaGridCell3" tabindex="0" data-expectedwritable="false"></div></div></div>
+<div role="grid" aria-readonly="false"><div role="row"><div role="gridcell" id="ariaGridCell4" tabindex="0" data-expectedwritable="true"></div></div></div>
+<div role="grid" aria-readonly="false"><div role="row"><div role="gridcell" aria-readonly="true" id="ariaGridCell5" tabindex="0" data-expectedwritable="false"></div></div></div>
+<div role="grid" aria-readonly="true"><div role="row"><div role="gridcell" aria-readonly="false" id="ariaGridCell6" tabindex="0" data-expectedwritable="true"></div></div></div>
+<div role="grid" aria-readonly="true"><div role="row"><div role="columnheader" id="ariaColumnHeader3" tabindex="0" data-expectedwritable="false"></div></div></div>
+<div role="grid" aria-readonly="false"><div role="row"><div role="columnheader" id="ariaColumnHeader4" tabindex="0" data-expectedwritable="true"></div></div></div>
+<div role="grid" aria-readonly="false"><div role="row"><div role="columnheader" aria-readonly="true" id="ariaColumnHeader5" tabindex="0" data-expectedwritable="false"></div></div></div>
+<div role="grid" aria-readonly="true"><div role="row"><div role="columnheader" aria-readonly="false" id="ariaColumnHeader6" tabindex="0" data-expectedwritable="true"></div></div></div>
+<div role="grid" aria-readonly="true"><div role="row"><div role="rowheader" id="ariaRowHeader3" tabindex="0" data-expectedwritable="false"></div></div></div>
+<div role="grid" aria-readonly="false"><div role="row"><div role="rowheader" id="ariaRowHeader4" tabindex="0" data-expectedwritable="true"></div></div></div>
+<div role="grid" aria-readonly="false"><div role="row"><div role="rowheader" aria-readonly="true" id="ariaRowHeader5" tabindex="0" data-expectedwritable="false"></div></div></div>
+<div role="grid" aria-readonly="true"><div role="row"><div role="rowheader" aria-readonly="false" id="ariaRowHeader6" tabindex="0" data-expectedwritable="true"></div></div></div>
+
+</div>
 <p id="description"></p>
 <div id="console"></div>
 
@@ -78,6 +93,7 @@
             result.innerText += output + "\n";
         }
 
+        document.getElementById("content").style.visibility = "hidden";
     }
 
 </script>
diff --git a/LayoutTests/accessibility/gtk/aria-readonly-propagated-expected.txt b/LayoutTests/accessibility/gtk/aria-readonly-propagated-expected.txt
new file mode 100644 (file)
index 0000000..b6b91ac
--- /dev/null
@@ -0,0 +1,21 @@
+This tests the exposure of propagated values of aria-readonly as an object attribute.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+AXPlatformAttributes: computed-role:gridcell, xml-roles:gridcell, readonly:true, html-id:test1, tag:div, toolkit:WebKitGtk
+AXPlatformAttributes: computed-role:gridcell, xml-roles:gridcell, readonly:false, html-id:test2, tag:div, toolkit:WebKitGtk
+AXPlatformAttributes: computed-role:gridcell, xml-roles:gridcell, readonly:false, html-id:test3, tag:div, toolkit:WebKitGtk
+AXPlatformAttributes: computed-role:gridcell, xml-roles:gridcell, readonly:true, html-id:test4, tag:div, toolkit:WebKitGtk
+AXPlatformAttributes: computed-role:columnheader, xml-roles:columnheader, readonly:true, html-id:test5, tag:div, toolkit:WebKitGtk
+AXPlatformAttributes: computed-role:columnheader, xml-roles:columnheader, readonly:false, html-id:test6, tag:div, toolkit:WebKitGtk
+AXPlatformAttributes: computed-role:columnheader, xml-roles:columnheader, readonly:false, html-id:test7, tag:div, toolkit:WebKitGtk
+AXPlatformAttributes: computed-role:columnheader, xml-roles:columnheader, readonly:true, html-id:test8, tag:div, toolkit:WebKitGtk
+AXPlatformAttributes: computed-role:rowheader, xml-roles:rowheader, readonly:true, html-id:test9, tag:div, toolkit:WebKitGtk
+AXPlatformAttributes: computed-role:rowheader, xml-roles:rowheader, readonly:false, html-id:test10, tag:div, toolkit:WebKitGtk
+AXPlatformAttributes: computed-role:rowheader, xml-roles:rowheader, readonly:false, html-id:test11, tag:div, toolkit:WebKitGtk
+AXPlatformAttributes: computed-role:rowheader, xml-roles:rowheader, readonly:true, html-id:test12, tag:div, toolkit:WebKitGtk
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/accessibility/gtk/aria-readonly-propagated.html b/LayoutTests/accessibility/gtk/aria-readonly-propagated.html
new file mode 100644 (file)
index 0000000..ea0ca1f
--- /dev/null
@@ -0,0 +1,72 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+  <div id="content">
+    <div role="grid" aria-readonly="true">
+      <div role="row">
+       <div role="gridcell" id="test1" tabindex="0"></div>
+       <div role="gridcell" aria-readonly="false" id="test2" tabindex="0"></div>
+      </div>
+    </div>
+    <div role="grid" aria-readonly="false">
+      <div role="row">
+       <div role="gridcell" id="test3" tabindex="0"></div>
+       <div role="gridcell" aria-readonly="true" id="test4" tabindex="0"></div>
+      </div>
+    </div>
+    <div role="grid" aria-readonly="true">
+      <div role="row">
+       <div role="columnheader" id="test5" tabindex="0"></div>
+       <div role="columnheader" aria-readonly="false" id="test6" tabindex="0"></div>
+      </div>
+    </div>
+    <div role="grid" aria-readonly="false">
+      <div role="row">
+       <div role="columnheader" id="test7" tabindex="0"></div>
+       <div role="columnheader" aria-readonly="true" id="test8" tabindex="0"></div>
+      </div>
+    </div>
+    <div role="grid" aria-readonly="true">
+      <div role="row">
+       <div role="rowheader" id="test9" tabindex="0"></div>
+       <div role="rowheader" aria-readonly="false" id="test10" tabindex="0"></div>
+      </div>
+    </div>
+    <div role="grid" aria-readonly="false">
+      <div role="row">
+       <div role="rowheader" id="test11" tabindex="0"></div>
+       <div role="rowheader" aria-readonly="true" id="test12" tabindex="0"></div>
+      </div>
+    </div>
+  </div>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+    function platformAttributes(axElement) {
+        var allAttributes = axElement.allAttributes().split("\n");
+        var length = allAttributes.length;
+        for (var i = 0; i < length; i++) {
+            var string = allAttributes[i];
+            if (string.startsWith("AXPlatformAttributes"))
+                return string;
+        }
+        return "";
+    }
+
+    description("This tests the exposure of propagated values of aria-readonly as an object attribute.");
+    if (window.accessibilityController) {
+        for (var i = 1; i <= 12; i++) {
+            var axElement = accessibilityController.accessibleElementById("test" + i);
+            debug(platformAttributes(axElement));
+        }
+
+        document.getElementById("content").style.visibility = "hidden";
+    }
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
+
diff --git a/LayoutTests/platform/mac-elcapitan/accessibility/aria-readonly-expected.txt b/LayoutTests/platform/mac-elcapitan/accessibility/aria-readonly-expected.txt
deleted file mode 100644 (file)
index 894c940..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-              
-This tests that the readonly state of the AXValue property is correctly reported for native and non-native elements.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-Elements to test: 35
-
-PASS htmlEditableDivIsWritable is true
-PASS htmlEditableDiv2IsWritable is false
-PASS htmlEditableDiv3IsWritable is true
-PASS htmlEditableDiv4IsWritable is true
-PASS htmlEditableDiv5IsWritable is false
-PASS htmlEditableDiv6IsWritable is true
-PASS htmlNonEditableDivIsWritable is false
-PASS htmlNonEditableDiv2IsWritable is false
-PASS htmlNonEditableDiv3IsWritable is true
-PASS ariaTextBoxIsWritable is true
-PASS ariaReadOnlyAriaTextBoxIsWritable is false
-PASS htmlReadOnlyTextFieldIsWritable is false
-PASS htmlReadOnlyTextField2IsWritable is false
-PASS htmlReadOnlyTextField3IsWritable is false
-PASS htmlReadOnlyTextField4IsWritable is false
-PASS htmlReadOnlyTextAreaIsWritable is false
-PASS htmlReadOnlyTextArea2IsWritable is false
-PASS htmlReadOnlyTextArea3IsWritable is false
-PASS htmlReadOnlyTextArea3IsWritable is false
-PASS textFieldIsWritable is true
-PASS ariaReadOnlyTextFieldIsWritable is true
-PASS ariaNonReadOnlyTextFieldIsWritable is true
-PASS textAreaIsWritable is true
-PASS textArea2IsWritable is true
-PASS textArea3IsWritable is true
-PASS ariaGridCellIsWritable is false
-PASS ariaGridCell2IsWritable is true
-PASS ariaColumnHeaderIsWritable is false
-PASS ariaColumnHeader2IsWritable is true
-PASS ariaRowHeaderIsWritable is false
-PASS ariaRowHeader2IsWritable is true
-PASS ariaGridIsWritable is false
-PASS ariaGrid2IsWritable is true
-PASS ariaTreeGridIsWritable is false
-PASS ariaTreeGrid2IsWritable is true
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/LayoutTests/platform/mac/accessibility/aria-readonly-expected.txt b/LayoutTests/platform/mac/accessibility/aria-readonly-expected.txt
deleted file mode 100644 (file)
index 52fb9b9..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-             
-This tests that the readonly state of the AXValue property is correctly reported for native and non-native elements.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-Elements to test: 35
-
-PASS htmlEditableDivIsWritable is true
-PASS htmlEditableDiv2IsWritable is false
-PASS htmlEditableDiv3IsWritable is true
-PASS htmlEditableDiv4IsWritable is true
-PASS htmlEditableDiv5IsWritable is false
-PASS htmlEditableDiv6IsWritable is true
-PASS htmlNonEditableDivIsWritable is false
-PASS htmlNonEditableDiv2IsWritable is false
-PASS htmlNonEditableDiv3IsWritable is true
-PASS ariaTextBoxIsWritable is true
-PASS ariaReadOnlyAriaTextBoxIsWritable is false
-PASS htmlReadOnlyTextFieldIsWritable is false
-PASS htmlReadOnlyTextField2IsWritable is false
-PASS htmlReadOnlyTextField3IsWritable is false
-PASS htmlReadOnlyTextField4IsWritable is false
-PASS htmlReadOnlyTextAreaIsWritable is false
-PASS htmlReadOnlyTextArea2IsWritable is false
-PASS htmlReadOnlyTextArea3IsWritable is false
-PASS htmlReadOnlyTextArea3IsWritable is false
-PASS textFieldIsWritable is true
-PASS ariaReadOnlyTextFieldIsWritable is true
-PASS ariaNonReadOnlyTextFieldIsWritable is true
-PASS textAreaIsWritable is true
-PASS textArea2IsWritable is true
-PASS textArea3IsWritable is true
-PASS ariaGridCellIsWritable is false
-PASS ariaGridCell2IsWritable is true
-PASS ariaColumnHeaderIsWritable is false
-PASS ariaColumnHeader2IsWritable is true
-PASS ariaRowHeaderIsWritable is false
-PASS ariaRowHeader2IsWritable is true
-PASS ariaGridIsWritable is false
-PASS ariaGrid2IsWritable is true
-PASS ariaTreeGridIsWritable is false
-PASS ariaTreeGrid2IsWritable is true
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/LayoutTests/platform/win/accessibility/aria-readonly-expected.txt b/LayoutTests/platform/win/accessibility/aria-readonly-expected.txt
deleted file mode 100644 (file)
index 894c940..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-              
-This tests that the readonly state of the AXValue property is correctly reported for native and non-native elements.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-Elements to test: 35
-
-PASS htmlEditableDivIsWritable is true
-PASS htmlEditableDiv2IsWritable is false
-PASS htmlEditableDiv3IsWritable is true
-PASS htmlEditableDiv4IsWritable is true
-PASS htmlEditableDiv5IsWritable is false
-PASS htmlEditableDiv6IsWritable is true
-PASS htmlNonEditableDivIsWritable is false
-PASS htmlNonEditableDiv2IsWritable is false
-PASS htmlNonEditableDiv3IsWritable is true
-PASS ariaTextBoxIsWritable is true
-PASS ariaReadOnlyAriaTextBoxIsWritable is false
-PASS htmlReadOnlyTextFieldIsWritable is false
-PASS htmlReadOnlyTextField2IsWritable is false
-PASS htmlReadOnlyTextField3IsWritable is false
-PASS htmlReadOnlyTextField4IsWritable is false
-PASS htmlReadOnlyTextAreaIsWritable is false
-PASS htmlReadOnlyTextArea2IsWritable is false
-PASS htmlReadOnlyTextArea3IsWritable is false
-PASS htmlReadOnlyTextArea3IsWritable is false
-PASS textFieldIsWritable is true
-PASS ariaReadOnlyTextFieldIsWritable is true
-PASS ariaNonReadOnlyTextFieldIsWritable is true
-PASS textAreaIsWritable is true
-PASS textArea2IsWritable is true
-PASS textArea3IsWritable is true
-PASS ariaGridCellIsWritable is false
-PASS ariaGridCell2IsWritable is true
-PASS ariaColumnHeaderIsWritable is false
-PASS ariaColumnHeader2IsWritable is true
-PASS ariaRowHeaderIsWritable is false
-PASS ariaRowHeader2IsWritable is true
-PASS ariaGridIsWritable is false
-PASS ariaGrid2IsWritable is true
-PASS ariaTreeGridIsWritable is false
-PASS ariaTreeGrid2IsWritable is true
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
index 12c9c2c..4b4d709 100644 (file)
@@ -1,3 +1,21 @@
+2017-05-08  Joanmarie Diggs  <jdiggs@igalia.com>
+
+        AX: Propagate aria-readonly to grid descendants
+        https://bugs.webkit.org/show_bug.cgi?id=171189
+
+        Reviewed by Chris Fleizach.
+
+        Propagate aria-readonly to grid descendants if the property is not
+        explicitly set on the descendant.
+
+        Test: accessibility/gtk/aria-readonly-propagated.html
+              Additional test cases also added to accessibility/aria-readonly.html
+
+        * accessibility/AccessibilityARIAGridCell.cpp:
+        (WebCore::AccessibilityARIAGridCell::ariaReadOnlyValue):
+        * accessibility/AccessibilityARIAGridCell.h:
+        * accessibility/AccessibilityObject.h:
+
 2017-05-06  Zalan Bujtas  <zalan@apple.com>
 
         Ensure clean tree before AX cache update.
index a036b43..efba04f 100644 (file)
@@ -178,5 +178,18 @@ AccessibilityObject* AccessibilityARIAGridCell::parentRowGroup() const
     // If there's no row group found, we use the parent table as the row group.
     return parentTable();
 }
+
+String AccessibilityARIAGridCell::ariaReadOnlyValue() const
+{
+    if (hasAttribute(aria_readonlyAttr))
+        return getAttribute(aria_readonlyAttr).string().convertToASCIILowercase();
+
+    // ARIA 1.1 requires user agents to propagate the grid's aria-readonly value to all
+    // gridcell elements if the property is not present on the gridcell element itelf.
+    if (AccessibilityObject* parent = parentTable())
+        return parent->ariaReadOnlyValue();
+
+    return String();
+}
   
 } // namespace WebCore
index ef22600..52c1d7f 100644 (file)
@@ -48,6 +48,7 @@ private:
     AccessibilityTable* parentTable() const override;
     AccessibilityObject* parentRowGroup() const;
     unsigned ariaRowSpanWithRowIndex(unsigned index) const;
+    String ariaReadOnlyValue() const override;
 }; 
     
 } // namespace WebCore 
index 311c99f..b0fafff 100644 (file)
@@ -967,7 +967,7 @@ public:
     bool hasContentEditableAttributeSet() const;
 
     bool supportsARIAReadOnly() const;
-    String ariaReadOnlyValue() const;
+    virtual String ariaReadOnlyValue() const;
 
     bool supportsARIAAutoComplete() const;
     String ariaAutoCompleteValue() const;