Title: [95992] branches/chromium/835

Diff

Copied: branches/chromium/835/LayoutTests/accessibility/aria-hidden-updates-alldescendants-expected.txt (from rev 94716, trunk/LayoutTests/accessibility/aria-hidden-updates-alldescendants-expected.txt) (0 => 95992)


--- branches/chromium/835/LayoutTests/accessibility/aria-hidden-updates-alldescendants-expected.txt	                        (rev 0)
+++ branches/chromium/835/LayoutTests/accessibility/aria-hidden-updates-alldescendants-expected.txt	2011-09-26 21:24:48 UTC (rev 95992)
@@ -0,0 +1,18 @@
+Steps
+
+test
+Step 1: Do something
+Step 2: Do another thing
+Step 3: Do one last thing
+This tests that if aria-hidden changes on an element, all it's existing children will update their children caches
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS main.childrenCount is 1
+PASS main.childrenCount is 2
+PASS main.childAtIndex(1).childrenCount is 1
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: branches/chromium/835/LayoutTests/accessibility/aria-hidden-updates-alldescendants.html (from rev 94716, trunk/LayoutTests/accessibility/aria-hidden-updates-alldescendants.html) (0 => 95992)


--- branches/chromium/835/LayoutTests/accessibility/aria-hidden-updates-alldescendants.html	                        (rev 0)
+++ branches/chromium/835/LayoutTests/accessibility/aria-hidden-updates-alldescendants.html	2011-09-26 21:24:48 UTC (rev 95992)
@@ -0,0 +1,57 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script>
+var successfullyParsed = false;
+</script>
+<script src=""
+</head>
+<body id="body">
+
+<div>
+        <h1 id="heading">Steps</h1>
+
+        <main id="main" tabindex=0>
+         test
+                <div tabindex="-1" class="step-one" aria-hidden="true"><span>Step 1: Do something</span></div>
+                <div tabindex="-1" class="step-two" aria-hidden="true"><span>Step 2: Do another thing</span></div>
+                <div tabindex="-1" class="step-three" aria-hidden="true"><span>Step 3: Do one last thing</span></div>
+        </main>
+
+</div>
+
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+
+    description("This tests that if aria-hidden changes on an element, all it's existing children will update their children caches");
+
+    if (window.accessibilityController) {
+          document.getElementById("main").focus();
+          
+          var main = accessibilityController.focusedElement;
+          // Access the element so the children cache is generated.
+          main.childAtIndex(0);
+          main.childAtIndex(1);
+          shouldBe("main.childrenCount", "1");
+
+          var group = document.getElementsByTagName('main')[0];
+          var items = group.getElementsByTagName('div');          
+          items[0].removeAttribute('aria-hidden');
+
+          // After removing aria-hidden, the new count should be 2.
+          shouldBe("main.childrenCount", "2");          
+          
+          // And most importantly, the DIV that was made non-hidden should have one child now.
+          shouldBe("main.childAtIndex(1).childrenCount", "1");
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src=""
+</body>
+</html>

Modified: branches/chromium/835/Source/WebCore/accessibility/AccessibilityObject.h (95991 => 95992)


--- branches/chromium/835/Source/WebCore/accessibility/AccessibilityObject.h	2011-09-26 21:17:30 UTC (rev 95991)
+++ branches/chromium/835/Source/WebCore/accessibility/AccessibilityObject.h	2011-09-26 21:24:48 UTC (rev 95992)
@@ -471,6 +471,8 @@
     virtual bool canHaveChildren() const { return true; }
     virtual bool hasChildren() const { return m_haveChildren; }
     virtual void updateChildrenIfNecessary();
+    virtual void clearChildren();
+
     virtual void selectedChildren(AccessibilityChildrenVector&) { }
     virtual void visibleChildren(AccessibilityChildrenVector&) { }
     virtual void tabChildren(AccessibilityChildrenVector&) { }
@@ -591,7 +593,6 @@
     mutable bool m_haveChildren;
     AccessibilityRole m_role;
     
-    virtual void clearChildren();
     virtual bool isDetached() const { return true; }
     
 #if PLATFORM(GTK)
Property changes on: branches/chromium/835/Source/WebCore/accessibility/AccessibilityObject.h
___________________________________________________________________

Added: svn:mergeinfo

Modified: branches/chromium/835/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (95991 => 95992)


--- branches/chromium/835/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2011-09-26 21:17:30 UTC (rev 95991)
+++ branches/chromium/835/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2011-09-26 21:24:48 UTC (rev 95992)
@@ -1701,7 +1701,7 @@
     // aria-hidden hides this object and any children
     AccessibilityObject* object = parentObject();
     while (object) {
-        if (object->isAccessibilityRenderObject() && equalIgnoringCase(static_cast<AccessibilityRenderObject*>(object)->getAttribute(aria_hiddenAttr), "true"))
+        if (equalIgnoringCase(object->getAttribute(aria_hiddenAttr), "true"))
             return true;
         object = object->parentObject();
     }
@@ -3325,7 +3325,7 @@
         if (!parent->isAccessibilityRenderObject())
             continue;
         
-        AccessibilityRenderObject* axParent = static_cast<AccessibilityRenderObject*>(parent);
+        AccessibilityRenderObject* axParent = toAccessibilityRenderObject(parent);
         
         // Send the children changed notification on the first accessibility render object ancestor.
         if (!sentChildrenChanged) {
@@ -3407,7 +3407,12 @@
     // add all unignored acc children
     for (RefPtr<AccessibilityObject> obj = firstChild(); obj; obj = obj->nextSibling()) {
         if (obj->accessibilityIsIgnored()) {
-            obj->updateChildrenIfNecessary();
+
+            // 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)
Property changes on: branches/chromium/835/Source/WebCore/accessibility/AccessibilityRenderObject.cpp
___________________________________________________________________

Added: svn:mergeinfo

_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to