Diff
Modified: trunk/LayoutTests/ChangeLog (102633 => 102634)
--- trunk/LayoutTests/ChangeLog 2011-12-12 23:51:08 UTC (rev 102633)
+++ trunk/LayoutTests/ChangeLog 2011-12-12 23:54:37 UTC (rev 102634)
@@ -1,3 +1,13 @@
+2011-12-12 Chris Fleizach <[email protected]>
+
+ AX: aria-hidden inheritance broken when applying to some descendants
+ https://bugs.webkit.org/show_bug.cgi?id=73940
+
+ Reviewed by Darin Adler.
+
+ * platform/mac/accessibility/aria-hidden-changes-for-non-ignored-elements-expected.txt: Added.
+ * platform/mac/accessibility/aria-hidden-changes-for-non-ignored-elements.html: Added.
+
2011-12-12 Jeremy Apthorp <[email protected]>
When the mouse is dragged out of an :active element, it should lose :hover.
Added: trunk/LayoutTests/platform/mac/accessibility/aria-hidden-changes-for-non-ignored-elements-expected.txt (0 => 102634)
--- trunk/LayoutTests/platform/mac/accessibility/aria-hidden-changes-for-non-ignored-elements-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/aria-hidden-changes-for-non-ignored-elements-expected.txt 2011-12-12 23:54:37 UTC (rev 102634)
@@ -0,0 +1,17 @@
+One
+Two
+Three
+This one does nothing
+checkbox
+This tests that when aria-hidden is toggled, it will clear out the cached children for non-ignored elements that are descendants.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS body.childAtIndex(3).childAtIndex(0).role is 'AXRole: AXButton'
+PASS body.childAtIndex(0).role is 'AXRole: AXCheckBox'
+PASS body.childAtIndex(3).childAtIndex(0).role is 'AXRole: AXButton'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/platform/mac/accessibility/aria-hidden-changes-for-non-ignored-elements.html (0 => 102634)
--- trunk/LayoutTests/platform/mac/accessibility/aria-hidden-changes-for-non-ignored-elements.html (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/aria-hidden-changes-for-non-ignored-elements.html 2011-12-12 23:54:37 UTC (rev 102634)
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+
+<div id="main">
+ <ul role="tabset">
+ <li role="tab" aria-selected="true">One</li><li role="tab">Two</li><li role="tab">Three</li>
+ </ul>
+ <div role="tabpanel">
+ <button id="button">This one does nothing</button>
+ </div>
+</div>
+
+<div role="checkbox">checkbox</div>
+
+<p id="description"></p>
+<div id="console"></div>
+<div id="notifications"></div>
+
+<script>
+
+ description("This tests that when aria-hidden is toggled, it will clear out the cached children for non-ignored elements that are descendants.");
+
+ if (window.accessibilityController) {
+
+ document.getElementById("body").focus();
+ var body = accessibilityController.focusedElement;
+
+ // Verify we can access the button inside the tab panel.
+ shouldBe("body.childAtIndex(3).childAtIndex(0).role", "'AXRole: AXButton'");
+
+ // Toggle aria-hidden, and we should not be able to access the same elements anymore.
+ document.getElementById("main").setAttribute("aria-hidden", "true");
+ shouldBe("body.childAtIndex(0).role", "'AXRole: AXCheckBox'");
+
+ // Toggle aria-hidden off again and we should again be able to access elements inside the tab panel.
+ document.getElementById("main").setAttribute("aria-hidden", "false");
+ shouldBe("body.childAtIndex(3).childAtIndex(0).role", "'AXRole: AXButton'");
+
+ }
+
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (102633 => 102634)
--- trunk/Source/WebCore/ChangeLog 2011-12-12 23:51:08 UTC (rev 102633)
+++ trunk/Source/WebCore/ChangeLog 2011-12-12 23:54:37 UTC (rev 102634)
@@ -1,3 +1,25 @@
+2011-12-12 Chris Fleizach <[email protected]>
+
+ AX: aria-hidden inheritance broken when applying to some descendants
+ https://bugs.webkit.org/show_bug.cgi?id=73940
+
+ Reviewed by Darin Adler.
+
+ When adding children, we were not updating the children cache for direct AX descendants.
+ This meant that toggling aria-hidden could result in a stale cache where elements would not be reachable.
+
+ Making this fix also exposed a problem in AccessibilityTable where the AccessibilityHeaderObject was not
+ being managed correctly as a mock element.
+
+ Test: platform/mac/accessibility/aria-hidden-changes-for-non-ignored-elements.html
+
+ * accessibility/AccessibilityRenderObject.cpp:
+ (WebCore::AccessibilityRenderObject::addChildren):
+ * accessibility/AccessibilityTable.cpp:
+ (WebCore::AccessibilityTable::clearChildren):
+ (WebCore::AccessibilityTable::headerContainer):
+ * accessibility/AccessibilityTable.h:
+
2011-12-12 Jeremy Apthorp <[email protected]>
When the mouse is dragged out of an :active element, it should lose :hover.
Modified: trunk/Source/WebCore/accessibility/AccessibilityMockObject.h (102633 => 102634)
--- trunk/Source/WebCore/accessibility/AccessibilityMockObject.h 2011-12-12 23:51:08 UTC (rev 102633)
+++ trunk/Source/WebCore/accessibility/AccessibilityMockObject.h 2011-12-12 23:54:37 UTC (rev 102634)
@@ -50,6 +50,12 @@
virtual void detachFromParent() { m_parent = 0; }
};
+inline AccessibilityMockObject* toAccessibilityMockObject(AccessibilityObject* object)
+{
+ ASSERT(!object || object->isMockObject());
+ return static_cast<AccessibilityMockObject*>(object);
+}
+
} // namespace WebCore
#endif // AccessibilityMockObject_h
Modified: trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (102633 => 102634)
--- trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2011-12-12 23:51:08 UTC (rev 102633)
+++ trunk/Source/WebCore/accessibility/AccessibilityRenderObject.cpp 2011-12-12 23:54:37 UTC (rev 102634)
@@ -3532,13 +3532,13 @@
// add all unignored acc children
for (RefPtr<AccessibilityObject> obj = firstChild(); obj; obj = obj->nextSibling()) {
+
+ // If the parent is asking for this child's children, then either it's the first time (and clearing is a no-op),
+ // or its visibility has changed. In the latter case, this child may have a stale child cached.
+ // This can prevent aria-hidden changes from working correctly. Hence, whenever a parent is getting children, ensure data is not stale.
+ obj->clearChildren();
+
if (obj->accessibilityIsIgnored()) {
-
- // If the parent is asking for this child's children, then either it's the first time (and clearing is a no-op),
- // or its visibility has changed. In the latter case, this child may have a stale child cached.
- // This can prevent aria-hidden changes from working correctly. Hence, whenever a parent is getting children, ensure data is not stale.
- obj->clearChildren();
-
AccessibilityChildrenVector children = obj->children();
unsigned length = children.size();
for (unsigned i = 0; i < length; ++i)
Modified: trunk/Source/WebCore/accessibility/AccessibilityTable.cpp (102633 => 102634)
--- trunk/Source/WebCore/accessibility/AccessibilityTable.cpp 2011-12-12 23:51:08 UTC (rev 102633)
+++ trunk/Source/WebCore/accessibility/AccessibilityTable.cpp 2011-12-12 23:54:37 UTC (rev 102634)
@@ -279,6 +279,11 @@
AccessibilityRenderObject::clearChildren();
m_rows.clear();
m_columns.clear();
+
+ if (m_headerContainer) {
+ m_headerContainer->detachFromParent();
+ m_headerContainer = 0;
+ }
}
void AccessibilityTable::addChildren()
@@ -366,12 +371,13 @@
AccessibilityObject* AccessibilityTable::headerContainer()
{
if (m_headerContainer)
- return m_headerContainer;
+ return m_headerContainer.get();
- m_headerContainer = static_cast<AccessibilityTableHeaderContainer*>(axObjectCache()->getOrCreate(TableHeaderContainerRole));
- m_headerContainer->setParent(this);
-
- return m_headerContainer;
+ AccessibilityMockObject* tableHeader = toAccessibilityMockObject(axObjectCache()->getOrCreate(TableHeaderContainerRole));
+ tableHeader->setParent(this);
+
+ m_headerContainer = tableHeader;
+ return m_headerContainer.get();
}
AccessibilityObject::AccessibilityChildrenVector& AccessibilityTable::columns()
Modified: trunk/Source/WebCore/accessibility/AccessibilityTable.h (102633 => 102634)
--- trunk/Source/WebCore/accessibility/AccessibilityTable.h 2011-12-12 23:51:08 UTC (rev 102633)
+++ trunk/Source/WebCore/accessibility/AccessibilityTable.h 2011-12-12 23:54:37 UTC (rev 102634)
@@ -41,7 +41,6 @@
namespace WebCore {
class AccessibilityTableCell;
-class AccessibilityTableHeaderContainer;
class AccessibilityTable : public AccessibilityRenderObject {
@@ -86,7 +85,7 @@
AccessibilityChildrenVector m_rows;
AccessibilityChildrenVector m_columns;
- AccessibilityTableHeaderContainer* m_headerContainer;
+ RefPtr<AccessibilityObject> m_headerContainer;
mutable bool m_isAccessibilityTable;
bool hasARIARole() const;