Unreviewed, rolling out r131915.
authorossy@webkit.org <ossy@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Oct 2012 21:59:04 +0000 (21:59 +0000)
committerossy@webkit.org <ossy@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Oct 2012 21:59:04 +0000 (21:59 +0000)
http://trac.webkit.org/changeset/131915
https://bugs.webkit.org/show_bug.cgi?id=98787

It broke the build on platforms with \!HAVE(ACCESSIBILITY)

Source/WebCore:

* accessibility/AXObjectCache.cpp:
(WebCore::AXObjectCache::getOrCreate):
(WebCore::AXObjectCache::nodeIsTextControl):
* accessibility/AXObjectCache.h:
(WebCore):
* accessibility/AccessibilityARIAGrid.cpp:
(WebCore::AccessibilityARIAGrid::addChild):
(WebCore::AccessibilityARIAGrid::addChildren):
* accessibility/AccessibilityARIAGrid.h:
(AccessibilityARIAGrid):
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::elementRect):
(WebCore::AccessibilityNodeObject::addChildren):
(WebCore::AccessibilityNodeObject::textUnderElement):
* accessibility/AccessibilityNodeObject.h:
(AccessibilityNodeObject):
* accessibility/AccessibilityObject.cpp:
* accessibility/AccessibilityObject.h:
(AccessibilityObject):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::textIteratorBehaviorForTextRange):
(WebCore):
(WebCore::AccessibilityRenderObject::accessibilityIsIgnoredBase):
(WebCore::AccessibilityRenderObject::addChildren):
* accessibility/AccessibilityRenderObject.h:
(AccessibilityRenderObject):

LayoutTests:

* accessibility/aria-hidden-negates-no-visibility.html: Removed.
* platform/chromium/TestExpectations:
* platform/mac/accessibility/aria-hidden-negates-no-visibility-expected.txt: Removed.

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

15 files changed:
LayoutTests/ChangeLog
LayoutTests/accessibility/aria-hidden-negates-no-visibility.html [deleted file]
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/mac/accessibility/aria-hidden-negates-no-visibility-expected.txt [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AXObjectCache.cpp
Source/WebCore/accessibility/AXObjectCache.h
Source/WebCore/accessibility/AccessibilityARIAGrid.cpp
Source/WebCore/accessibility/AccessibilityARIAGrid.h
Source/WebCore/accessibility/AccessibilityNodeObject.cpp
Source/WebCore/accessibility/AccessibilityNodeObject.h
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/accessibility/AccessibilityObject.h
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/accessibility/AccessibilityRenderObject.h

index e966ef4..410cf74 100644 (file)
@@ -1,3 +1,15 @@
+2012-10-19  Csaba Osztrogon√°c  <ossy@webkit.org>
+
+        Unreviewed, rolling out r131915.
+        http://trac.webkit.org/changeset/131915
+        https://bugs.webkit.org/show_bug.cgi?id=98787
+
+        It broke the build on platforms with \!HAVE(ACCESSIBILITY)
+
+        * accessibility/aria-hidden-negates-no-visibility.html: Removed.
+        * platform/chromium/TestExpectations:
+        * platform/mac/accessibility/aria-hidden-negates-no-visibility-expected.txt: Removed.
+
 2012-10-19  Emil A Eklund  <eae@chromium.org>
 
         Unreviewed gardening, rebaselining deferred image tests for r131928.
diff --git a/LayoutTests/accessibility/aria-hidden-negates-no-visibility.html b/LayoutTests/accessibility/aria-hidden-negates-no-visibility.html
deleted file mode 100644 (file)
index 655c9dc..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
-<head>
-<script src="../fast/js/resources/js-test-pre.js"></script>
-</head>
-<body id="body">
-
-<h1 hidden id="heading1_1">heading1.1</h1>
-<h1 aria-hidden="true" id="heading1_2">heading1.2</h1>
-<h1 hidden aria-hidden="true" id="heading1_3">heading1.3</h1>
-
-<h1 hidden aria-hidden="false" id="heading2">heading2</h1>
-<h1 style="display:none;" aria-hidden="false" id="heading3">heading3</h1>
-<h1 style="visibility:hidden;" aria-hidden="false" id="heading4">heading4</h1>
-
-<div hidden aria-hidden="false" id="hiddenDiv">HiddenText1</div>
-<input type="text" aria-labelledby="hiddenDiv" id="textFieldWithHiddenLabeller">
-
-<p id="description"></p>
-<div id="console"></div>
-
-<script>
-
-    description("This tests ensures that aria-hidden=false will allow a node to be in the AX hierarchy even if it's not rendered or visible");
-
-    if (window.accessibilityController) {
-
-        // First groups of headings are actually hidde.n
-        var heading1_1 = accessibilityController.accessibleElementById("heading1_1");
-        shouldBeTrue("!heading1_1 || !heading1_1.isValid");
-
-        var heading1_2 = accessibilityController.accessibleElementById("heading1_2");
-        shouldBeTrue("!heading1_2 || !heading1_3.isValid");
-
-        var heading1_3 = accessibilityController.accessibleElementById("heading1_3");
-        shouldBeTrue("!heading1_3 || !heading1_3.isValid");
-
-        // These headings should be in AX tree despite being hidden.
-        var heading2 = accessibilityController.accessibleElementById("heading2");
-        shouldBe("heading2.role", "'AXRole: AXHeading'");
-
-        // Check that the order of these elements is correct based on DOM order.
-        var parent = heading2.parentElement();
-        shouldBeTrue("parent.childAtIndex(0).isEqual(heading2)");
-
-        var heading3 = accessibilityController.accessibleElementById("heading3");
-        shouldBe("heading3.role", "'AXRole: AXHeading'");
-        shouldBeTrue("parent.childAtIndex(1).isEqual(heading3)");
-
-        var heading4 = accessibilityController.accessibleElementById("heading4");
-        shouldBe("heading4.role", "'AXRole: AXHeading'");
-        shouldBeTrue("parent.childAtIndex(2).isEqual(heading4)");
-
-        // The aria-labelledby attribute should work even though hidden.
-        var textField = accessibilityController.accessibleElementById("textFieldWithHiddenLabeller");
-        debug("Textfield Title: " + textField.title);
-    }
-
-</script>
-
-<script src="../fast/js/resources/js-test-post.js"></script>
-</body>
-</html>
index 361f1ab..b82a5e0 100644 (file)
@@ -1422,7 +1422,6 @@ webkit.org/b/73912 accessibility/aria-checkbox-text.html [ Skip ]
 webkit.org/b/99665 accessibility/loading-iframe-sends-notification.html [ Skip ]
 
 webkit.org/b/73912 accessibility/aria-checkbox-sends-notification.html [ Failure Pass ]
-webkit.org/b/98787 accessibility/aria-hidden-negates-no-visibility.html [ Skip ]
 
 # -----------------------------------------------------------------
 # Test failures with Skia GPU rendering of canvas 2D
diff --git a/LayoutTests/platform/mac/accessibility/aria-hidden-negates-no-visibility-expected.txt b/LayoutTests/platform/mac/accessibility/aria-hidden-negates-no-visibility-expected.txt
deleted file mode 100644 (file)
index ddceff4..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-heading1.2
-
-
-
-This tests ensures that aria-hidden=false will allow a node to be in the AX hierarchy even if it's not rendered or visible
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS !heading1_1 || !heading1_1.isValid is true
-PASS !heading1_2 || !heading1_3.isValid is true
-PASS !heading1_3 || !heading1_3.isValid is true
-PASS heading2.role is 'AXRole: AXHeading'
-PASS parent.childAtIndex(0).isEqual(heading2) is true
-PASS heading3.role is 'AXRole: AXHeading'
-PASS parent.childAtIndex(1).isEqual(heading3) is true
-PASS heading4.role is 'AXRole: AXHeading'
-PASS parent.childAtIndex(2).isEqual(heading4) is true
-Textfield Title: AXTitle: 
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
index 6eaf4a4..8f18c8a 100644 (file)
@@ -1,3 +1,38 @@
+2012-10-19  Csaba Osztrogon√°c  <ossy@webkit.org>
+
+        Unreviewed, rolling out r131915.
+        http://trac.webkit.org/changeset/131915
+        https://bugs.webkit.org/show_bug.cgi?id=98787
+
+        It broke the build on platforms with \!HAVE(ACCESSIBILITY)
+
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::AXObjectCache::getOrCreate):
+        (WebCore::AXObjectCache::nodeIsTextControl):
+        * accessibility/AXObjectCache.h:
+        (WebCore):
+        * accessibility/AccessibilityARIAGrid.cpp:
+        (WebCore::AccessibilityARIAGrid::addChild):
+        (WebCore::AccessibilityARIAGrid::addChildren):
+        * accessibility/AccessibilityARIAGrid.h:
+        (AccessibilityARIAGrid):
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::elementRect):
+        (WebCore::AccessibilityNodeObject::addChildren):
+        (WebCore::AccessibilityNodeObject::textUnderElement):
+        * accessibility/AccessibilityNodeObject.h:
+        (AccessibilityNodeObject):
+        * accessibility/AccessibilityObject.cpp:
+        * accessibility/AccessibilityObject.h:
+        (AccessibilityObject):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::textIteratorBehaviorForTextRange):
+        (WebCore):
+        (WebCore::AccessibilityRenderObject::accessibilityIsIgnoredBase):
+        (WebCore::AccessibilityRenderObject::addChildren):
+        * accessibility/AccessibilityRenderObject.h:
+        (AccessibilityRenderObject):
+
 2012-10-19  Tony Chang  <tony@chromium.org>
 
         Unreviewed, rolling out r131936.
index 665abc0..8e32eb5 100644 (file)
@@ -316,14 +316,8 @@ AccessibilityObject* AXObjectCache::getOrCreate(Node* node)
     if (node->renderer())
         return getOrCreate(node->renderer());
 
-    if (!node->parentElement())
-        return 0;
-    
     // It's only allowed to create an AccessibilityObject from a Node if it's in a canvas subtree.
-    // Or if it's a hidden element, but we still want to expose it because of other ARIA attributes.
-    bool inCanvasSubtree = node->parentElement()->isInCanvasSubtree();
-    bool isHidden = !node->renderer() && isNodeAriaVisible(node);
-    if (!inCanvasSubtree && !isHidden)
+    if (!node->parentElement() || !node->parentElement()->isInCanvasSubtree())
         return 0;
 
     RefPtr<AccessibilityObject> newObj = createFromNode(node);
@@ -789,17 +783,6 @@ bool AXObjectCache::nodeIsTextControl(const Node* node)
     const AccessibilityObject* axObject = getOrCreate(const_cast<Node*>(node));
     return axObject && axObject->isTextControl();
 }
-    
-bool isNodeAriaVisible(Node* node)
-{
-    if (!node)
-        return false;
-    
-    if (!node->isElementNode())
-        return false;
-    
-    return equalIgnoringCase(toElement(node)->getAttribute(aria_hiddenAttr), "false");
-}
 
 } // namespace WebCore
 
index 34694c9..8f0f765 100644 (file)
@@ -208,9 +208,7 @@ private:
 };
 
 bool nodeHasRole(Node*, const String& role);
-// This will let you know if aria-hidden was explicitly set to false.
-bool isNodeAriaVisible(Node*);
-    
+
 #if !HAVE(ACCESSIBILITY)
 inline AXObjectCache::AXObjectCache(const Document* doc) : m_document(const_cast<Document*>(doc)), m_notificationPostTimer(this, 0) { }
 inline AXObjectCache::~AXObjectCache() { }
index 2232287..5e2106b 100644 (file)
@@ -66,7 +66,7 @@ PassRefPtr<AccessibilityARIAGrid> AccessibilityARIAGrid::create(RenderObject* re
     return adoptRef(obj);
 }
 
-bool AccessibilityARIAGrid::addTableCellChild(AccessibilityObject* child, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount)
+bool AccessibilityARIAGrid::addChild(AccessibilityObject* child, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount)
 {
     if (!child || !child->isTableRow() || child->ariaRoleAttribute() != RowRole)
         return false;
@@ -114,7 +114,7 @@ void AccessibilityARIAGrid::addChildren()
     unsigned columnCount = 0;
     for (RefPtr<AccessibilityObject> child = firstChild(); child; child = child->nextSibling()) {
 
-        if (!addTableCellChild(child.get(), appendedRows, columnCount)) {
+        if (!addChild(child.get(), appendedRows, columnCount)) {
             
             // in case the render tree doesn't match the expected ARIA hierarchy, look at the children
             if (!child->hasChildren())
@@ -125,7 +125,7 @@ void AccessibilityARIAGrid::addChildren()
             AccessibilityChildrenVector children = child->children();
             size_t length = children.size();
             for (size_t i = 0; i < length; ++i)
-                addTableCellChild(children[i].get(), appendedRows, columnCount);
+                addChild(children[i].get(), appendedRows, columnCount);
         }
     }
     
index 02da5b1..67e8804 100644 (file)
@@ -58,7 +58,7 @@ private:
     virtual bool supportsSelectedRows() { return true; }    
     virtual bool isMultiSelectable() const { return true; }
     
-    bool addTableCellChild(AccessibilityObject*, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount);
+    bool addChild(AccessibilityObject*, HashSet<AccessibilityObject*>& appendedRows, unsigned& columnCount);
 };
 
 } // namespace WebCore 
index 49b83ea..96c6da9 100644 (file)
@@ -222,26 +222,6 @@ LayoutRect AccessibilityNodeObject::elementRect() const
 {
     return boundingBoxRect();
 }
-    
-LayoutRect AccessibilityNodeObject::boundingBoxRect() const
-{
-    // AccessibilityNodeObjects have no mechanism yet to return a size or position.
-    // For now, let's return the position of the ancestor that does have a position,
-    // and make it the width of that parent, and about the height of a line of text, so that it's clear the object is a child of the parent.
-    
-    LayoutRect boundingBox;
-    
-    for (AccessibilityObject* positionProvider = parentObject(); positionProvider; positionProvider = positionProvider->parentObject()) {
-        if (positionProvider->isAccessibilityRenderObject()) {
-            LayoutRect parentRect = positionProvider->elementRect();
-            boundingBox.setSize(LayoutSize(parentRect.width(), FractionalLayoutUnit(std::min(10.0f, parentRect.height().toFloat()))));
-            boundingBox.setLocation(parentRect.location());
-            break;
-        }
-    }
-    
-    return boundingBox;
-}
 
 void AccessibilityNodeObject::setNode(Node* node)
 {
@@ -304,32 +284,6 @@ AccessibilityRole AccessibilityNodeObject::determineAccessibilityRole()
     return UnknownRole;
 }
 
-void AccessibilityNodeObject::insertChild(AccessibilityObject* child, unsigned index)
-{
-    if (!child)
-        return;
-    
-    // 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.
-    child->clearChildren();
-    
-    if (child->accessibilityIsIgnored()) {
-        AccessibilityChildrenVector children = child->children();
-        size_t length = children.size();
-        for (size_t i = 0; i < length; ++i)
-            m_children.insert(index + i, children[i]);
-    } else {
-        ASSERT(child->parentObject() == this);
-        m_children.insert(index, child);
-    }
-}
-
-void AccessibilityNodeObject::addChild(AccessibilityObject* child)
-{
-    insertChild(child, m_children.size());
-}
-
 void AccessibilityNodeObject::addChildren()
 {
     // If the need to add more children in addition to existing children arises, 
@@ -345,8 +299,19 @@ void AccessibilityNodeObject::addChildren()
     if (renderer() && !m_node->hasTagName(canvasTag))
         return;
     
-    for (Node* child = m_node->firstChild(); child; child = child->nextSibling())
-        addChild(axObjectCache()->getOrCreate(child));
+    for (Node* child = m_node->firstChild(); child; child = child->nextSibling()) {
+        RefPtr<AccessibilityObject> obj = axObjectCache()->getOrCreate(child);
+        obj->clearChildren();
+        if (obj->accessibilityIsIgnored()) {
+            AccessibilityChildrenVector children = obj->children();
+            size_t length = children.size();
+            for (size_t i = 0; i < length; ++i)
+                m_children.append(children[i]);
+        } else {
+            ASSERT(obj->parentObject() == this);
+            m_children.append(obj);
+        }
+    }
 }
 
 bool AccessibilityNodeObject::canHaveChildren() const
@@ -1435,9 +1400,7 @@ String AccessibilityNodeObject::textUnderElement() const
     // If this could be fixed, it'd be more accurate use TextIterator here.
     if (node->isElementNode())
         return toElement(node)->innerText();
-    else if (node->isTextNode())
-        return toText(node)->wholeText();
-    
+
     return String();
 }
 
index e1e161b..a2c9078 100644 (file)
@@ -158,9 +158,6 @@ protected:
 
     virtual AccessibilityRole determineAccessibilityRole();
     virtual void addChildren();
-    virtual void addChild(AccessibilityObject*);
-    virtual void insertChild(AccessibilityObject*, unsigned index);
-
     virtual bool canHaveChildren() const;
     virtual bool accessibilityIsIgnored() const;
     AccessibilityRole ariaRoleAttribute() const;
@@ -177,7 +174,6 @@ protected:
     void ariaLabeledByElements(Vector<Element*>& elements) const;
     String accessibilityDescriptionForElements(Vector<Element*> &elements) const;
     void elementsFromAttribute(Vector<Element*>& elements, const QualifiedName&) const;
-    virtual LayoutRect boundingBoxRect() const;
     String ariaDescribedByAttribute() const;
     
     Element* menuElementForMenuButton() const;
index ed071e2..b9bd9a9 100644 (file)
@@ -1776,19 +1776,6 @@ bool AccessibilityObject::ariaPressedIsPresent() const
     return !getAttribute(aria_pressedAttr).isEmpty();
 }
 
-TextIteratorBehavior AccessibilityObject::textIteratorBehaviorForTextRange() const
-{
-    TextIteratorBehavior behavior = TextIteratorIgnoresStyleVisibility;
-    
-#if PLATFORM(GTK)
-    // We need to emit replaced elements for GTK, and present
-    // them with the 'object replacement character' (0xFFFC).
-    behavior = static_cast<TextIteratorBehavior>(behavior | TextIteratorEmitsObjectReplacementCharacters);
-#endif
-    
-    return behavior;
-}
-    
 AccessibilityRole AccessibilityObject::buttonRoleType() const
 {
     // If aria-pressed is present, then it should be exposed as a toggle button.
index 873a5c6..ca19c87 100644 (file)
@@ -33,7 +33,6 @@
 #include "FloatQuad.h"
 #include "FractionalLayoutRect.h"
 #include "LayoutTypes.h"
-#include "TextIterator.h"
 #include "VisiblePosition.h"
 #include "VisibleSelection.h"
 #include <wtf/Forward.h>
@@ -574,7 +573,6 @@ public:
     virtual IntPoint clickPoint();
     static IntRect boundingBoxForQuads(RenderObject*, const Vector<FloatQuad>&);
     
-    TextIteratorBehavior textIteratorBehaviorForTextRange() const;
     virtual PlainTextRange selectedTextRange() const { return PlainTextRange(); }
     unsigned selectionStart() const { return selectedTextRange().start; }
     unsigned selectionEnd() const { return selectedTextRange().length; }
@@ -614,9 +612,6 @@ public:
     virtual void updateAccessibilityRole() { }
     const AccessibilityChildrenVector& children();
     virtual void addChildren() { }
-    virtual void addChild(AccessibilityObject*) { }
-    virtual void insertChild(AccessibilityObject*, unsigned) { }
-    
     virtual bool canHaveChildren() const { return true; }
     virtual bool hasChildren() const { return m_haveChildren; }
     virtual void updateChildrenIfNecessary();
index 687716c..dc5c841 100644 (file)
@@ -79,6 +79,7 @@
 #include "RenderedPosition.h"
 #include "Text.h"
 #include "TextControlInnerElements.h"
+#include "TextIterator.h"
 #include "htmlediting.h"
 #include "visible_units.h"
 #include <wtf/StdLibExtras.h>
@@ -598,6 +599,19 @@ String AccessibilityRenderObject::helpText() const
     return String();
 }
 
+static TextIteratorBehavior textIteratorBehaviorForTextRange()
+{
+    TextIteratorBehavior behavior = TextIteratorIgnoresStyleVisibility;
+
+#if PLATFORM(GTK)
+    // We need to emit replaced elements for GTK, and present
+    // them with the 'object replacement character' (0xFFFC).
+    behavior = static_cast<TextIteratorBehavior>(behavior | TextIteratorEmitsObjectReplacementCharacters);
+#endif
+
+    return behavior;
+}
+
 String AccessibilityRenderObject::textUnderElement() const
 {
     if (!m_renderer)
@@ -1021,17 +1035,10 @@ AccessibilityObjectInclusion AccessibilityRenderObject::accessibilityIsIgnoredBa
 {
     // The following cases can apply to any element that's a subclass of AccessibilityRenderObject.
     
-    if (!m_renderer)
+    // Ignore invisible elements.
+    if (!m_renderer || m_renderer->style()->visibility() != VISIBLE)
         return IgnoreObject;
 
-    if (m_renderer->style()->visibility() != VISIBLE) {
-        // aria-hidden is meant to override visibility as the determinant in AX hierarchy inclusion.
-        if (equalIgnoringCase(getAttribute(aria_hiddenAttr), "false"))
-            return DefaultBehavior;
-        
-        return IgnoreObject;
-    }
-    
     // Anything marked as aria-hidden or a child of something aria-hidden must be hidden.
     if (ariaIsHidden())
         return IgnoreObject;
@@ -2644,59 +2651,6 @@ void AccessibilityRenderObject::updateAttachmentViewParents()
 }
 #endif
 
-// Hidden children are those that are not rendered or visible, but are specifically marked as aria-hidden=false,
-// meaning that they should be exposed to the AX hierarchy.
-void AccessibilityRenderObject::addHiddenChildren()
-{
-    Node* node = this->node();
-    if (!node)
-        return;
-    
-    // First do a quick run through to determine if we have any hidden nodes (most often we will not).
-    // If we do have hidden nodes, we need to determine where to insert them so they match DOM order as close as possible.
-    bool shouldInsertHiddenNodes = false;
-    for (Node* child = node->firstChild(); child; child = child->nextSibling()) {
-        if (!child->renderer() && isNodeAriaVisible(child)) {
-            shouldInsertHiddenNodes = true;
-            break;
-        }
-    }
-    
-    if (!shouldInsertHiddenNodes)
-        return;
-    
-    // Iterate through all of the children, including those that may have already been added, and
-    // try to insert hidden nodes in the correct place in the DOM order.
-    unsigned insertionIndex = 0;
-    for (Node* child = node->firstChild(); child; child = child->nextSibling()) {
-        if (child->renderer()) {
-            // Find out where the last render sibling is located within m_children.
-            AccessibilityObject* childObject = axObjectCache()->get(child->renderer());
-            if (childObject && childObject->accessibilityIsIgnored()) {
-                AccessibilityChildrenVector children = childObject->children();
-                if (children.size())
-                    childObject = children.last().get();
-                else
-                    childObject = 0;
-            }
-
-            if (childObject)
-                insertionIndex = m_children.find(childObject) + 1;
-            continue;
-        }
-
-        if (!isNodeAriaVisible(child))
-            continue;
-        
-        unsigned previousSize = m_children.size();
-        if (insertionIndex > previousSize)
-            insertionIndex = previousSize;
-        
-        insertChild(axObjectCache()->getOrCreate(child), insertionIndex);
-        insertionIndex += (m_children.size() - previousSize);
-    }
-}
-    
 void AccessibilityRenderObject::addChildren()
 {
     // If the need to add more children in addition to existing children arises, 
@@ -2708,10 +2662,24 @@ void AccessibilityRenderObject::addChildren()
     if (!canHaveChildren())
         return;
     
-    for (RefPtr<AccessibilityObject> obj = firstChild(); obj; obj = obj->nextSibling())
-        addChild(obj.get());
+    // 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()) {
+            AccessibilityChildrenVector children = obj->children();
+            unsigned length = children.size();
+            for (unsigned i = 0; i < length; ++i)
+                m_children.append(children[i]);
+        } else {
+            ASSERT(obj->parentObject() == this);
+            m_children.append(obj);
+        }
+    }
     
-    addHiddenChildren();
     addAttachmentChildren();
     addImageMapChildren();
     addTextFieldChildren();
index b1752d3..57493f3 100644 (file)
@@ -246,7 +246,6 @@ private:
     bool isDescendantOfElementType(const QualifiedName& tagName) const;
     // This returns true if it's focusable but it's not content editable and it's not a control or ARIA control.
 
-    void addHiddenChildren();
     void addTextFieldChildren();
     void addImageMapChildren();
     void addCanvasChildren();