Title: [187582] trunk
Revision
187582
Author
commit-qu...@webkit.org
Date
2015-07-30 04:10:38 -0700 (Thu, 30 Jul 2015)

Log Message

AX: VoiceOver unable to access content in malformed trees
https://bugs.webkit.org/show_bug.cgi?id=147295
<rdar://problem/14862892>

Patch by Nan Wang <n_w...@apple.com> on 2015-07-30
Reviewed by Chris Fleizach.

Source/WebCore:

VoiceOver is skipping the content of malformed trees. This fixes the problem
by having the tree check if it has valid children (treeitems) and makes treeitems
check if they are inside trees.

Test: platform/mac/accessibility/malformed-tree.html

* CMakeLists.txt:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* accessibility/AXObjectCache.cpp:
(WebCore::createFromRenderer):
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::addChildren):
(WebCore::AccessibilityObject::addChild):
(WebCore::AccessibilityObject::insertChild):
(WebCore::AccessibilityObject::shouldIgnoreAttributeRole):
(WebCore::AccessibilityObject::canHaveChildren):
(WebCore::AccessibilityObject::hasChildren):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::determineAccessibilityRole):
* accessibility/AccessibilityTree.cpp: Added.
(WebCore::AccessibilityTree::AccessibilityTree):
(WebCore::AccessibilityTree::~AccessibilityTree):
(WebCore::AccessibilityTree::create):
(WebCore::AccessibilityTree::computeAccessibilityIsIgnored):
(WebCore::AccessibilityTree::determineAccessibilityRole):
(WebCore::AccessibilityTree::isTreeValid):
* accessibility/AccessibilityTree.h: Added.
* accessibility/AccessibilityTreeItem.cpp: Added.
(WebCore::AccessibilityTreeItem::AccessibilityTreeItem):
(WebCore::AccessibilityTreeItem::~AccessibilityTreeItem):
(WebCore::AccessibilityTreeItem::create):
(WebCore::AccessibilityTreeItem::determineAccessibilityRole):
* accessibility/AccessibilityTreeItem.h: Added.

LayoutTests:

* accessibility/aria-mappings.html:
* accessibility/treeitem-child-exposed-expected.txt:
* accessibility/treeitem-child-exposed.html:
* platform/mac/accessibility/malformed-tree-expected.txt: Added.
* platform/mac/accessibility/malformed-tree.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (187581 => 187582)


--- trunk/LayoutTests/ChangeLog	2015-07-30 09:52:48 UTC (rev 187581)
+++ trunk/LayoutTests/ChangeLog	2015-07-30 11:10:38 UTC (rev 187582)
@@ -1,3 +1,17 @@
+2015-07-30  Nan Wang  <n_w...@apple.com>
+
+        AX: VoiceOver unable to access content in malformed trees
+        https://bugs.webkit.org/show_bug.cgi?id=147295
+        <rdar://problem/14862892>
+
+        Reviewed by Chris Fleizach.
+
+        * accessibility/aria-mappings.html:
+        * accessibility/treeitem-child-exposed-expected.txt:
+        * accessibility/treeitem-child-exposed.html:
+        * platform/mac/accessibility/malformed-tree-expected.txt: Added.
+        * platform/mac/accessibility/malformed-tree.html: Added.
+
 2015-07-30  Benjamin Poulain  <benja...@webkit.org>
 
         Update JSC's standalone-pre.js for r187575

Modified: trunk/LayoutTests/accessibility/aria-mappings.html (187581 => 187582)


--- trunk/LayoutTests/accessibility/aria-mappings.html	2015-07-30 09:52:48 UTC (rev 187581)
+++ trunk/LayoutTests/accessibility/aria-mappings.html	2015-07-30 11:10:38 UTC (rev 187582)
@@ -12,8 +12,8 @@
 <div id="document" role="document">document role</div>
 <div id="status" role="status">status role</div>
 <div id="tooltip" role="tooltip">tooltip role</div>
-<div id="tree" role="tree">tree role</div>
-<div id="treeitem" role="treeitem">treeitem role</div>
+<div id="tree" role="tree"><div role="treeitem">tree role</div></div>
+<div role="tree"><div id="treeitem" role="treeitem">treeitem role</div></div>
 <br>
 <p id="description"></p>
 <div id="console"></div>

Modified: trunk/LayoutTests/accessibility/treeitem-child-exposed-expected.txt (187581 => 187582)


--- trunk/LayoutTests/accessibility/treeitem-child-exposed-expected.txt	2015-07-30 09:52:48 UTC (rev 187581)
+++ trunk/LayoutTests/accessibility/treeitem-child-exposed-expected.txt	2015-07-30 11:10:38 UTC (rev 187582)
@@ -6,7 +6,7 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS tree.childrenCount is 2
+PASS tree.childrenCount is 3
 PASS inputField.isValid is true
 PASS inputField3.isValid is true
 PASS successfullyParsed is true

Modified: trunk/LayoutTests/accessibility/treeitem-child-exposed.html (187581 => 187582)


--- trunk/LayoutTests/accessibility/treeitem-child-exposed.html	2015-07-30 09:52:48 UTC (rev 187581)
+++ trunk/LayoutTests/accessibility/treeitem-child-exposed.html	2015-07-30 11:10:38 UTC (rev 187582)
@@ -26,9 +26,9 @@
     description("This tests if a treeitem contains an element other than static text, it should be exposed");
 
     if (window.accessibilityController) {
-    	// tree should only have 2 child, since only treeitem or static text can be a tree's child
+    	// tree should only have 3 child, since malformed tree should also be accessible.
         var tree = accessibilityController.accessibleElementById("tree");
-        shouldBe("tree.childrenCount", "2");
+        shouldBe("tree.childrenCount", "3");
         
         // input filed in treeitem1 should be exposed
         var inputField = accessibilityController.accessibleElementById("input1");

Added: trunk/LayoutTests/platform/mac/accessibility/malformed-tree-expected.txt (0 => 187582)


--- trunk/LayoutTests/platform/mac/accessibility/malformed-tree-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/malformed-tree-expected.txt	2015-07-30 11:10:38 UTC (rev 187582)
@@ -0,0 +1,26 @@
+text
+treeitem
+Entry A
+
+
+text
+
+text
+This tests that a malformed tree is accessible.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS tree.role is 'AXRole: AXOutline'
+PASS tree1.role is 'AXRole: AXGroup'
+PASS tree2.role is 'AXRole: AXGroup'
+PASS itemA != null is true
+PASS itemB != null is true
+PASS itemC != null is true
+PASS itemD != null is true
+PASS itemE != null is true
+PASS itemF != null is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/mac/accessibility/malformed-tree.html (0 => 187582)


--- trunk/LayoutTests/platform/mac/accessibility/malformed-tree.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/malformed-tree.html	2015-07-30 11:10:38 UTC (rev 187582)
@@ -0,0 +1,63 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<script src=""   
+
+<div role="tree" id="goodtree">
+<div role="treeitem">text</div>
+<div role="group"><div role="group"><div role="treeitem">treeitem</div></div></div>
+</div>
+        
+<ul id="malformedTree1" role="tree">
+<li role="treeitem">
+<span><a id="ITEM_A" href="" A</a></span>
+</li>
+<li id="list1"><input id="ITEM_B"></li>
+</ul>
+
+<ul id="malformedTree2" role="tree">
+<li><input id="ITEM_C"></li>
+<li id="ITEM_D">text</li>
+</ul>
+
+<ul id="malformedTree3">
+<li role="treeitem"><input id="ITEM_E"></li>
+<li role="treeitem" id="ITEM_F">text</li>
+</ul>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+description("This tests that a malformed tree is accessible.")
+
+if (window.accessibilityController) {
+
+    var tree = accessibilityController.accessibleElementById("goodtree");
+    shouldBe("tree.role", "'AXRole: AXOutline'");
+    var tree1 = accessibilityController.accessibleElementById("malformedTree1");
+    shouldBe("tree1.role", "'AXRole: AXGroup'");
+    var tree2 = accessibilityController.accessibleElementById("malformedTree2");
+    shouldBe("tree2.role", "'AXRole: AXGroup'");
+
+    var itemA = accessibilityController.accessibleElementById("ITEM_A");
+    var itemB = accessibilityController.accessibleElementById("ITEM_B");
+    var itemC = accessibilityController.accessibleElementById("ITEM_C");
+    var itemD = accessibilityController.accessibleElementById("ITEM_D");
+    var itemE = accessibilityController.accessibleElementById("ITEM_E");
+    var itemF = accessibilityController.accessibleElementById("ITEM_F");
+    
+    shouldBeTrue("itemA != null");
+    shouldBeTrue("itemB != null");
+    shouldBeTrue("itemC != null");
+    shouldBeTrue("itemD != null");
+    shouldBeTrue("itemE != null");
+    shouldBeTrue("itemF != null");
+}
+
+</script>
+
+<script src=""
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/CMakeLists.txt (187581 => 187582)


--- trunk/Source/WebCore/CMakeLists.txt	2015-07-30 09:52:48 UTC (rev 187581)
+++ trunk/Source/WebCore/CMakeLists.txt	2015-07-30 11:10:38 UTC (rev 187582)
@@ -1063,6 +1063,8 @@
     accessibility/AccessibilityTableColumn.cpp
     accessibility/AccessibilityTableHeaderContainer.cpp
     accessibility/AccessibilityTableRow.cpp
+    accessibility/AccessibilityTree.cpp
+    accessibility/AccessibilityTreeItem.cpp
 
     bindings/generic/ActiveDOMCallback.cpp
     bindings/generic/RuntimeEnabledFeatures.cpp

Modified: trunk/Source/WebCore/ChangeLog (187581 => 187582)


--- trunk/Source/WebCore/ChangeLog	2015-07-30 09:52:48 UTC (rev 187581)
+++ trunk/Source/WebCore/ChangeLog	2015-07-30 11:10:38 UTC (rev 187582)
@@ -1,3 +1,47 @@
+2015-07-30  Nan Wang  <n_w...@apple.com>
+
+        AX: VoiceOver unable to access content in malformed trees
+        https://bugs.webkit.org/show_bug.cgi?id=147295
+        <rdar://problem/14862892>
+
+        Reviewed by Chris Fleizach.
+
+        VoiceOver is skipping the content of malformed trees. This fixes the problem
+        by having the tree check if it has valid children (treeitems) and makes treeitems
+        check if they are inside trees.
+
+        Test: platform/mac/accessibility/malformed-tree.html
+
+        * CMakeLists.txt:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::createFromRenderer):
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::addChildren):
+        (WebCore::AccessibilityObject::addChild):
+        (WebCore::AccessibilityObject::insertChild):
+        (WebCore::AccessibilityObject::shouldIgnoreAttributeRole):
+        (WebCore::AccessibilityObject::canHaveChildren):
+        (WebCore::AccessibilityObject::hasChildren):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
+        * accessibility/AccessibilityTree.cpp: Added.
+        (WebCore::AccessibilityTree::AccessibilityTree):
+        (WebCore::AccessibilityTree::~AccessibilityTree):
+        (WebCore::AccessibilityTree::create):
+        (WebCore::AccessibilityTree::computeAccessibilityIsIgnored):
+        (WebCore::AccessibilityTree::determineAccessibilityRole):
+        (WebCore::AccessibilityTree::isTreeValid):
+        * accessibility/AccessibilityTree.h: Added.
+        * accessibility/AccessibilityTreeItem.cpp: Added.
+        (WebCore::AccessibilityTreeItem::AccessibilityTreeItem):
+        (WebCore::AccessibilityTreeItem::~AccessibilityTreeItem):
+        (WebCore::AccessibilityTreeItem::create):
+        (WebCore::AccessibilityTreeItem::determineAccessibilityRole):
+        * accessibility/AccessibilityTreeItem.h: Added.
+
 2015-07-29  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK] Paste data is removed from clipboard when closing browser tab

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (187581 => 187582)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2015-07-30 09:52:48 UTC (rev 187581)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2015-07-30 11:10:38 UTC (rev 187582)
@@ -7209,6 +7209,34 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="..\accessibility\AccessibilityTree.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\accessibility\AccessibilityTreeItem.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="..\accessibility\win\AccessibilityObjectWrapperWin.cpp" />
     <ClCompile Include="..\accessibility\win\AccessibilityObjectWin.cpp" />
     <ClCompile Include="..\accessibility\win\AXObjectCacheWin.cpp" />
@@ -19864,6 +19892,8 @@
     <ClInclude Include="..\accessibility\AccessibilityTableColumn.h" />
     <ClInclude Include="..\accessibility\AccessibilityTableHeaderContainer.h" />
     <ClInclude Include="..\accessibility\AccessibilityTableRow.h" />
+    <ClInclude Include="..\accessibility\AccessibilityTree.h" />
+    <ClInclude Include="..\accessibility\AccessibilityTreeItem.h" />
     <ClInclude Include="..\accessibility\AXObjectCache.h" />
     <ClInclude Include="..\accessibility\AXTextStateChangeIntent.h" />
     <ClInclude Include="..\accessibility\win\AccessibilityObjectWrapperWin.h" />

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (187581 => 187582)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2015-07-30 09:52:48 UTC (rev 187581)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2015-07-30 11:10:38 UTC (rev 187582)
@@ -669,6 +669,12 @@
     <ClCompile Include="..\accessibility\AccessibilityTableRow.cpp">
       <Filter>accessibility</Filter>
     </ClCompile>
+    <ClCompile Include="..\accessibility\AccessibilityTree.cpp">
+      <Filter>accessibility</Filter>
+    </ClCompile>
+    <ClCompile Include="..\accessibility\AccessibilityTreeItem.cpp">
+      <Filter>accessibility</Filter>
+    </ClCompile>
     <ClCompile Include="..\accessibility\AXObjectCache.cpp">
       <Filter>accessibility</Filter>
     </ClCompile>
@@ -7670,6 +7676,12 @@
     <ClInclude Include="..\accessibility\AccessibilityTableRow.h">
       <Filter>accessibility</Filter>
     </ClInclude>
+    <ClInclude Include="..\accessibility\AccessibilityTree.h">
+      <Filter>accessibility</Filter>
+    </ClInclude>
+    <ClInclude Include="..\accessibility\AccessibilityTreeItem.h">
+      <Filter>accessibility</Filter>
+    </ClInclude>
     <ClInclude Include="..\accessibility\AXObjectCache.h">
       <Filter>accessibility</Filter>
     </ClInclude>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (187581 => 187582)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-07-30 09:52:48 UTC (rev 187581)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-07-30 11:10:38 UTC (rev 187582)
@@ -4397,6 +4397,10 @@
 		A8EA800E0A19516E00A8EF5F /* MediaList.h in Headers */ = {isa = PBXBuildFile; fileRef = A8EA80060A19516E00A8EF5F /* MediaList.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A8FA6E5D0E4CFDED00D5CF49 /* Pattern.h in Headers */ = {isa = PBXBuildFile; fileRef = A8FA6E5B0E4CFDED00D5CF49 /* Pattern.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A8FA6E5E0E4CFDED00D5CF49 /* Pattern.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8FA6E5C0E4CFDED00D5CF49 /* Pattern.cpp */; };
+		A91C9FBE1B6586DE00AFFD54 /* AccessibilityTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A91C9FBC1B6586DE00AFFD54 /* AccessibilityTree.cpp */; };
+		A91C9FBF1B6586DE00AFFD54 /* AccessibilityTree.h in Headers */ = {isa = PBXBuildFile; fileRef = A91C9FBD1B6586DE00AFFD54 /* AccessibilityTree.h */; };
+		A91C9FC21B659A6700AFFD54 /* AccessibilityTreeItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A91C9FC01B659A6700AFFD54 /* AccessibilityTreeItem.cpp */; };
+		A91C9FC31B659A6700AFFD54 /* AccessibilityTreeItem.h in Headers */ = {isa = PBXBuildFile; fileRef = A91C9FC11B659A6700AFFD54 /* AccessibilityTreeItem.h */; };
 		A9C6E4E30D745E05006442E9 /* DOMMimeType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9C6E4E10D745E05006442E9 /* DOMMimeType.cpp */; };
 		A9C6E4E40D745E05006442E9 /* DOMMimeType.h in Headers */ = {isa = PBXBuildFile; fileRef = A9C6E4E20D745E05006442E9 /* DOMMimeType.h */; };
 		A9C6E4E70D745E18006442E9 /* DOMMimeTypeArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A9C6E4E50D745E18006442E9 /* DOMMimeTypeArray.cpp */; };
@@ -11792,6 +11796,10 @@
 		A8EA80060A19516E00A8EF5F /* MediaList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MediaList.h; sourceTree = "<group>"; };
 		A8FA6E5B0E4CFDED00D5CF49 /* Pattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pattern.h; sourceTree = "<group>"; };
 		A8FA6E5C0E4CFDED00D5CF49 /* Pattern.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Pattern.cpp; sourceTree = "<group>"; };
+		A91C9FBC1B6586DE00AFFD54 /* AccessibilityTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityTree.cpp; sourceTree = "<group>"; };
+		A91C9FBD1B6586DE00AFFD54 /* AccessibilityTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityTree.h; sourceTree = "<group>"; };
+		A91C9FC01B659A6700AFFD54 /* AccessibilityTreeItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityTreeItem.cpp; sourceTree = "<group>"; };
+		A91C9FC11B659A6700AFFD54 /* AccessibilityTreeItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityTreeItem.h; sourceTree = "<group>"; };
 		A9C6E4E10D745E05006442E9 /* DOMMimeType.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DOMMimeType.cpp; sourceTree = "<group>"; };
 		A9C6E4E20D745E05006442E9 /* DOMMimeType.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMMimeType.h; sourceTree = "<group>"; };
 		A9C6E4E50D745E18006442E9 /* DOMMimeTypeArray.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DOMMimeTypeArray.cpp; sourceTree = "<group>"; };
@@ -15780,6 +15788,10 @@
 				29A8121D0FBB9C1D00510293 /* AccessibilityImageMapLink.h */,
 				2981CAA1131822EC00D12F2A /* AccessibilityList.cpp */,
 				29A8120E0FBB9C1D00510293 /* AccessibilityList.h */,
+				A91C9FBC1B6586DE00AFFD54 /* AccessibilityTree.cpp */,
+				A91C9FBD1B6586DE00AFFD54 /* AccessibilityTree.h */,
+				A91C9FC01B659A6700AFFD54 /* AccessibilityTreeItem.cpp */,
+				A91C9FC11B659A6700AFFD54 /* AccessibilityTreeItem.h */,
 				2981CAA2131822EC00D12F2A /* AccessibilityListBox.cpp */,
 				29A812250FBB9C1D00510293 /* AccessibilityListBox.h */,
 				2981CAA3131822EC00D12F2A /* AccessibilityListBoxOption.cpp */,
@@ -26853,6 +26865,7 @@
 				B22279C80D00BF220071B782 /* SVGFEBlendElement.h in Headers */,
 				B22279CB0D00BF220071B782 /* SVGFEColorMatrixElement.h in Headers */,
 				B22279CE0D00BF220071B782 /* SVGFEComponentTransferElement.h in Headers */,
+				A91C9FBF1B6586DE00AFFD54 /* AccessibilityTree.h in Headers */,
 				B22279D10D00BF220071B782 /* SVGFECompositeElement.h in Headers */,
 				1921327511C0E6BB00456238 /* SVGFEConvolveMatrixElement.h in Headers */,
 				B22279D40D00BF220071B782 /* SVGFEDiffuseLightingElement.h in Headers */,
@@ -27355,6 +27368,7 @@
 				B10B6980140C174000BC1C26 /* WebVTTToken.h in Headers */,
 				B10B6982140C174000BC1C26 /* WebVTTTokenizer.h in Headers */,
 				CD8203101395ACE700F956C6 /* WebWindowAnimation.h in Headers */,
+				A91C9FC31B659A6700AFFD54 /* AccessibilityTreeItem.h in Headers */,
 				F55B3DE01251F12D003EF269 /* WeekInputType.h in Headers */,
 				85031B510A44EFC700F992E0 /* WheelEvent.h in Headers */,
 				93EC44A2188F4BB800661DF1 /* WheelEventDeltaTracker.h in Headers */,
@@ -28946,6 +28960,7 @@
 				2ECF7ADC10162B3800427DE7 /* JSErrorEvent.cpp in Sources */,
 				F3D461481161D53200CA0D09 /* JSErrorHandler.cpp in Sources */,
 				14E8378409F85D1C00B85AE4 /* JSEvent.cpp in Sources */,
+				A91C9FBE1B6586DE00AFFD54 /* AccessibilityTree.cpp in Sources */,
 				BCEFAF4E0C317E6900FA81F6 /* JSEventCustom.cpp in Sources */,
 				BC60D9BF0D2A269A00B9918F /* JSEventException.cpp in Sources */,
 				93B70D6909EB0C7C009D8468 /* JSEventListener.cpp in Sources */,
@@ -30062,6 +30077,7 @@
 				0FE71405142170B800DB33BA /* ScrollbarThemeMock.cpp in Sources */,
 				5D925B670F64D4DD00B847F0 /* ScrollBehavior.cpp in Sources */,
 				1AA84F04143BA7BD0051D153 /* ScrollController.mm in Sources */,
+				A91C9FC21B659A6700AFFD54 /* AccessibilityTreeItem.cpp in Sources */,
 				0F605AEC15F94848004DF0C0 /* ScrollingConstraints.cpp in Sources */,
 				1AF62EE714DA22A70041556C /* ScrollingCoordinator.cpp in Sources */,
 				0FC4E40E187F82E10045882C /* ScrollingCoordinatorIOS.mm in Sources */,

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (187581 => 187582)


--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2015-07-30 09:52:48 UTC (rev 187581)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2015-07-30 11:10:38 UTC (rev 187582)
@@ -55,6 +55,8 @@
 #include "AccessibilityTableColumn.h"
 #include "AccessibilityTableHeaderContainer.h"
 #include "AccessibilityTableRow.h"
+#include "AccessibilityTree.h"
+#include "AccessibilityTreeItem.h"
 #include "Document.h"
 #include "Editor.h"
 #include "ElementIterator.h"
@@ -291,6 +293,12 @@
     if (nodeHasRole(node, "gridcell") || nodeHasRole(node, "cell") || nodeHasRole(node, "columnheader") || nodeHasRole(node, "rowheader"))
         return AccessibilityARIAGridCell::create(renderer);
 
+    // aria tree
+    if (nodeHasRole(node, "tree"))
+        return AccessibilityTree::create(renderer);
+    if (nodeHasRole(node, "treeitem"))
+        return AccessibilityTreeItem::create(renderer);
+
 #if ENABLE(VIDEO)
     // media controls
     if (node && node->isMediaControlElement())

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (187581 => 187582)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.h	2015-07-30 09:52:48 UTC (rev 187581)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h	2015-07-30 11:10:38 UTC (rev 187582)
@@ -772,6 +772,8 @@
     virtual void addChildren() { }
     virtual void addChild(AccessibilityObject*) { }
     virtual void insertChild(AccessibilityObject*, unsigned) { }
+
+    virtual bool shouldIgnoreAttributeRole() const { return false; }
     
     virtual bool canHaveChildren() const { return true; }
     virtual bool hasChildren() const { return m_haveChildren; }

Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (187581 => 187582)


--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2015-07-30 09:52:48 UTC (rev 187581)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2015-07-30 11:10:38 UTC (rev 187582)
@@ -2497,7 +2497,9 @@
     if (!m_renderer)
         return UnknownRole;
 
-    if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole)
+    // Sometimes we need to ignore the attribute role. Like if a tree is malformed,
+    // we want to ignore the treeitem's attribute role.
+    if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole && !shouldIgnoreAttributeRole())
         return m_ariaRole;
     
     Node* node = m_renderer->node();

Added: trunk/Source/WebCore/accessibility/AccessibilityTree.cpp (0 => 187582)


--- trunk/Source/WebCore/accessibility/AccessibilityTree.cpp	                        (rev 0)
+++ trunk/Source/WebCore/accessibility/AccessibilityTree.cpp	2015-07-30 11:10:38 UTC (rev 187582)
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "AccessibilityTree.h"
+
+#include "AXObjectCache.h"
+#include "AccessibilityTreeItem.h"
+#include "Element.h"
+#include "HTMLNames.h"
+
+#include <wtf/Deque.h>
+
+namespace WebCore {
+
+using namespace HTMLNames;
+    
+AccessibilityTree::AccessibilityTree(RenderObject* renderer)
+    : AccessibilityRenderObject(renderer)
+{
+}
+    
+AccessibilityTree::~AccessibilityTree()
+{
+}
+    
+Ref<AccessibilityTree> AccessibilityTree::create(RenderObject* renderer)
+{
+    return adoptRef(*new AccessibilityTree(renderer));
+}
+    
+bool AccessibilityTree::computeAccessibilityIsIgnored() const
+{
+    return accessibilityIsIgnoredByDefault();
+}
+
+AccessibilityRole AccessibilityTree::determineAccessibilityRole()
+{
+    if ((m_ariaRole = determineAriaRoleAttribute()) != TreeRole)
+        return AccessibilityRenderObject::determineAccessibilityRole();
+
+    return isTreeValid() ? TreeRole : GroupRole;
+}
+
+bool AccessibilityTree::isTreeValid() const
+{
+    // A valid tree can only have treeitem or group of treeitems as a child
+    // http://www.w3.org/TR/wai-aria/roles#tree
+
+    Node* node = this->node();
+    if (!node)
+        return false;
+    
+    Deque<Node*> queue;
+    for (auto child = node->firstChild(); child; child = child->nextSibling())
+        queue.append(child);
+
+    while (!queue.isEmpty()) {
+        auto child = queue.takeFirst();
+
+        if (!is<Element>(*child))
+            continue;
+        if (nodeHasRole(child, "treeitem"))
+            continue;
+        if (!nodeHasRole(child, "group"))
+            return false;
+
+        for (auto groupChild = child->firstChild(); groupChild; groupChild = groupChild->nextSibling())
+            queue.append(groupChild);
+    }
+    return true;
+}
+
+} // namespace WebCore

Added: trunk/Source/WebCore/accessibility/AccessibilityTree.h (0 => 187582)


--- trunk/Source/WebCore/accessibility/AccessibilityTree.h	                        (rev 0)
+++ trunk/Source/WebCore/accessibility/AccessibilityTree.h	2015-07-30 11:10:38 UTC (rev 187582)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#ifndef AccessibilityTree_h
+#define AccessibilityTree_h
+
+#include "AccessibilityRenderObject.h"
+
+namespace WebCore {
+    
+class AccessibilityTree final : public AccessibilityRenderObject {
+public:
+    static Ref<AccessibilityTree> create(RenderObject*);
+    virtual ~AccessibilityTree();
+
+private:
+    explicit AccessibilityTree(RenderObject*);
+    virtual bool computeAccessibilityIsIgnored() const override;
+    virtual AccessibilityRole determineAccessibilityRole() override;
+    bool isTreeValid() const;
+};
+    
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_ACCESSIBILITY(AccessibilityTree, isTree())
+
+#endif // AccessibilityTree_h

Added: trunk/Source/WebCore/accessibility/AccessibilityTreeItem.cpp (0 => 187582)


--- trunk/Source/WebCore/accessibility/AccessibilityTreeItem.cpp	                        (rev 0)
+++ trunk/Source/WebCore/accessibility/AccessibilityTreeItem.cpp	2015-07-30 11:10:38 UTC (rev 187582)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "AccessibilityTreeItem.h"
+
+#include "AXObjectCache.h"
+#include "HTMLNames.h"
+
+namespace WebCore {
+    
+using namespace HTMLNames;
+    
+AccessibilityTreeItem::AccessibilityTreeItem(RenderObject* renderer)
+    : AccessibilityRenderObject(renderer)
+{
+}
+    
+AccessibilityTreeItem::~AccessibilityTreeItem()
+{
+}
+    
+Ref<AccessibilityTreeItem> AccessibilityTreeItem::create(RenderObject* renderer)
+{
+    return adoptRef(*new AccessibilityTreeItem(renderer));
+}
+
+AccessibilityRole AccessibilityTreeItem::determineAccessibilityRole()
+{
+    
+    // Walk the parent chain looking for a parent that is a tree. A treeitem is
+    // only considered valid if it is in a tree.
+    AccessibilityObject* parent = nullptr;
+    for (parent = parentObject(); parent && !parent->isTree(); parent = parent->parentObject()) { }
+    m_isTreeItemValid = parent;
+
+    return AccessibilityRenderObject::determineAccessibilityRole();
+}
+    
+} // namespace WebCore

Added: trunk/Source/WebCore/accessibility/AccessibilityTreeItem.h (0 => 187582)


--- trunk/Source/WebCore/accessibility/AccessibilityTreeItem.h	                        (rev 0)
+++ trunk/Source/WebCore/accessibility/AccessibilityTreeItem.h	2015-07-30 11:10:38 UTC (rev 187582)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
+ *     its contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AccessibilityTreeItem_h
+#define AccessibilityTreeItem_h
+
+#include "AccessibilityRenderObject.h"
+
+namespace WebCore {
+    
+class AccessibilityTreeItem final : public AccessibilityRenderObject {
+public:
+    static Ref<AccessibilityTreeItem> create(RenderObject*);
+    virtual ~AccessibilityTreeItem();
+
+    virtual bool shouldIgnoreAttributeRole() const override { return !m_isTreeItemValid; }
+
+private:
+    explicit AccessibilityTreeItem(RenderObject*);
+    virtual AccessibilityRole determineAccessibilityRole() override;
+    bool m_isTreeItemValid;
+};
+    
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_ACCESSIBILITY(AccessibilityTreeItem, isTreeItem())
+
+#endif // AccessibilityTreeItem_h
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to