<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[159980] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/159980">159980</a></dd>
<dt>Author</dt> <dd>samuel_white@apple.com</dd>
<dt>Date</dt> <dd>2013-12-02 16:36:23 -0800 (Mon, 02 Dec 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre> AX: Add AXUIElementCountForSearchPredicate parameterized attribute.
https://bugs.webkit.org/show_bug.cgi?id=124561
Reviewed by Chris Fleizach.
Added test to verify that NSAccessibilityUIElementCountForSearchPredicateParameterizedAttribute
works as it should and updated existing test that has exposes this new attribute.
* platform/mac/accessibility/bounds-for-range-expected.txt:
* platform/mac/accessibility/search-predicate-element-count-expected.txt: Added.
* platform/mac/accessibility/search-predicate-element-count.html: Added.
Added ability to fetch the number of elements that match a specific criteria. This will enable VoiceOver
to interface with WebKit much more dynamically. We can now get an idea of how many interesting elements
exist on a page, and then fetch them in chunks as needed.
Test: platform/mac/accessibility/search-predicate-element-count.html
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::isAccessibilityTextSearchMatch):
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilitySearchCriteria::AccessibilitySearchCriteria):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute):
(-[WebAccessibilityObjectWrapper accessibilityParameterizedAttributeNames]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
Added function to verify that NSAccessibilityUIElementCountForSearchPredicateParameterizedAttribute works as it should.
* DumpRenderTree/AccessibilityUIElement.cpp:
(uiElementCountForSearchPredicateCallback):
(uiElementForSearchPredicateCallback):
(AccessibilityUIElement::getJSClass):
* DumpRenderTree/AccessibilityUIElement.h:
* DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:
(AccessibilityUIElement::uiElementCountForSearchPredicate):
* DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
(AccessibilityUIElement::uiElementCountForSearchPredicate):
* DumpRenderTree/mac/AccessibilityUIElementMac.mm:
(searchPredicateParameterizedAttributeForSearchCriteria):
(AccessibilityUIElement::uiElementCountForSearchPredicate):
(AccessibilityUIElement::uiElementForSearchPredicate):
* DumpRenderTree/win/AccessibilityUIElementWin.cpp:
(AccessibilityUIElement::uiElementCountForSearchPredicate):
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
(WTR::AccessibilityUIElement::uiElementCountForSearchPredicate):
* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
* WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
(WTR::AccessibilityUIElement::uiElementCountForSearchPredicate):
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::searchPredicateParameterizedAttributeForSearchCriteria):
(WTR::AccessibilityUIElement::uiElementCountForSearchPredicate):
(WTR::AccessibilityUIElement::uiElementForSearchPredicate):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilityboundsforrangeexpectedtxt">trunk/LayoutTests/platform/mac/accessibility/bounds-for-range-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityObjectcpp">trunk/Source/WebCore/accessibility/AccessibilityObject.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityObjecth">trunk/Source/WebCore/accessibility/AccessibilityObject.h</a></li>
<li><a href="#trunkSourceWebCoreaccessibilitymacWebAccessibilityObjectWrapperMacmm">trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreeAccessibilityUIElementcpp">trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp</a></li>
<li><a href="#trunkToolsDumpRenderTreeAccessibilityUIElementh">trunk/Tools/DumpRenderTree/AccessibilityUIElement.h</a></li>
<li><a href="#trunkToolsDumpRenderTreeatkAccessibilityUIElementAtkcpp">trunk/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp</a></li>
<li><a href="#trunkToolsDumpRenderTreeiosAccessibilityUIElementIOSmm">trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm</a></li>
<li><a href="#trunkToolsDumpRenderTreemacAccessibilityUIElementMacmm">trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm</a></li>
<li><a href="#trunkToolsDumpRenderTreewinAccessibilityUIElementWincpp">trunk/Tools/DumpRenderTree/win/AccessibilityUIElementWin.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleAccessibilityUIElementcpp">trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleAccessibilityUIElementh">trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleBindingsAccessibilityUIElementidl">trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleatkAccessibilityUIElementAtkcpp">trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundlemacAccessibilityUIElementMacmm">trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsplatformmacaccessibilitysearchpredicateelementcountexpectedtxt">trunk/LayoutTests/platform/mac/accessibility/search-predicate-element-count-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilitysearchpredicateelementcounthtml">trunk/LayoutTests/platform/mac/accessibility/search-predicate-element-count.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (159979 => 159980)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2013-12-03 00:10:21 UTC (rev 159979)
+++ trunk/LayoutTests/ChangeLog        2013-12-03 00:36:23 UTC (rev 159980)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2013-12-02 Samuel White <samuel_white@apple.com>
+
+ AX: Add AXUIElementCountForSearchPredicate parameterized attribute.
+ https://bugs.webkit.org/show_bug.cgi?id=124561
+
+ Reviewed by Chris Fleizach.
+
+ Added test to verify that NSAccessibilityUIElementCountForSearchPredicateParameterizedAttribute
+ works as it should and updated existing test that has exposes this new attribute.
+
+ * platform/mac/accessibility/bounds-for-range-expected.txt:
+ * platform/mac/accessibility/search-predicate-element-count-expected.txt: Added.
+ * platform/mac/accessibility/search-predicate-element-count.html: Added.
+
</ins><span class="cx"> 2013-12-02 Bem Jones-Bey <bjonesbe@adobe.com>
</span><span class="cx">
</span><span class="cx"> [css shapes] Layout support for new circle shape syntax
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilityboundsforrangeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/accessibility/bounds-for-range-expected.txt (159979 => 159980)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/bounds-for-range-expected.txt        2013-12-03 00:10:21 UTC (rev 159979)
+++ trunk/LayoutTests/platform/mac/accessibility/bounds-for-range-expected.txt        2013-12-03 00:36:23 UTC (rev 159980)
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx"> AXLengthForTextMarkerRange
</span><span class="cx"> AXBoundsForRange
</span><span class="cx"> AXStringForRange
</span><ins>+AXUIElementCountForSearchPredicate
</ins><span class="cx"> AXUIElementsForSearchPredicate
</span><span class="cx"> AXEndTextMarkerForBounds
</span><span class="cx"> AXStartTextMarkerForBounds
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilitysearchpredicateelementcountexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/search-predicate-element-count-expected.txt (0 => 159980)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/search-predicate-element-count-expected.txt         (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/search-predicate-element-count-expected.txt        2013-12-03 00:36:23 UTC (rev 159980)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+This tests that search predicate based element count results are accurate.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS elementCount is 2
+PASS elementCount is 3
+PASS elementCount is 4
+PASS elementCount is 5
+PASS elementCount is 6
+PASS elementCount is 6
+PASS elementCount is 4
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilitysearchpredicateelementcounthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/search-predicate-element-count.html (0 => 159980)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/search-predicate-element-count.html         (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/search-predicate-element-count.html        2013-12-03 00:36:23 UTC (rev 159980)
</span><span class="lines">@@ -0,0 +1,101 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../resources/js-test-pre.js"></script>
+<style>
+ .offscreen {
+ position:relative;
+ top:9999px;
+ }
+</style>
+<title>Search Predicate Element Count</title>
+</head>
+<body>
+
+<div id="container">
+<p id="start">Start</p>
+<!-- Tables. -->
+<table border="1">
+<tr><th>A</th><th>B</th></tr>
+<tr><td>C</td><td>D</td></tr>
+</table>
+<table border="1">
+<tr><th>W</th><th>X</th></tr>
+<tr><td>Y</td><td>Z</td></tr>
+</table>
+<br>
+<!-- Links. -->
+<a href="#">Link 1</a>
+<a href="#">Link 2</a>
+<a href="#">Link 3</a>
+<br>
+<!-- Images. -->
+<img alt="Cake" src="resources/cake.png">
+<img alt="Cake" src="resources/cake.png">
+<img alt="Cake" src="resources/cake.png">
+<img alt="Cake" src="resources/cake.png">
+<br>
+<!-- Inputs. -->
+<input type="submit" value="Submit">
+<input type="submit" value="Submit">
+<input type="submit" value="Submit">
+<input type="submit" value="Submit">
+<input type="submit" value="Submit">
+<br>
+<!-- Headings. -->
+<h1>Heading 1</h1>
+<h2>Heading 2</h2>
+<h3>Heading 3</h3>
+<h4>Heading 4</h4>
+<h5 class="offscreen">Heading 5</h5>
+<h6 class="offscreen">Heading 6</h6>
+</div>
+
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+ description("This tests that search predicate based element count results are accurate.");
+
+ if (window.accessibilityController) {
+ document.getElementById("container").focus();
+ var containerElement = accessibilityController.focusedElement;
+ var elementCount = 0;
+ var startElement = accessibilityController.accessibleElementById("start");
+
+ // Tables.
+ elementCount = containerElement.uiElementCountForSearchPredicate(startElement, true, "AXTableSearchKey", "", false);
+ shouldBe("elementCount", "2");
+
+ // Links.
+ elementCount = containerElement.uiElementCountForSearchPredicate(startElement, true, "AXLinkSearchKey", "", false);
+ shouldBe("elementCount", "3");
+
+ // Images.
+ elementCount = containerElement.uiElementCountForSearchPredicate(startElement, true, "AXGraphicSearchKey", "", false);
+ shouldBe("elementCount", "4");
+
+ // Inputs.
+ elementCount = containerElement.uiElementCountForSearchPredicate(startElement, true, "AXButtonSearchKey", "", false);
+ shouldBe("elementCount", "5");
+
+ // Headings.
+ elementCount = containerElement.uiElementCountForSearchPredicate(startElement, true, "AXHeadingSearchKey", "", false);
+ shouldBe("elementCount", "6");
+
+ // Onscreen
+ elementCount = containerElement.uiElementCountForSearchPredicate(startElement, true, "AXHeadingSearchKey", "", false);
+ shouldBe("elementCount", "6");
+
+ // Offscreen
+ elementCount = containerElement.uiElementCountForSearchPredicate(startElement, true, "AXHeadingSearchKey", "", true);
+ shouldBe("elementCount", "4");
+
+ // Hide superfluous text.
+ document.getElementById("container").style.display = "none";
+ }
+</script>
+
+<script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (159979 => 159980)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2013-12-03 00:10:21 UTC (rev 159979)
+++ trunk/Source/WebCore/ChangeLog        2013-12-03 00:36:23 UTC (rev 159980)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2013-12-02 Samuel White <samuel_white@apple.com>
+
+ AX: Add AXUIElementCountForSearchPredicate parameterized attribute.
+ https://bugs.webkit.org/show_bug.cgi?id=124561
+
+ Reviewed by Chris Fleizach.
+
+ Added ability to fetch the number of elements that match a specific criteria. This will enable VoiceOver
+ to interface with WebKit much more dynamically. We can now get an idea of how many interesting elements
+ exist on a page, and then fetch them in chunks as needed.
+
+ Test: platform/mac/accessibility/search-predicate-element-count.html
+
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::isAccessibilityTextSearchMatch):
+ * accessibility/AccessibilityObject.h:
+ (WebCore::AccessibilitySearchCriteria::AccessibilitySearchCriteria):
+ * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+ (accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute):
+ (-[WebAccessibilityObjectWrapper accessibilityParameterizedAttributeNames]):
+ (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]):
+
</ins><span class="cx"> 2013-12-02 Bem Jones-Bey <bjonesbe@adobe.com>
</span><span class="cx">
</span><span class="cx"> [css shapes] Layout support for new circle shape syntax
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (159979 => 159980)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp        2013-12-03 00:10:21 UTC (rev 159979)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp        2013-12-03 00:36:23 UTC (rev 159980)
</span><span class="lines">@@ -263,7 +263,7 @@
</span><span class="cx"> if (!axObject || !criteria)
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- return axObject->accessibilityObjectContainsText(criteria->searchText);
</del><ins>+ return axObject->accessibilityObjectContainsText(&criteria->searchText);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool AccessibilityObject::accessibilityObjectContainsText(String* text) const
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (159979 => 159980)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityObject.h        2013-12-03 00:10:21 UTC (rev 159979)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h        2013-12-03 00:36:23 UTC (rev 159980)
</span><span class="lines">@@ -339,16 +339,16 @@
</span><span class="cx"> AccessibilityObject* startObject;
</span><span class="cx"> AccessibilitySearchDirection searchDirection;
</span><span class="cx"> Vector<AccessibilitySearchKey> searchKeys;
</span><del>- String* searchText;
</del><ins>+ String searchText;
</ins><span class="cx"> unsigned resultsLimit;
</span><span class="cx"> bool visibleOnly;
</span><span class="cx">
</span><del>- AccessibilitySearchCriteria(AccessibilityObject* o, AccessibilitySearchDirection d, String* t, unsigned l, bool v)
- : startObject(o)
- , searchDirection(d)
- , searchText(t)
- , resultsLimit(l)
- , visibleOnly(v)
</del><ins>+ AccessibilitySearchCriteria(AccessibilityObject* startObject, AccessibilitySearchDirection searchDirection, String searchText, unsigned resultsLimit, bool visibleOnly)
+ : startObject(startObject)
+ , searchDirection(searchDirection)
+ , searchText(searchText)
+ , resultsLimit(resultsLimit)
+ , visibleOnly(visibleOnly)
</ins><span class="cx"> { }
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilitymacWebAccessibilityObjectWrapperMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (159979 => 159980)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm        2013-12-03 00:10:21 UTC (rev 159979)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm        2013-12-03 00:36:23 UTC (rev 159980)
</span><span class="lines">@@ -190,6 +190,10 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> // Search
</span><ins>+#ifndef NSAccessibilityUIElementCountForSearchPredicateParameterizedAttribute
+#define NSAccessibilityUIElementCountForSearchPredicateParameterizedAttribute @"AXUIElementCountForSearchPredicate"
+#endif
+
</ins><span class="cx"> #ifndef NSAccessibilityUIElementsForSearchPredicateParameterizedAttribute
</span><span class="cx"> #define NSAccessibilityUIElementsForSearchPredicateParameterizedAttribute @"AXUIElementsForSearchPredicate"
</span><span class="cx"> #endif
</span><span class="lines">@@ -536,6 +540,52 @@
</span><span class="cx"> return searchKey ? searchKey : AnyTypeSearchKey;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static AccessibilitySearchCriteria accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute(const NSDictionary *parameterizedAttribute)
+{
+ NSString *directionParameter = [parameterizedAttribute objectForKey:@"AXDirection"];
+ NSNumber *resultsLimitParameter = [parameterizedAttribute objectForKey:@"AXResultsLimit"];
+ NSString *searchTextParameter = [parameterizedAttribute objectForKey:@"AXSearchText"];
+ WebAccessibilityObjectWrapper *startElementParameter = [parameterizedAttribute objectForKey:@"AXStartElement"];
+ NSNumber *visibleOnlyParameter = [parameterizedAttribute objectForKey:@"AXVisibleOnly"];
+ id searchKeyParameter = [parameterizedAttribute objectForKey:@"AXSearchKey"];
+
+ AccessibilitySearchDirection direction = SearchDirectionNext;
+ if ([directionParameter isKindOfClass:[NSString class]])
+ direction = [directionParameter isEqualToString:@"AXDirectionNext"] ? SearchDirectionNext : SearchDirectionPrevious;
+
+ unsigned resultsLimit = 0;
+ if ([resultsLimitParameter isKindOfClass:[NSNumber class]])
+ resultsLimit = [resultsLimitParameter unsignedIntValue];
+
+ String searchText;
+ if ([searchTextParameter isKindOfClass:[NSString class]])
+ searchText = searchTextParameter;
+
+ AccessibilityObject *startElement = nullptr;
+ if ([startElementParameter isKindOfClass:[WebAccessibilityObjectWrapper class]])
+ startElement = [startElementParameter accessibilityObject];
+
+ BOOL visibleOnly = NO;
+ if ([visibleOnlyParameter isKindOfClass:[NSNumber class]])
+ visibleOnly = [visibleOnlyParameter boolValue];
+
+ AccessibilitySearchCriteria criteria = AccessibilitySearchCriteria(startElement, direction, searchText, resultsLimit, visibleOnly);
+
+ if ([searchKeyParameter isKindOfClass:[NSString class]])
+ criteria.searchKeys.append(accessibilitySearchKeyForString(searchKeyParameter));
+ else if ([searchKeyParameter isKindOfClass:[NSArray class]]) {
+ size_t searchKeyCount = static_cast<size_t>([searchKeyParameter count]);
+ criteria.searchKeys.reserveInitialCapacity(searchKeyCount);
+ for (size_t i = 0; i < searchKeyCount; ++i) {
+ NSString *searchKey = [searchKeyParameter objectAtIndex:i];
+ if ([searchKey isKindOfClass:[NSString class]])
+ criteria.searchKeys.uncheckedAppend(accessibilitySearchKeyForString(searchKey));
+ }
+ }
+
+ return criteria;
+}
+
</ins><span class="cx"> #pragma mark Text Marker helpers
</span><span class="cx">
</span><span class="cx"> static id textMarkerForVisiblePosition(AXObjectCache* cache, const VisiblePosition& visiblePos)
</span><span class="lines">@@ -2865,6 +2915,7 @@
</span><span class="cx"> @"AXLengthForTextMarkerRange",
</span><span class="cx"> NSAccessibilityBoundsForRangeParameterizedAttribute,
</span><span class="cx"> NSAccessibilityStringForRangeParameterizedAttribute,
</span><ins>+ NSAccessibilityUIElementCountForSearchPredicateParameterizedAttribute,
</ins><span class="cx"> NSAccessibilityUIElementsForSearchPredicateParameterizedAttribute,
</span><span class="cx"> NSAccessibilityEndTextMarkerForBoundsParameterizedAttribute,
</span><span class="cx"> NSAccessibilityStartTextMarkerForBoundsParameterizedAttribute,
</span><span class="lines">@@ -3254,45 +3305,17 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // dispatch
</span><ins>+ if ([attribute isEqualToString:NSAccessibilityUIElementCountForSearchPredicateParameterizedAttribute]) {
+ AccessibilitySearchCriteria criteria = accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute(dictionary);
+ AccessibilityObject::AccessibilityChildrenVector results;
+ m_object->findMatchingObjects(&criteria, results);
+ return @(results.size());
+ }
+
</ins><span class="cx"> if ([attribute isEqualToString:NSAccessibilityUIElementsForSearchPredicateParameterizedAttribute]) {
</span><del>- AccessibilityObject* startObject = 0;
- if ([[dictionary objectForKey:@"AXStartElement"] isKindOfClass:[WebAccessibilityObjectWrapper self]])
- startObject = [(WebAccessibilityObjectWrapper*)[dictionary objectForKey:@"AXStartElement"] accessibilityObject];
-
- AccessibilitySearchDirection searchDirection = SearchDirectionNext;
- if ([[dictionary objectForKey:@"AXDirection"] isKindOfClass:[NSString self]])
- searchDirection = ([(NSString*)[dictionary objectForKey:@"AXDirection"] isEqualToString:@"AXDirectionNext"]) ? SearchDirectionNext : SearchDirectionPrevious;
-
- String searchText;
- if ([[dictionary objectForKey:@"AXSearchText"] isKindOfClass:[NSString self]])
- searchText = (CFStringRef)[dictionary objectForKey:@"AXSearchText"];
-
- unsigned resultsLimit = 0;
- if ([[dictionary objectForKey:@"AXResultsLimit"] isKindOfClass:[NSNumber self]])
- resultsLimit = [(NSNumber*)[dictionary objectForKey:@"AXResultsLimit"] unsignedIntValue];
-
- BOOL visibleOnly = NO;
- if ([[dictionary objectForKey:@"AXVisibleOnly"] isKindOfClass:[NSNumber self]])
- visibleOnly = [(NSNumber*)[dictionary objectForKey:@"AXVisibleOnly"] boolValue];
-
- AccessibilitySearchCriteria criteria = AccessibilitySearchCriteria(startObject, searchDirection, &searchText, resultsLimit, visibleOnly);
-
- id searchKeyEntry = [dictionary objectForKey:@"AXSearchKey"];
- if ([searchKeyEntry isKindOfClass:[NSString class]])
- criteria.searchKeys.append(accessibilitySearchKeyForString((CFStringRef)searchKeyEntry));
- else if ([searchKeyEntry isKindOfClass:[NSArray class]]) {
- size_t length = static_cast<size_t>([(NSArray *)searchKeyEntry count]);
- criteria.searchKeys.reserveInitialCapacity(length);
- for (size_t i = 0; i < length; ++i) {
- id searchKey = [(NSArray *)searchKeyEntry objectAtIndex:i];
- if ([searchKey isKindOfClass:[NSString class]])
- criteria.searchKeys.append(accessibilitySearchKeyForString((CFStringRef)searchKey));
- }
- }
-
</del><ins>+ AccessibilitySearchCriteria criteria = accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute(dictionary);
</ins><span class="cx"> AccessibilityObject::AccessibilityChildrenVector results;
</span><span class="cx"> m_object->findMatchingObjects(&criteria, results);
</span><del>-
</del><span class="cx"> return convertToNSArray(results);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (159979 => 159980)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2013-12-03 00:10:21 UTC (rev 159979)
+++ trunk/Tools/ChangeLog        2013-12-03 00:36:23 UTC (rev 159980)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2013-12-02 Samuel White <samuel_white@apple.com>
+
+ AX: Add AXUIElementCountForSearchPredicate parameterized attribute.
+ https://bugs.webkit.org/show_bug.cgi?id=124561
+
+ Reviewed by Chris Fleizach.
+
+ Added function to verify that NSAccessibilityUIElementCountForSearchPredicateParameterizedAttribute works as it should.
+
+ * DumpRenderTree/AccessibilityUIElement.cpp:
+ (uiElementCountForSearchPredicateCallback):
+ (uiElementForSearchPredicateCallback):
+ (AccessibilityUIElement::getJSClass):
+ * DumpRenderTree/AccessibilityUIElement.h:
+ * DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:
+ (AccessibilityUIElement::uiElementCountForSearchPredicate):
+ * DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
+ (AccessibilityUIElement::uiElementCountForSearchPredicate):
+ * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+ (searchPredicateParameterizedAttributeForSearchCriteria):
+ (AccessibilityUIElement::uiElementCountForSearchPredicate):
+ (AccessibilityUIElement::uiElementForSearchPredicate):
+ * DumpRenderTree/win/AccessibilityUIElementWin.cpp:
+ (AccessibilityUIElement::uiElementCountForSearchPredicate):
+ * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp:
+ (WTR::AccessibilityUIElement::uiElementCountForSearchPredicate):
+ * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+ * WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl:
+ * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
+ (WTR::AccessibilityUIElement::uiElementCountForSearchPredicate):
+ * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+ (WTR::searchPredicateParameterizedAttributeForSearchCriteria):
+ (WTR::AccessibilityUIElement::uiElementCountForSearchPredicate):
+ (WTR::AccessibilityUIElement::uiElementForSearchPredicate):
+
</ins><span class="cx"> 2013-12-02 Dániel Bátyai <Batyai.Daniel@stud.u-szeged.hu>
</span><span class="cx">
</span><span class="cx"> Instead of a large 'if' block, each failure class should write it's own result in test_result_writer.py
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeAccessibilityUIElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp (159979 => 159980)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp        2013-12-03 00:10:21 UTC (rev 159979)
+++ trunk/Tools/DumpRenderTree/AccessibilityUIElement.cpp        2013-12-03 00:36:23 UTC (rev 159980)
</span><span class="lines">@@ -202,32 +202,52 @@
</span><span class="cx"> return JSValueMakeBoolean(context, toAXElement(thisObject)->attributedStringRangeIsMisspelled(location, length));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static JSValueRef uiElementCountForSearchPredicateCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ AccessibilityUIElement* startElement = nullptr;
+ bool isDirectionNext = true;
+ JSValueRef searchKey = nullptr;
+ JSRetainPtr<JSStringRef> searchText = nullptr;
+ bool visibleOnly = false;
+ if (argumentCount == 5) {
+ if (JSValueIsObject(context, arguments[0]))
+ startElement = toAXElement(JSValueToObject(context, arguments[0], exception));
+
+ isDirectionNext = JSValueToBoolean(context, arguments[1]);
+
+ searchKey = arguments[2];
+
+ if (JSValueIsString(context, arguments[3]))
+ searchText.adopt(JSValueToStringCopy(context, arguments[3], exception));
+
+ visibleOnly = JSValueToBoolean(context, arguments[4]);
+ }
+
+ return JSValueMakeNumber(context, toAXElement(thisObject)->uiElementCountForSearchPredicate(context, startElement, isDirectionNext, searchKey, searchText.get(), visibleOnly));
+}
+
</ins><span class="cx"> static JSValueRef uiElementForSearchPredicateCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
</span><span class="cx"> {
</span><del>- AccessibilityUIElement* startElement = 0;
</del><ins>+ AccessibilityUIElement* startElement = nullptr;
</ins><span class="cx"> bool isDirectionNext = true;
</span><ins>+ JSValueRef searchKey = nullptr;
+ JSRetainPtr<JSStringRef> searchText = nullptr;
</ins><span class="cx"> bool visibleOnly = false;
</span><del>- JSValueRef searchKey = 0;
- JSStringRef searchText = 0;
</del><span class="cx"> if (argumentCount == 5) {
</span><del>- JSObjectRef startElementObject = JSValueToObject(context, arguments[0], exception);
- if (startElementObject)
- startElement = toAXElement(startElementObject);
- isDirectionNext = JSValueToBoolean(context, arguments[1]);
</del><ins>+ if (JSValueIsObject(context, arguments[0]))
+ startElement = toAXElement(JSValueToObject(context, arguments[0], exception));
</ins><span class="cx">
</span><ins>+ isDirectionNext = JSValueToBoolean(context, arguments[1]);
+
</ins><span class="cx"> searchKey = arguments[2];
</span><span class="cx">
</span><span class="cx"> if (JSValueIsString(context, arguments[3]))
</span><del>- searchText = JSValueToStringCopy(context, arguments[3], exception);
</del><ins>+ searchText.adopt(JSValueToStringCopy(context, arguments[3], exception));
</ins><span class="cx">
</span><span class="cx"> visibleOnly = JSValueToBoolean(context, arguments[4]);
</span><span class="cx"> }
</span><del>- JSObjectRef resultObject = AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->uiElementForSearchPredicate(context, startElement, isDirectionNext, searchKey, searchText, visibleOnly));
-
- if (searchText)
- JSStringRelease(searchText);
</del><span class="cx">
</span><del>- return resultObject;
</del><ins>+ return AccessibilityUIElement::makeJSAccessibilityUIElement(context, toAXElement(thisObject)->uiElementForSearchPredicate(context, startElement, isDirectionNext, searchKey, searchText.get(), visibleOnly));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static JSValueRef indexOfChildCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
</span><span class="lines">@@ -1390,6 +1410,7 @@
</span><span class="cx"> { "stringForRange", stringForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx"> { "attributedStringForRange", attributedStringForRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx"> { "attributedStringRangeIsMisspelled", attributedStringRangeIsMisspelledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><ins>+ { "uiElementCountForSearchPredicate", uiElementCountForSearchPredicateCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeReadOnly },
</ins><span class="cx"> { "uiElementForSearchPredicate", uiElementForSearchPredicateCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx"> { "childAtIndex", childAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx"> { "linkedUIElementAtIndex", linkedUIElementAtIndexCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeAccessibilityUIElementh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/AccessibilityUIElement.h (159979 => 159980)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/AccessibilityUIElement.h        2013-12-03 00:10:21 UTC (rev 159979)
+++ trunk/Tools/DumpRenderTree/AccessibilityUIElement.h        2013-12-03 00:36:23 UTC (rev 159980)
</span><span class="lines">@@ -203,6 +203,7 @@
</span><span class="cx"> JSStringRef stringForRange(unsigned location, unsigned length);
</span><span class="cx"> JSStringRef attributedStringForRange(unsigned location, unsigned length);
</span><span class="cx"> bool attributedStringRangeIsMisspelled(unsigned location, unsigned length);
</span><ins>+ unsigned uiElementCountForSearchPredicate(JSContextRef, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly);
</ins><span class="cx"> AccessibilityUIElement uiElementForSearchPredicate(JSContextRef, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly);
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> void elementsForRange(unsigned location, unsigned length, Vector<AccessibilityUIElement>& elements);
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeatkAccessibilityUIElementAtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp (159979 => 159980)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp        2013-12-03 00:10:21 UTC (rev 159979)
+++ trunk/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp        2013-12-03 00:36:23 UTC (rev 159980)
</span><span class="lines">@@ -1092,6 +1092,12 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+unsigned AccessibilityUIElement::uiElementCountForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly)
+{
+ // FIXME: implement
+ return 0;
+}
+
</ins><span class="cx"> AccessibilityUIElement AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly)
</span><span class="cx"> {
</span><span class="cx"> // FIXME: implement
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeiosAccessibilityUIElementIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm (159979 => 159980)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm        2013-12-03 00:10:21 UTC (rev 159979)
+++ trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm        2013-12-03 00:36:23 UTC (rev 159980)
</span><span class="lines">@@ -797,6 +797,12 @@
</span><span class="cx"> // FIXME: implement
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+unsigned AccessibilityUIElement::uiElementCountForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly)
+{
+ // FIXME: implement
+ return 0;
+}
+
</ins><span class="cx"> AccessibilityUIElement AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly)
</span><span class="cx"> {
</span><span class="cx"> // FIXME: implement
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacAccessibilityUIElementMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm (159979 => 159980)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm        2013-12-03 00:10:21 UTC (rev 159979)
+++ trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm        2013-12-03 00:36:23 UTC (rev 159980)
</span><span class="lines">@@ -195,6 +195,56 @@
</span><span class="cx"> return [allElementString createJSStringRef];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static NSDictionary *searchPredicateParameterizedAttributeForSearchCriteria(JSContextRef context, AccessibilityUIElement *startElement, bool isDirectionNext, unsigned resultsLimit, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly)
+{
+ NSMutableDictionary *parameterizedAttribute = [NSMutableDictionary dictionary];
+
+ if (startElement && startElement->platformUIElement())
+ [parameterizedAttribute setObject:(id)startElement->platformUIElement() forKey:@"AXStartElement"];
+
+ [parameterizedAttribute setObject:(isDirectionNext) ? @"AXDirectionNext" : @"AXDirectionPrevious" forKey:@"AXDirection"];
+
+ [parameterizedAttribute setObject:@(resultsLimit) forKey:@"AXResultsLimit"];
+
+ if (searchKey) {
+ id searchKeyParameter = nil;
+ if (JSValueIsString(context, searchKey)) {
+ JSRetainPtr<JSStringRef> searchKeyString(Adopt, JSValueToStringCopy(context, searchKey, nullptr));
+ if (searchKeyString)
+ searchKeyParameter = [NSString stringWithJSStringRef:searchKeyString.get()];
+ }
+ else if (JSValueIsObject(context, searchKey)) {
+ JSObjectRef searchKeyArray = JSValueToObject(context, searchKey, nullptr);
+ unsigned searchKeyArrayLength = 0;
+
+ JSRetainPtr<JSStringRef> lengthPropertyString(Adopt, JSStringCreateWithUTF8CString("length"));
+ JSValueRef searchKeyArrayLengthValue = JSObjectGetProperty(context, searchKeyArray, lengthPropertyString.get(), nullptr);
+ if (searchKeyArrayLengthValue && JSValueIsNumber(context, searchKeyArrayLengthValue))
+ searchKeyArrayLength = static_cast<unsigned>(JSValueToNumber(context, searchKeyArrayLengthValue, nullptr));
+
+ for (unsigned i = 0; i < searchKeyArrayLength; ++i) {
+ JSValueRef searchKeyValue = JSObjectGetPropertyAtIndex(context, searchKeyArray, i, nullptr);
+ JSStringRef searchKeyString = JSValueToStringCopy(context, searchKeyValue, nullptr);
+ if (searchKeyString) {
+ if (!searchKeyParameter)
+ searchKeyParameter = [NSMutableArray array];
+ [searchKeyParameter addObject:[NSString stringWithJSStringRef:searchKeyString]];
+ JSStringRelease(searchKeyString);
+ }
+ }
+ }
+ if (searchKeyParameter)
+ [parameterizedAttribute setObject:searchKeyParameter forKey:@"AXSearchKey"];
+ }
+
+ if (searchText && JSStringGetLength(searchText))
+ [parameterizedAttribute setObject:[NSString stringWithJSStringRef:searchText] forKey:@"AXSearchText"];
+
+ [parameterizedAttribute setObject:@(visibleOnly) forKey:@"AXVisibleOnly"];
+
+ return parameterizedAttribute;
+}
+
</ins><span class="cx"> void AccessibilityUIElement::getLinkedUIElements(Vector<AccessibilityUIElement>& elementVector)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_AX_OBJC_EXCEPTIONS
</span><span class="lines">@@ -960,60 +1010,25 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-AccessibilityUIElement AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly)
</del><ins>+unsigned AccessibilityUIElement::uiElementCountForSearchPredicate(JSContextRef context, AccessibilityUIElement *startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly)
</ins><span class="cx"> {
</span><span class="cx"> BEGIN_AX_OBJC_EXCEPTIONS
</span><del>- NSMutableDictionary* parameter = [NSMutableDictionary dictionary];
- [parameter setObject:(isDirectionNext) ? @"AXDirectionNext" : @"AXDirectionPrevious" forKey:@"AXDirection"];
- if (visibleOnly)
- [parameter setObject:[NSNumber numberWithBool:YES] forKey:@"AXVisibleOnly"];
- [parameter setObject:[NSNumber numberWithInt:1] forKey:@"AXResultsLimit"];
- if (startElement && startElement->platformUIElement())
- [parameter setObject:(id)startElement->platformUIElement() forKey:@"AXStartElement"];
- if (searchKey) {
- if (JSValueIsString(context, searchKey)) {
- NSString *searchKeyParameter = nil;
- JSStringRef singleSearchKey = JSValueToStringCopy(context, searchKey, 0);
- if (singleSearchKey) {
- searchKeyParameter = [NSString stringWithJSStringRef:singleSearchKey];
- JSStringRelease(singleSearchKey);
- if (searchKeyParameter)
- [parameter setObject:searchKeyParameter forKey:@"AXSearchKey"];
- }
- }
- else if (JSValueIsObject(context, searchKey)) {
- NSMutableArray *searchKeyParameter = nil;
- JSObjectRef array = const_cast<JSObjectRef>(searchKey);
- unsigned arrayLength = 0;
- JSRetainPtr<JSStringRef> arrayLengthString(Adopt, JSStringCreateWithUTF8CString("length"));
- JSValueRef arrayLengthValue = JSObjectGetProperty(context, array, arrayLengthString.get(), 0);
- if (arrayLengthValue && JSValueIsNumber(context, arrayLengthValue))
- arrayLength = static_cast<unsigned>(JSValueToNumber(context, arrayLengthValue, 0));
-
- for (unsigned i = 0; i < arrayLength; ++i) {
- JSValueRef exception = 0;
- JSValueRef value = JSObjectGetPropertyAtIndex(context, array, i, &exception);
- if (exception)
- break;
- JSStringRef singleSearchKey = JSValueToStringCopy(context, value, &exception);
- if (exception)
- break;
- if (singleSearchKey) {
- if (!searchKeyParameter)
- searchKeyParameter = [NSMutableArray array];
- [searchKeyParameter addObject:[NSString stringWithJSStringRef:singleSearchKey]];
- JSStringRelease(singleSearchKey);
- }
- }
- if (searchKeyParameter)
- [parameter setObject:searchKeyParameter forKey:@"AXSearchKey"];
- }
- }
- if (searchText && JSStringGetLength(searchText))
- [parameter setObject:[NSString stringWithJSStringRef:searchText] forKey:@"AXSearchText"];
</del><ins>+ NSDictionary *parameterizedAttribute = searchPredicateParameterizedAttributeForSearchCriteria(context, startElement, isDirectionNext, UINT_MAX, searchKey, searchText, visibleOnly);
+ id value = [m_element accessibilityAttributeValue:@"AXUIElementCountForSearchPredicate" forParameter:parameterizedAttribute];
+ if ([value isKindOfClass:[NSNumber class]])
+ return [value unsignedIntValue];
+ END_AX_OBJC_EXCEPTIONS
</ins><span class="cx">
</span><del>- id uiElement = [[m_element accessibilityAttributeValue:@"AXUIElementsForSearchPredicate" forParameter:parameter] lastObject];
- return AccessibilityUIElement(uiElement);
</del><ins>+ return 0;
+}
+
+AccessibilityUIElement AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef context, AccessibilityUIElement *startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly)
+{
+ BEGIN_AX_OBJC_EXCEPTIONS
+ NSDictionary *parameterizedAttribute = searchPredicateParameterizedAttributeForSearchCriteria(context, startElement, isDirectionNext, 1, searchKey, searchText, visibleOnly);
+ id value = [m_element accessibilityAttributeValue:@"AXUIElementsForSearchPredicate" forParameter:parameterizedAttribute];
+ if ([value isKindOfClass:[NSArray class]])
+ return AccessibilityUIElement([value lastObject]);
</ins><span class="cx"> END_AX_OBJC_EXCEPTIONS
</span><span class="cx">
</span><span class="cx"> return nullptr;
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreewinAccessibilityUIElementWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/win/AccessibilityUIElementWin.cpp (159979 => 159980)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/win/AccessibilityUIElementWin.cpp        2013-12-03 00:10:21 UTC (rev 159979)
+++ trunk/Tools/DumpRenderTree/win/AccessibilityUIElementWin.cpp        2013-12-03 00:36:23 UTC (rev 159980)
</span><span class="lines">@@ -592,6 +592,11 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+unsigned AccessibilityUIElement::uiElementCountForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly)
+{
+ return 0;
+}
+
</ins><span class="cx"> AccessibilityUIElement AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly)
</span><span class="cx"> {
</span><span class="cx"> return 0;
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleAccessibilityUIElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp (159979 => 159980)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp        2013-12-03 00:10:21 UTC (rev 159979)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.cpp        2013-12-03 00:36:23 UTC (rev 159980)
</span><span class="lines">@@ -162,6 +162,7 @@
</span><span class="cx"> JSRetainPtr<JSStringRef> AccessibilityUIElement::stringForRange(unsigned, unsigned) { return 0; }
</span><span class="cx"> JSRetainPtr<JSStringRef> AccessibilityUIElement::attributedStringForRange(unsigned, unsigned) { return 0; }
</span><span class="cx"> bool AccessibilityUIElement::attributedStringRangeIsMisspelled(unsigned, unsigned) { return false; }
</span><ins>+unsigned AccessibilityUIElement::uiElementCountForSearchPredicate(JSContextRef, AccessibilityUIElement*, bool, JSValueRef, JSStringRef, bool) { return 0; }
</ins><span class="cx"> PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef, AccessibilityUIElement*, bool, JSValueRef, JSStringRef, bool) { return 0; }
</span><span class="cx"> PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::cellForColumnAndRow(unsigned, unsigned) { return 0; }
</span><span class="cx"> PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::horizontalScrollbar() const { return 0; }
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleAccessibilityUIElementh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h (159979 => 159980)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h        2013-12-03 00:10:21 UTC (rev 159979)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h        2013-12-03 00:36:23 UTC (rev 159980)
</span><span class="lines">@@ -199,6 +199,7 @@
</span><span class="cx"> JSRetainPtr<JSStringRef> stringForRange(unsigned location, unsigned length);
</span><span class="cx"> JSRetainPtr<JSStringRef> attributedStringForRange(unsigned location, unsigned length);
</span><span class="cx"> bool attributedStringRangeIsMisspelled(unsigned location, unsigned length);
</span><ins>+ unsigned uiElementCountForSearchPredicate(JSContextRef, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly);
</ins><span class="cx"> PassRefPtr<AccessibilityUIElement> uiElementForSearchPredicate(JSContextRef, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly);
</span><span class="cx">
</span><span class="cx"> // Table-specific
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleBindingsAccessibilityUIElementidl"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl (159979 => 159980)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl        2013-12-03 00:10:21 UTC (rev 159979)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/AccessibilityUIElement.idl        2013-12-03 00:36:23 UTC (rev 159980)
</span><span class="lines">@@ -145,6 +145,7 @@
</span><span class="cx"> DOMString stringForRange(unsigned long location, unsigned long length);
</span><span class="cx"> DOMString attributedStringForRange(unsigned long location, unsigned long length);
</span><span class="cx"> boolean attributedStringRangeIsMisspelled(unsigned long location, unsigned long length);
</span><ins>+ [PassContext] unsigned int uiElementCountForSearchPredicate(AccessibilityUIElement startElement, boolean isDirectionNext, object searchKey, DOMString searchText, boolean visibleOnly);
</ins><span class="cx"> [PassContext] AccessibilityUIElement uiElementForSearchPredicate(AccessibilityUIElement startElement, boolean isDirectionNext, object searchKey, DOMString searchText, boolean visibleOnly);
</span><span class="cx"> void setSelectedTextRange(unsigned long location, unsigned long length);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleatkAccessibilityUIElementAtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp (159979 => 159980)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp        2013-12-03 00:10:21 UTC (rev 159979)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp        2013-12-03 00:36:23 UTC (rev 159980)
</span><span class="lines">@@ -1157,6 +1157,12 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+unsigned AccessibilityUIElement::uiElementCountForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly)
+{
+ // FIXME: implement
+ return 0;
+}
+
</ins><span class="cx"> PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly)
</span><span class="cx"> {
</span><span class="cx"> // FIXME: implement
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundlemacAccessibilityUIElementMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm (159979 => 159980)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm        2013-12-03 00:10:21 UTC (rev 159979)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm        2013-12-03 00:36:23 UTC (rev 159980)
</span><span class="lines">@@ -210,6 +210,56 @@
</span><span class="cx"> return [allElementString createJSStringRef];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static NSDictionary *searchPredicateParameterizedAttributeForSearchCriteria(JSContextRef context, AccessibilityUIElement *startElement, bool isDirectionNext, unsigned resultsLimit, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly)
+{
+ NSMutableDictionary *parameterizedAttribute = [NSMutableDictionary dictionary];
+
+ if (startElement && startElement->platformUIElement())
+ [parameterizedAttribute setObject:(id)startElement->platformUIElement() forKey:@"AXStartElement"];
+
+ [parameterizedAttribute setObject:(isDirectionNext) ? @"AXDirectionNext" : @"AXDirectionPrevious" forKey:@"AXDirection"];
+
+ [parameterizedAttribute setObject:@(resultsLimit) forKey:@"AXResultsLimit"];
+
+ if (searchKey) {
+ id searchKeyParameter = nil;
+ if (JSValueIsString(context, searchKey)) {
+ JSRetainPtr<JSStringRef> searchKeyString(Adopt, JSValueToStringCopy(context, searchKey, nullptr));
+ if (searchKeyString)
+ searchKeyParameter = [NSString stringWithJSStringRef:searchKeyString.get()];
+ }
+ else if (JSValueIsObject(context, searchKey)) {
+ JSObjectRef searchKeyArray = JSValueToObject(context, searchKey, nullptr);
+ unsigned searchKeyArrayLength = 0;
+
+ JSRetainPtr<JSStringRef> lengthPropertyString(Adopt, JSStringCreateWithUTF8CString("length"));
+ JSValueRef searchKeyArrayLengthValue = JSObjectGetProperty(context, searchKeyArray, lengthPropertyString.get(), nullptr);
+ if (searchKeyArrayLengthValue && JSValueIsNumber(context, searchKeyArrayLengthValue))
+ searchKeyArrayLength = static_cast<unsigned>(JSValueToNumber(context, searchKeyArrayLengthValue, nullptr));
+
+ for (unsigned i = 0; i < searchKeyArrayLength; ++i) {
+ JSValueRef searchKeyValue = JSObjectGetPropertyAtIndex(context, searchKeyArray, i, nullptr);
+ JSStringRef searchKeyString = JSValueToStringCopy(context, searchKeyValue, nullptr);
+ if (searchKeyString) {
+ if (!searchKeyParameter)
+ searchKeyParameter = [NSMutableArray array];
+ [searchKeyParameter addObject:[NSString stringWithJSStringRef:searchKeyString]];
+ JSStringRelease(searchKeyString);
+ }
+ }
+ }
+ if (searchKeyParameter)
+ [parameterizedAttribute setObject:searchKeyParameter forKey:@"AXSearchKey"];
+ }
+
+ if (searchText && JSStringGetLength(searchText))
+ [parameterizedAttribute setObject:[NSString stringWithJSStringRef:searchText] forKey:@"AXSearchText"];
+
+ [parameterizedAttribute setObject:@(visibleOnly) forKey:@"AXVisibleOnly"];
+
+ return parameterizedAttribute;
+}
+
</ins><span class="cx"> void AccessibilityUIElement::getLinkedUIElements(Vector<RefPtr<AccessibilityUIElement> >& elementVector)
</span><span class="cx"> {
</span><span class="cx"> BEGIN_AX_OBJC_EXCEPTIONS
</span><span class="lines">@@ -995,60 +1045,25 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly)
</del><ins>+unsigned AccessibilityUIElement::uiElementCountForSearchPredicate(JSContextRef context, AccessibilityUIElement *startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly)
</ins><span class="cx"> {
</span><span class="cx"> BEGIN_AX_OBJC_EXCEPTIONS
</span><del>- NSMutableDictionary* parameter = [NSMutableDictionary dictionary];
- [parameter setObject:(isDirectionNext) ? @"AXDirectionNext" : @"AXDirectionPrevious" forKey:@"AXDirection"];
- if (visibleOnly)
- [parameter setObject:[NSNumber numberWithBool:YES] forKey:@"AXVisibleOnly"];
- [parameter setObject:[NSNumber numberWithInt:1] forKey:@"AXResultsLimit"];
- if (startElement && startElement->platformUIElement())
- [parameter setObject:(id)startElement->platformUIElement() forKey:@"AXStartElement"];
- if (searchKey) {
- if (JSValueIsString(context, searchKey)) {
- NSString *searchKeyParameter = nil;
- JSStringRef singleSearchKey = JSValueToStringCopy(context, searchKey, 0);
- if (singleSearchKey) {
- searchKeyParameter = [NSString stringWithJSStringRef:singleSearchKey];
- JSStringRelease(singleSearchKey);
- if (searchKeyParameter)
- [parameter setObject:searchKeyParameter forKey:@"AXSearchKey"];
- }
- }
- else if (JSValueIsObject(context, searchKey)) {
- NSMutableArray *searchKeyParameter = nil;
- JSObjectRef array = const_cast<JSObjectRef>(searchKey);
- unsigned arrayLength = 0;
- JSRetainPtr<JSStringRef> arrayLengthString(Adopt, JSStringCreateWithUTF8CString("length"));
- JSValueRef arrayLengthValue = JSObjectGetProperty(context, array, arrayLengthString.get(), 0);
- if (arrayLengthValue && JSValueIsNumber(context, arrayLengthValue))
- arrayLength = static_cast<unsigned>(JSValueToNumber(context, arrayLengthValue, 0));
-
- for (unsigned i = 0; i < arrayLength; ++i) {
- JSValueRef exception = 0;
- JSValueRef value = JSObjectGetPropertyAtIndex(context, array, i, &exception);
- if (exception)
- break;
- JSStringRef singleSearchKey = JSValueToStringCopy(context, value, &exception);
- if (exception)
- break;
- if (singleSearchKey) {
- if (!searchKeyParameter)
- searchKeyParameter = [NSMutableArray array];
- [searchKeyParameter addObject:[NSString stringWithJSStringRef:singleSearchKey]];
- JSStringRelease(singleSearchKey);
- }
- }
- if (searchKeyParameter)
- [parameter setObject:searchKeyParameter forKey:@"AXSearchKey"];
- }
- }
- if (searchText && JSStringGetLength(searchText))
- [parameter setObject:[NSString stringWithJSStringRef:searchText] forKey:@"AXSearchText"];
</del><ins>+ NSDictionary *parameterizedAttribute = searchPredicateParameterizedAttributeForSearchCriteria(context, startElement, isDirectionNext, UINT_MAX, searchKey, searchText, visibleOnly);
+ id value = [m_element accessibilityAttributeValue:@"AXUIElementCountForSearchPredicate" forParameter:parameterizedAttribute];
+ if ([value isKindOfClass:[NSNumber class]])
+ return [value unsignedIntValue];
+ END_AX_OBJC_EXCEPTIONS
</ins><span class="cx">
</span><del>- id uiElement = [[m_element accessibilityAttributeValue:@"AXUIElementsForSearchPredicate" forParameter:parameter] lastObject];
- return AccessibilityUIElement::create(uiElement);
</del><ins>+ return 0;
+}
+
+PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef context, AccessibilityUIElement *startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly)
+{
+ BEGIN_AX_OBJC_EXCEPTIONS
+ NSDictionary *parameterizedAttribute = searchPredicateParameterizedAttributeForSearchCriteria(context, startElement, isDirectionNext, 1, searchKey, searchText, visibleOnly);
+ id value = [m_element accessibilityAttributeValue:@"AXUIElementsForSearchPredicate" forParameter:parameterizedAttribute];
+ if ([value isKindOfClass:[NSArray class]])
+ return AccessibilityUIElement::create([value lastObject]);
</ins><span class="cx"> END_AX_OBJC_EXCEPTIONS
</span><span class="cx">
</span><span class="cx"> return nullptr;
</span></span></pre>
</div>
</div>
</body>
</html>