Title: [91128] trunk
Revision
91128
Author
[email protected]
Date
2011-07-15 16:48:56 -0700 (Fri, 15 Jul 2011)

Log Message

Ensure that a single select element's child option elements are
reported correctly to accessibility clients if the children are
changed.

https://bugs.webkit.org/show_bug.cgi?id=64500
<rdar://problem/9773066>

Reviewed by Beth Dakin.

Source/WebCore:

Test: platform/win/accessibility/single-select-children-changed.html

* accessibility/AccessibilityMenuListPopup.cpp:
(WebCore::AccessibilityMenuListPopup::addChildren):
Remove a comment about WML, which we no longer support.
(WebCore::AccessibilityMenuListPopup::childrenChanged):
Don't just remove children that were detached - this will miss childen
that were dynamically added. Clear the children and re-add them.

LayoutTests:

* platform/win/accessibility/single-select-children-changed-expected.txt: Added.
* platform/win/accessibility/single-select-children-changed.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (91127 => 91128)


--- trunk/LayoutTests/ChangeLog	2011-07-15 23:39:06 UTC (rev 91127)
+++ trunk/LayoutTests/ChangeLog	2011-07-15 23:48:56 UTC (rev 91128)
@@ -1,3 +1,17 @@
+2011-07-12  Jon Honeycutt  <[email protected]>
+
+        Ensure that a single select element's child option elements are
+        reported correctly to accessibility clients if the children are
+        changed.
+
+        https://bugs.webkit.org/show_bug.cgi?id=64500
+        <rdar://problem/9773066>
+
+        Reviewed by Beth Dakin.
+
+        * platform/win/accessibility/single-select-children-changed-expected.txt: Added.
+        * platform/win/accessibility/single-select-children-changed.html: Added.
+
 2011-07-15  Vincent Scheib  <[email protected]>
 
         [chromium] updated test expectations.

Added: trunk/LayoutTests/platform/win/accessibility/single-select-children-changed-expected.txt (0 => 91128)


--- trunk/LayoutTests/platform/win/accessibility/single-select-children-changed-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/win/accessibility/single-select-children-changed-expected.txt	2011-07-15 23:48:56 UTC (rev 91128)
@@ -0,0 +1,7 @@
+
+This tests that non-multiple select elements expose their updated children if they change.
+
+
+PASS option.title === "Option 1" is true
+PASS option2.title === "Option 2" is true
+

Added: trunk/LayoutTests/platform/win/accessibility/single-select-children-changed.html (0 => 91128)


--- trunk/LayoutTests/platform/win/accessibility/single-select-children-changed.html	                        (rev 0)
+++ trunk/LayoutTests/platform/win/accessibility/single-select-children-changed.html	2011-07-15 23:48:56 UTC (rev 91128)
@@ -0,0 +1,41 @@
+<html>
+<head>
+    <link rel="stylesheet" href=""
+    <script src=""
+</head>
+
+<body id="body">
+
+<select id="selectElement" title="selectElement">
+    <option SELECTED>Option 1</option>
+</select>
+
+<p>This tests that non-multiple select elements expose their updated children if they change.</p>
+
+<p id="notDRT">This test should only be run inside of DumpRenderTree.</p>
+
+<p id="console"></p>
+
+<script>
+    if (window.layoutTestController && window.accessibilityController) {
+        document.getElementById("notDRT").style.visibility = "hidden";
+
+        layoutTestController.dumpAsText();
+
+        document.getElementById("selectElement").focus();
+        var selectElement = accessibilityController.focusedElement;
+        var list = accessibilityController.focusedElement.childAtIndex(0);
+
+        var option = list.childAtIndex(0);
+        shouldBeTrue('option.title === "Option 1"');
+
+        var newOption = document.createElement("option");
+        newOption.innerHTML = "Option 2";
+        document.getElementById("selectElement").appendChild(newOption);
+
+        var option2 = list.childAtIndex(1);
+        shouldBeTrue('option2.title === "Option 2"');
+    }
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (91127 => 91128)


--- trunk/Source/WebCore/ChangeLog	2011-07-15 23:39:06 UTC (rev 91127)
+++ trunk/Source/WebCore/ChangeLog	2011-07-15 23:48:56 UTC (rev 91128)
@@ -1,3 +1,23 @@
+2011-07-12  Jon Honeycutt  <[email protected]>
+
+        Ensure that a single select element's child option elements are
+        reported correctly to accessibility clients if the children are
+        changed.
+
+        https://bugs.webkit.org/show_bug.cgi?id=64500
+        <rdar://problem/9773066>
+
+        Reviewed by Beth Dakin.
+
+        Test: platform/win/accessibility/single-select-children-changed.html
+
+        * accessibility/AccessibilityMenuListPopup.cpp:
+        (WebCore::AccessibilityMenuListPopup::addChildren):
+        Remove a comment about WML, which we no longer support.
+        (WebCore::AccessibilityMenuListPopup::childrenChanged):
+        Don't just remove children that were detached - this will miss childen
+        that were dynamically added. Clear the children and re-add them.
+
 2011-07-15  Rob Buis  <[email protected]>
 
         Stroking of zero-length paths in SVG should change according to erratum

Modified: trunk/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp (91127 => 91128)


--- trunk/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp	2011-07-15 23:39:06 UTC (rev 91127)
+++ trunk/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp	2011-07-15 23:48:56 UTC (rev 91128)
@@ -95,8 +95,6 @@
     const Vector<Element*>& listItems = static_cast<HTMLSelectElement*>(selectNode)->listItems();
     unsigned length = listItems.size();
     for (unsigned i = 0; i < length; i++) {
-        // The cast to HTMLElement below is safe because the only other possible listItem type
-        // would be a WMLElement, but WML builds don't use accessbility features at all.
         AccessibilityMenuListOption* option = menuListOptionAccessibilityObject(toHTMLElement(listItems[i]));
         if (option) {
             option->setParent(this);
@@ -111,9 +109,11 @@
         AccessibilityObject* child = m_children[i - 1].get();
         if (child->actionElement() && !child->actionElement()->attached()) {
             m_menuList->renderer()->document()->axObjectCache()->remove(child->axObjectID());
-            m_children.remove(i - 1);
         }
     }
+    m_children.clear();
+    m_haveChildren = false;
+    addChildren();
 }
 
 void AccessibilityMenuListPopup::setMenuList(AccessibilityMenuList* menuList)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to