Modified: trunk/LayoutTests/ChangeLog (102048 => 102049)
--- trunk/LayoutTests/ChangeLog 2011-12-05 22:33:18 UTC (rev 102048)
+++ trunk/LayoutTests/ChangeLog 2011-12-05 22:41:52 UTC (rev 102049)
@@ -1,3 +1,13 @@
+2011-12-05 Chris Fleizach <[email protected]>
+
+ AX: web search mechanism does not work with frames
+ https://bugs.webkit.org/show_bug.cgi?id=73836
+
+ Reviewed by Beth Dakin.
+
+ * platform/mac/accessibility/search-with-frames-expected.txt: Added.
+ * platform/mac/accessibility/search-with-frames.html: Added.
+
2011-12-05 Hugo Parente Lima <[email protected]>
Last mouse event could be lost if a JS call to eventSender.leapForward is made
Added: trunk/LayoutTests/platform/mac/accessibility/search-with-frames-expected.txt (0 => 102049)
--- trunk/LayoutTests/platform/mac/accessibility/search-with-frames-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/search-with-frames-expected.txt 2011-12-05 22:41:52 UTC (rev 102049)
@@ -0,0 +1,24 @@
+
+This tests whether searching works to find frames and to find elements within frames.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS resultElement.role is 'AXRole: AXButton'
+PASS resultElement.title is 'AXTitle: button1'
+PASS resultElement.role is 'AXRole: AXButton'
+PASS resultElement.title is 'AXTitle: button2'
+PASS resultElement.role is 'AXRole: AXButton'
+PASS resultElement.title is 'AXTitle: button3'
+PASS resultElement.role is 'AXRole: AXButton'
+PASS resultElement.title is 'AXTitle: button2'
+PASS resultElement.role is 'AXRole: AXWebArea'
+PASS resultElement.description is 'AXDescription: frame1'
+PASS resultElement.role is 'AXRole: AXWebArea'
+PASS resultElement.description is 'AXDescription: frame1a'
+PASS resultElement.role is 'AXRole: AXWebArea'
+PASS resultElement.description is 'AXDescription: frame2'
+
Added: trunk/LayoutTests/platform/mac/accessibility/search-with-frames.html (0 => 102049)
--- trunk/LayoutTests/platform/mac/accessibility/search-with-frames.html (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/search-with-frames.html 2011-12-05 22:41:52 UTC (rev 102049)
@@ -0,0 +1,111 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script>
+var successfullyParsed = false;
+</script>
+<script src=""
+</head>
+<body id="body">
+
+<iframe width=500 height=500 id="frame1" title="frame1"></iframe>
+<iframe width=500 height=500 id="frame2" title="frame2"></iframe>
+<iframe width=500 height=500 id="frame3" title="frame3"></iframe>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+ window.layoutTestController.waitUntilDone();
+
+ // We have to play some games to get these frames to load their sources in a timely fashion.
+ document.getElementById("frame1").src = "" id='body1'><button id=button1>button1</button><BR><BR><BR></body>";
+ document.getElementById("frame2").src = ""
+ document.getElementById("frame3").src = "" id=button3>button3</button><BR><BR><BR></body>";
+
+</script>
+<script>
+ for (var k = 1; k <= 3; k++) {
+
+ // This block adds sub frames to each of the frames, with some content in them.
+ // When the last frame loads, it runs the test.
+
+ document.getElementById("frame" + k)._onload_ = function(e) {
+ var ifrm = document.createElement("iframe");
+ ifrm.setAttribute("name", e.target.id + "a");
+
+ if (e.target.id == "frame2") {
+ ifrm.setAttribute("src", "data:text/html,<body><button id=button2>button2</button></body>");
+ } else {
+ ifrm.setAttribute("src", "data:text/html,<body>text</body>");
+ }
+
+ ifrm.style.width = "200";
+ ifrm.style.height = "200";
+ this.contentDocument.childNodes[0].childNodes[1].appendChild(ifrm);
+ if (e.target.id == "frame3") {
+ ifrm._onload_ = function() {
+ runTest();
+ };
+ }
+ };
+ }
+
+</script>
+
+<script>
+
+ description("This tests whether searching works to find frames and to find elements within frames.");
+
+function runTest() {
+ if (window.accessibilityController) {
+
+ document.getElementById("body").focus();
+ var body = accessibilityController.focusedElement;
+
+ // Search for the buttons. This tests searching through the frames.
+ searchKey = "AXButtonSearchKey";
+ resultElement = body.uiElementForSearchPredicate("", true, searchKey, "");
+ shouldBe("resultElement.role", "'AXRole: AXButton'");
+ shouldBe("resultElement.title", "'AXTitle: button1'");
+
+ resultElement = body.uiElementForSearchPredicate(resultElement, true, searchKey, "");
+ shouldBe("resultElement.role", "'AXRole: AXButton'");
+ shouldBe("resultElement.title", "'AXTitle: button2'");
+
+ resultElement = body.uiElementForSearchPredicate(resultElement, true, searchKey, "");
+ shouldBe("resultElement.role", "'AXRole: AXButton'");
+ shouldBe("resultElement.title", "'AXTitle: button3'");
+
+ // Now search backwards.
+ resultElement = body.uiElementForSearchPredicate(resultElement, false, searchKey, "");
+ shouldBe("resultElement.role", "'AXRole: AXButton'");
+ shouldBe("resultElement.title", "'AXTitle: button2'");
+
+ // Search for the frames. First one is frame1
+ searchKey = "AXFrameSearchKey";
+ resultElement = body.uiElementForSearchPredicate("", true, searchKey, "");
+ shouldBe("resultElement.role", "'AXRole: AXWebArea'");
+ shouldBe("resultElement.description", "'AXDescription: frame1'");
+
+ // Next we should find the frame inside of frame1.
+ resultElement = body.uiElementForSearchPredicate(resultElement, true, searchKey, "");
+ shouldBe("resultElement.role", "'AXRole: AXWebArea'");
+ shouldBe("resultElement.description", "'AXDescription: frame1a'");
+
+ // Then we should find the frame after frame1.
+ resultElement = body.uiElementForSearchPredicate(resultElement, true, searchKey, "");
+ shouldBe("resultElement.role", "'AXRole: AXWebArea'");
+ shouldBe("resultElement.description", "'AXDescription: frame2'");
+ }
+
+ successfullyParsed = true;
+ window.layoutTestController.notifyDone();
+}
+
+</script>
+
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (102048 => 102049)
--- trunk/Source/WebCore/ChangeLog 2011-12-05 22:33:18 UTC (rev 102048)
+++ trunk/Source/WebCore/ChangeLog 2011-12-05 22:41:52 UTC (rev 102049)
@@ -1,3 +1,20 @@
+2011-12-05 Chris Fleizach <[email protected]>
+
+ AX: web search mechanism does not work with frames
+ https://bugs.webkit.org/show_bug.cgi?id=73836
+
+ Reviewed by Beth Dakin.
+
+ This allows searching for, and within, frames for elements using the accessibility
+ search mechanism.
+
+ Test: platform/mac/accessibility/search-with-frames.html
+
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::isAccessibilityObjectSearchMatch):
+ (WebCore::appendAccessibilityObject):
+ (WebCore::appendChildrenToArray):
+
2011-12-05 Anders Carlsson <[email protected]>
Make LayerFlushSchedulerClient::flushLayers indicate whether the flush was successful or not
Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (102048 => 102049)
--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2011-12-05 22:33:18 UTC (rev 102048)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp 2011-12-05 22:41:52 UTC (rev 102049)
@@ -132,9 +132,8 @@
return criteria->startObject
&& !axObject->hasSameFontColor(criteria->startObject->renderer());
- // FIXME: Handle this search key.
case FrameSearchKey:
- return false;
+ return axObject->isWebArea();
case GraphicSearchKey:
return axObject->isImage();
@@ -355,6 +354,25 @@
return accessibleObject;
}
+static void appendAccessibilityObject(AccessibilityObject* object, AccessibilityObject::AccessibilityChildrenVector& results)
+{
+ // Find the next descendant of this attachment object so search can continue through frames.
+ if (object->isAttachment()) {
+ Widget* widget = object->widgetForAttachmentView();
+ if (!widget || !widget->isFrameView())
+ return;
+
+ Document* doc = static_cast<FrameView*>(widget)->frame()->document();
+ if (!doc || !doc->renderer())
+ return;
+
+ object = object->axObjectCache()->getOrCreate(doc->renderer());
+ }
+
+ if (object)
+ results.append(object);
+}
+
static void appendChildrenToArray(AccessibilityObject* object, bool isForward, AccessibilityObject* startObject, AccessibilityObject::AccessibilityChildrenVector& results)
{
AccessibilityObject::AccessibilityChildrenVector searchChildren;
@@ -379,13 +397,12 @@
}
// This is broken into two statements so that it's easier read.
- // FIXME: Handle attachments.
if (isForward) {
for (size_t i = startIndex; i > endIndex; i--)
- results.append(searchChildren.at(i - 1).get());
+ appendAccessibilityObject(searchChildren.at(i - 1).get(), results);
} else {
for (size_t i = startIndex; i < endIndex; i++)
- results.append(searchChildren.at(i).get());
+ appendAccessibilityObject(searchChildren.at(i).get(), results);
}
}