<!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>[211411] 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/211411">211411</a></dd>
<dt>Author</dt> <dd>cfleizach@apple.com</dd>
<dt>Date</dt> <dd>2017-01-31 00:07:49 -0800 (Tue, 31 Jan 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>AX: enable search predication for iOS
https://bugs.webkit.org/show_bug.cgi?id=167558
&lt;rdar://problem/30251367&gt;

Reviewed by Joanmarie Diggs.

Source/WebCore:

Move the code to support accessibility searching into a shared place so it can be used by iOS.

Test: accessibility/ios-simulator/ios-search-predicate.html

* accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
(-[WebAccessibilityObjectWrapper accessibilityFindMatchingObjects:]):
* accessibility/mac/WebAccessibilityObjectWrapperBase.h:
* accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
(convertToNSArray):
(createAccessibilitySearchKeyMap):
(accessibilitySearchKeyForString):
(accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute):
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(createAccessibilitySearchKeyMap): Deleted.
(accessibilitySearchKeyForString): Deleted.
(accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute): Deleted.
(convertToNSArray): Deleted.

Tools:

* DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
(AccessibilityUIElement::uiElementForSearchPredicate):
* DumpRenderTree/mac/AccessibilityCommonMac.h:
* DumpRenderTree/mac/AccessibilityCommonMac.mm:
(searchPredicateParameterizedAttributeForSearchCriteria):
* DumpRenderTree/mac/AccessibilityUIElementMac.mm:
(searchPredicateParameterizedAttributeForSearchCriteria): Deleted.
* WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
(WTR::AccessibilityUIElement::uiElementCountForSearchPredicate):
(WTR::AccessibilityUIElement::uiElementForSearchPredicate):
* WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.h:
* WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.mm:
(WTR::searchPredicateParameterizedAttributeForSearchCriteria):
* WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
(WTR::searchPredicateParameterizedAttributeForSearchCriteria): Deleted.
* WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:

LayoutTests:

Add basic searching smoke test to ensure fundamentals work on iOS.

* accessibility/ios-simulator/ios-search-predicate-expected.txt: Added.
* accessibility/ios-simulator/ios-search-predicate.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityiosWebAccessibilityObjectWrapperIOSmm">trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm</a></li>
<li><a href="#trunkSourceWebCoreaccessibilitymacWebAccessibilityObjectWrapperBaseh">trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.h</a></li>
<li><a href="#trunkSourceWebCoreaccessibilitymacWebAccessibilityObjectWrapperBasemm">trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm</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="#trunkToolsDumpRenderTreeiosAccessibilityUIElementIOSmm">trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm</a></li>
<li><a href="#trunkToolsDumpRenderTreemacAccessibilityCommonMach">trunk/Tools/DumpRenderTree/mac/AccessibilityCommonMac.h</a></li>
<li><a href="#trunkToolsDumpRenderTreemacAccessibilityCommonMacmm">trunk/Tools/DumpRenderTree/mac/AccessibilityCommonMac.mm</a></li>
<li><a href="#trunkToolsDumpRenderTreemacAccessibilityUIElementMacmm">trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleiosAccessibilityUIElementIOSmm">trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundlemacAccessibilityCommonMach">trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundlemacAccessibilityCommonMacmm">trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundlemacAccessibilityUIElementMacmm">trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunnerWebKitTestRunnerxcodeprojprojectpbxproj">trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsaccessibilityiossimulatoriossearchpredicateexpectedtxt">trunk/LayoutTests/accessibility/ios-simulator/ios-search-predicate-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilityiossimulatoriossearchpredicatehtml">trunk/LayoutTests/accessibility/ios-simulator/ios-search-predicate.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (211410 => 211411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-01-31 07:21:43 UTC (rev 211410)
+++ trunk/LayoutTests/ChangeLog        2017-01-31 08:07:49 UTC (rev 211411)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2017-01-31  Chris Fleizach  &lt;cfleizach@apple.com&gt;
+
+        AX: enable search predication for iOS
+        https://bugs.webkit.org/show_bug.cgi?id=167558
+        &lt;rdar://problem/30251367&gt;
+
+        Reviewed by Joanmarie Diggs.
+
+        Add basic searching smoke test to ensure fundamentals work on iOS.
+
+        * accessibility/ios-simulator/ios-search-predicate-expected.txt: Added.
+        * accessibility/ios-simulator/ios-search-predicate.html: Added.
+
</ins><span class="cx"> 2017-01-30  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Implement PerformanceObserver
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilityiossimulatoriossearchpredicateexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/ios-simulator/ios-search-predicate-expected.txt (0 => 211411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/ios-simulator/ios-search-predicate-expected.txt                                (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/ios-search-predicate-expected.txt        2017-01-31 08:07:49 UTC (rev 211411)
</span><span class="lines">@@ -0,0 +1,30 @@
</span><ins>+start
+first heading level 1
+
+second heading level 1
+
+heading level 2
+
+heading level 3
+
+heading level 4
+
+heading level 5
+
+heading level 6
+
+This tests the ability to search for accessible elements by key or text.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS resultElement.childAtIndex(0).description is 'AXLabel: first heading level 1'
+PASS resultElement.childAtIndex(0).description is 'AXLabel: heading level 2'
+PASS resultElement.childAtIndex(0).description is 'AXLabel: heading level 3'
+PASS resultElement.childAtIndex(0).description is 'AXLabel: heading level 4'
+PASS resultElement.childAtIndex(0).description is 'AXLabel: heading level 5'
+PASS resultElement.childAtIndex(0).description is 'AXLabel: heading level 6'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsaccessibilityiossimulatoriossearchpredicatehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/accessibility/ios-simulator/ios-search-predicate.html (0 => 211411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/ios-simulator/ios-search-predicate.html                                (rev 0)
+++ trunk/LayoutTests/accessibility/ios-simulator/ios-search-predicate.html        2017-01-31 08:07:49 UTC (rev 211411)
</span><span class="lines">@@ -0,0 +1,67 @@
</span><ins>+&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body id=&quot;body&quot;&gt;
+
+&lt;button&gt;start&lt;/button&gt;
+
+&lt;h1&gt;first heading level 1&lt;/h1&gt;
+&lt;h1&gt;second heading level 1&lt;/h1&gt;
+&lt;h2&gt;heading level 2&lt;/h2&gt;
+&lt;h3&gt;heading level 3&lt;/h3&gt;
+&lt;h4&gt;heading level 4&lt;/h4&gt;
+&lt;h5&gt;heading level 5&lt;/h5&gt;
+&lt;h6&gt;heading level 6&lt;/h6&gt;
+
+    
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+    description(&quot;This tests the ability to search for accessible elements by key or text.&quot;);
+    
+    if (window.accessibilityController) {
+        window.testRunner.keepWebHistory();
+        
+        var containerElement = accessibilityController.rootElement;
+        var startElement;
+        var resultElement;
+
+        // Heading level 1.
+        startElement = accessibilityController.focusedElement.childAtIndex(0);
+        resultElement = containerElement.uiElementForSearchPredicate(startElement, true, &quot;AXHeadingLevel1SearchKey&quot;, &quot;&quot;, false);
+        shouldBe(&quot;resultElement.childAtIndex(0).description&quot;, &quot;'AXLabel: first heading level 1'&quot;);
+        
+        // Heading level 2.
+        startElement = accessibilityController.focusedElement.childAtIndex(0);
+        resultElement = containerElement.uiElementForSearchPredicate(startElement, true, &quot;AXHeadingLevel2SearchKey&quot;, &quot;&quot;, false);
+        shouldBe(&quot;resultElement.childAtIndex(0).description&quot;, &quot;'AXLabel: heading level 2'&quot;);
+        
+        // Heading level 3.
+        startElement = accessibilityController.focusedElement.childAtIndex(0);
+        resultElement = containerElement.uiElementForSearchPredicate(startElement, true, &quot;AXHeadingLevel3SearchKey&quot;, &quot;&quot;, false);
+        shouldBe(&quot;resultElement.childAtIndex(0).description&quot;, &quot;'AXLabel: heading level 3'&quot;);
+        
+        // Heading level 4.
+        startElement = accessibilityController.focusedElement.childAtIndex(0);
+        resultElement = containerElement.uiElementForSearchPredicate(startElement, true, &quot;AXHeadingLevel4SearchKey&quot;, &quot;&quot;, false);
+        shouldBe(&quot;resultElement.childAtIndex(0).description&quot;, &quot;'AXLabel: heading level 4'&quot;);
+        
+        // Heading level 5.
+        startElement = accessibilityController.focusedElement.childAtIndex(0);
+        resultElement = containerElement.uiElementForSearchPredicate(startElement, true, &quot;AXHeadingLevel5SearchKey&quot;, &quot;&quot;, false);
+        shouldBe(&quot;resultElement.childAtIndex(0).description&quot;, &quot;'AXLabel: heading level 5'&quot;);
+        
+        // Heading level 6.
+        startElement = accessibilityController.focusedElement.childAtIndex(0);
+        resultElement = containerElement.uiElementForSearchPredicate(startElement, true, &quot;AXHeadingLevel6SearchKey&quot;, &quot;&quot;, false);
+        shouldBe(&quot;resultElement.childAtIndex(0).description&quot;, &quot;'AXLabel: heading level 6'&quot;);        
+    }
+    
+&lt;/script&gt;
+
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (211410 => 211411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-01-31 07:21:43 UTC (rev 211410)
+++ trunk/Source/WebCore/ChangeLog        2017-01-31 08:07:49 UTC (rev 211411)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2017-01-31  Chris Fleizach  &lt;cfleizach@apple.com&gt;
+
+        AX: enable search predication for iOS
+        https://bugs.webkit.org/show_bug.cgi?id=167558
+        &lt;rdar://problem/30251367&gt;
+
+        Reviewed by Joanmarie Diggs.
+
+        Move the code to support accessibility searching into a shared place so it can be used by iOS.
+
+        Test: accessibility/ios-simulator/ios-search-predicate.html
+
+        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityFindMatchingObjects:]):
+        * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
+        * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
+        (convertToNSArray):
+        (createAccessibilitySearchKeyMap):
+        (accessibilitySearchKeyForString):
+        (accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute):
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (createAccessibilitySearchKeyMap): Deleted.
+        (accessibilitySearchKeyForString): Deleted.
+        (accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute): Deleted.
+        (convertToNSArray): Deleted.
+
</ins><span class="cx"> 2017-01-30  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [WebIDL] Add support for inherit serializer attribute
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityiosWebAccessibilityObjectWrapperIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (211410 => 211411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm        2017-01-31 07:21:43 UTC (rev 211410)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm        2017-01-31 08:07:49 UTC (rev 211411)
</span><span class="lines">@@ -1887,6 +1887,14 @@
</span><span class="cx">     return nil;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (NSArray&lt;WebAccessibilityObjectWrapper *&gt; *)accessibilityFindMatchingObjects:(NSDictionary *)parameters
+{
+    AccessibilitySearchCriteria criteria = accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute(parameters);
+    AccessibilityObject::AccessibilityChildrenVector results;
+    m_object-&gt;findMatchingObjects(&amp;criteria, results);
+    return convertToNSArray(results);
+}
+
</ins><span class="cx"> - (void)accessibilityElementDidBecomeFocused
</span><span class="cx"> {
</span><span class="cx">     if (![self _prepareAccessibilityCall])
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilitymacWebAccessibilityObjectWrapperBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.h (211410 => 211411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.h        2017-01-31 07:21:43 UTC (rev 211410)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.h        2017-01-31 08:07:49 UTC (rev 211411)
</span><span class="lines">@@ -29,10 +29,12 @@
</span><span class="cx"> #ifndef WebAccessibilityObjectWrapperBase_h
</span><span class="cx"> #define WebAccessibilityObjectWrapperBase_h
</span><span class="cx"> 
</span><ins>+#include &quot;AccessibilityObject.h&quot;
</ins><span class="cx"> #include &lt;CoreGraphics/CoreGraphics.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> class AccessibilityObject;
</span><ins>+struct AccessibilitySearchCriteria;
</ins><span class="cx"> class IntRect;
</span><span class="cx"> class FloatPoint;
</span><span class="cx"> class Path;
</span><span class="lines">@@ -67,6 +69,9 @@
</span><span class="cx"> - (NSArray *)accessibilityMathPostscriptPairs;
</span><span class="cx"> - (NSArray *)accessibilityMathPrescriptPairs;
</span><span class="cx"> 
</span><ins>+extern WebCore::AccessibilitySearchCriteria accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute(const NSDictionary *);
+extern NSArray *convertToNSArray(const WebCore::AccessibilityObject::AccessibilityChildrenVector&amp;);
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #endif // WebAccessibilityObjectWrapperBase_h
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilitymacWebAccessibilityObjectWrapperBasemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm (211410 => 211411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm        2017-01-31 07:21:43 UTC (rev 211410)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm        2017-01-31 08:07:49 UTC (rev 211411)
</span><span class="lines">@@ -67,6 +67,168 @@
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> using namespace HTMLNames;
</span><span class="cx"> 
</span><ins>+// Search Keys
+#ifndef NSAccessibilityAnyTypeSearchKey
+#define NSAccessibilityAnyTypeSearchKey @&quot;AXAnyTypeSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityBlockquoteSameLevelSearchKey
+#define NSAccessibilityBlockquoteSameLevelSearchKey @&quot;AXBlockquoteSameLevelSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityBlockquoteSearchKey
+#define NSAccessibilityBlockquoteSearchKey @&quot;AXBlockquoteSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityBoldFontSearchKey
+#define NSAccessibilityBoldFontSearchKey @&quot;AXBoldFontSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityButtonSearchKey
+#define NSAccessibilityButtonSearchKey @&quot;AXButtonSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityCheckBoxSearchKey
+#define NSAccessibilityCheckBoxSearchKey @&quot;AXCheckBoxSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityControlSearchKey
+#define NSAccessibilityControlSearchKey @&quot;AXControlSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityDifferentTypeSearchKey
+#define NSAccessibilityDifferentTypeSearchKey @&quot;AXDifferentTypeSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityFontChangeSearchKey
+#define NSAccessibilityFontChangeSearchKey @&quot;AXFontChangeSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityFontColorChangeSearchKey
+#define NSAccessibilityFontColorChangeSearchKey @&quot;AXFontColorChangeSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityFrameSearchKey
+#define NSAccessibilityFrameSearchKey @&quot;AXFrameSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityGraphicSearchKey
+#define NSAccessibilityGraphicSearchKey @&quot;AXGraphicSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityHeadingLevel1SearchKey
+#define NSAccessibilityHeadingLevel1SearchKey @&quot;AXHeadingLevel1SearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityHeadingLevel2SearchKey
+#define NSAccessibilityHeadingLevel2SearchKey @&quot;AXHeadingLevel2SearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityHeadingLevel3SearchKey
+#define NSAccessibilityHeadingLevel3SearchKey @&quot;AXHeadingLevel3SearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityHeadingLevel4SearchKey
+#define NSAccessibilityHeadingLevel4SearchKey @&quot;AXHeadingLevel4SearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityHeadingLevel5SearchKey
+#define NSAccessibilityHeadingLevel5SearchKey @&quot;AXHeadingLevel5SearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityHeadingLevel6SearchKey
+#define NSAccessibilityHeadingLevel6SearchKey @&quot;AXHeadingLevel6SearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityHeadingSameLevelSearchKey
+#define NSAccessibilityHeadingSameLevelSearchKey @&quot;AXHeadingSameLevelSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityHeadingSearchKey
+#define NSAccessibilityHeadingSearchKey @&quot;AXHeadingSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityHighlightedSearchKey
+#define NSAccessibilityHighlightedSearchKey @&quot;AXHighlightedSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityItalicFontSearchKey
+#define NSAccessibilityItalicFontSearchKey @&quot;AXItalicFontSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityLandmarkSearchKey
+#define NSAccessibilityLandmarkSearchKey @&quot;AXLandmarkSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityLinkSearchKey
+#define NSAccessibilityLinkSearchKey @&quot;AXLinkSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityListSearchKey
+#define NSAccessibilityListSearchKey @&quot;AXListSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityLiveRegionSearchKey
+#define NSAccessibilityLiveRegionSearchKey @&quot;AXLiveRegionSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityMisspelledWordSearchKey
+#define NSAccessibilityMisspelledWordSearchKey @&quot;AXMisspelledWordSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityOutlineSearchKey
+#define NSAccessibilityOutlineSearchKey @&quot;AXOutlineSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityPlainTextSearchKey
+#define NSAccessibilityPlainTextSearchKey @&quot;AXPlainTextSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityRadioGroupSearchKey
+#define NSAccessibilityRadioGroupSearchKey @&quot;AXRadioGroupSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilitySameTypeSearchKey
+#define NSAccessibilitySameTypeSearchKey @&quot;AXSameTypeSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityStaticTextSearchKey
+#define NSAccessibilityStaticTextSearchKey @&quot;AXStaticTextSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityStyleChangeSearchKey
+#define NSAccessibilityStyleChangeSearchKey @&quot;AXStyleChangeSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityTableSameLevelSearchKey
+#define NSAccessibilityTableSameLevelSearchKey @&quot;AXTableSameLevelSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityTableSearchKey
+#define NSAccessibilityTableSearchKey @&quot;AXTableSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityTextFieldSearchKey
+#define NSAccessibilityTextFieldSearchKey @&quot;AXTextFieldSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityUnderlineSearchKey
+#define NSAccessibilityUnderlineSearchKey @&quot;AXUnderlineSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityUnvisitedLinkSearchKey
+#define NSAccessibilityUnvisitedLinkSearchKey @&quot;AXUnvisitedLinkSearchKey&quot;
+#endif
+
+#ifndef NSAccessibilityVisitedLinkSearchKey
+#define NSAccessibilityVisitedLinkSearchKey @&quot;AXVisitedLinkSearchKey&quot;
+#endif
+
+// Search
+#ifndef NSAccessibilityImmediateDescendantsOnly
+#define NSAccessibilityImmediateDescendantsOnly @&quot;AXImmediateDescendantsOnly&quot;
+#endif
+
</ins><span class="cx"> static NSArray *convertMathPairsToNSArray(const AccessibilityObject::AccessibilityMathMultiscriptPairs&amp; pairs, NSString *subscriptKey, NSString *superscriptKey)
</span><span class="cx"> {
</span><span class="cx">     NSMutableArray *array = [NSMutableArray arrayWithCapacity:pairs.size()];
</span><span class="lines">@@ -81,6 +243,25 @@
</span><span class="cx">     return array;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+
+NSArray *convertToNSArray(const AccessibilityObject::AccessibilityChildrenVector&amp; vector)
+{
+    NSMutableArray *array = [NSMutableArray arrayWithCapacity:vector.size()];
+    for (const auto&amp; child : vector) {
+        WebAccessibilityObjectWrapper* wrapper = child-&gt;wrapper();
+        ASSERT(wrapper);
+        if (wrapper) {
+            // we want to return the attachment view instead of the object representing the attachment.
+            // otherwise, we get palindrome errors in the AX hierarchy
+            if (child-&gt;isAttachment() &amp;&amp; [wrapper attachmentView])
+                [array addObject:[wrapper attachmentView]];
+            else
+                [array addObject:wrapper];
+        }
+    }
+    return [[array copy] autorelease];
+}
+
</ins><span class="cx"> @implementation WebAccessibilityObjectWrapperBase
</span><span class="cx"> 
</span><span class="cx"> - (id)initWithAccessibilityObject:(AccessibilityObject*)axObject
</span><span class="lines">@@ -455,6 +636,127 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#pragma mark Search helpers
+
+typedef HashMap&lt;String, AccessibilitySearchKey&gt; AccessibilitySearchKeyMap;
+
+struct SearchKeyEntry {
+    String key;
+    AccessibilitySearchKey value;
+};
+
+static AccessibilitySearchKeyMap* createAccessibilitySearchKeyMap()
+{
+    const SearchKeyEntry searchKeys[] = {
+        { NSAccessibilityAnyTypeSearchKey, AnyTypeSearchKey },
+        { NSAccessibilityBlockquoteSameLevelSearchKey, BlockquoteSameLevelSearchKey },
+        { NSAccessibilityBlockquoteSearchKey, BlockquoteSearchKey },
+        { NSAccessibilityBoldFontSearchKey, BoldFontSearchKey },
+        { NSAccessibilityButtonSearchKey, ButtonSearchKey },
+        { NSAccessibilityCheckBoxSearchKey, CheckBoxSearchKey },
+        { NSAccessibilityControlSearchKey, ControlSearchKey },
+        { NSAccessibilityDifferentTypeSearchKey, DifferentTypeSearchKey },
+        { NSAccessibilityFontChangeSearchKey, FontChangeSearchKey },
+        { NSAccessibilityFontColorChangeSearchKey, FontColorChangeSearchKey },
+        { NSAccessibilityFrameSearchKey, FrameSearchKey },
+        { NSAccessibilityGraphicSearchKey, GraphicSearchKey },
+        { NSAccessibilityHeadingLevel1SearchKey, HeadingLevel1SearchKey },
+        { NSAccessibilityHeadingLevel2SearchKey, HeadingLevel2SearchKey },
+        { NSAccessibilityHeadingLevel3SearchKey, HeadingLevel3SearchKey },
+        { NSAccessibilityHeadingLevel4SearchKey, HeadingLevel4SearchKey },
+        { NSAccessibilityHeadingLevel5SearchKey, HeadingLevel5SearchKey },
+        { NSAccessibilityHeadingLevel6SearchKey, HeadingLevel6SearchKey },
+        { NSAccessibilityHeadingSameLevelSearchKey, HeadingSameLevelSearchKey },
+        { NSAccessibilityHeadingSearchKey, HeadingSearchKey },
+        { NSAccessibilityHighlightedSearchKey, HighlightedSearchKey },
+        { NSAccessibilityItalicFontSearchKey, ItalicFontSearchKey },
+        { NSAccessibilityLandmarkSearchKey, LandmarkSearchKey },
+        { NSAccessibilityLinkSearchKey, LinkSearchKey },
+        { NSAccessibilityListSearchKey, ListSearchKey },
+        { NSAccessibilityLiveRegionSearchKey, LiveRegionSearchKey },
+        { NSAccessibilityMisspelledWordSearchKey, MisspelledWordSearchKey },
+        { NSAccessibilityOutlineSearchKey, OutlineSearchKey },
+        { NSAccessibilityPlainTextSearchKey, PlainTextSearchKey },
+        { NSAccessibilityRadioGroupSearchKey, RadioGroupSearchKey },
+        { NSAccessibilitySameTypeSearchKey, SameTypeSearchKey },
+        { NSAccessibilityStaticTextSearchKey, StaticTextSearchKey },
+        { NSAccessibilityStyleChangeSearchKey, StyleChangeSearchKey },
+        { NSAccessibilityTableSameLevelSearchKey, TableSameLevelSearchKey },
+        { NSAccessibilityTableSearchKey, TableSearchKey },
+        { NSAccessibilityTextFieldSearchKey, TextFieldSearchKey },
+        { NSAccessibilityUnderlineSearchKey, UnderlineSearchKey },
+        { NSAccessibilityUnvisitedLinkSearchKey, UnvisitedLinkSearchKey },
+        { NSAccessibilityVisitedLinkSearchKey, VisitedLinkSearchKey }
+    };
+    
+    AccessibilitySearchKeyMap* searchKeyMap = new AccessibilitySearchKeyMap;
+    for (size_t i = 0; i &lt; WTF_ARRAY_LENGTH(searchKeys); i++)
+        searchKeyMap-&gt;set(searchKeys[i].key, searchKeys[i].value);
+    
+    return searchKeyMap;
+}
+
+static AccessibilitySearchKey accessibilitySearchKeyForString(const String&amp; value)
+{
+    if (value.isEmpty())
+        return AnyTypeSearchKey;
+    
+    static const AccessibilitySearchKeyMap* searchKeyMap = createAccessibilitySearchKeyMap();
+    AccessibilitySearchKey searchKey = searchKeyMap-&gt;get(value);    
+    return searchKey ? searchKey : AnyTypeSearchKey;
+}
+
+AccessibilitySearchCriteria accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute(const NSDictionary *parameterizedAttribute)
+{
+    NSString *directionParameter = [parameterizedAttribute objectForKey:@&quot;AXDirection&quot;];
+    NSNumber *immediateDescendantsOnlyParameter = [parameterizedAttribute objectForKey:NSAccessibilityImmediateDescendantsOnly];
+    NSNumber *resultsLimitParameter = [parameterizedAttribute objectForKey:@&quot;AXResultsLimit&quot;];
+    NSString *searchTextParameter = [parameterizedAttribute objectForKey:@&quot;AXSearchText&quot;];
+    WebAccessibilityObjectWrapperBase *startElementParameter = [parameterizedAttribute objectForKey:@&quot;AXStartElement&quot;];
+    NSNumber *visibleOnlyParameter = [parameterizedAttribute objectForKey:@&quot;AXVisibleOnly&quot;];
+    id searchKeyParameter = [parameterizedAttribute objectForKey:@&quot;AXSearchKey&quot;];
+    
+    AccessibilitySearchDirection direction = SearchDirectionNext;
+    if ([directionParameter isKindOfClass:[NSString class]])
+        direction = [directionParameter isEqualToString:@&quot;AXDirectionNext&quot;] ? SearchDirectionNext : SearchDirectionPrevious;
+    
+    bool immediateDescendantsOnly = false;
+    if ([immediateDescendantsOnlyParameter isKindOfClass:[NSNumber class]])
+        immediateDescendantsOnly = [immediateDescendantsOnlyParameter boolValue];
+    
+    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:[WebAccessibilityObjectWrapperBase class]])
+        startElement = [startElementParameter accessibilityObject];
+    
+    bool visibleOnly = false;
+    if ([visibleOnlyParameter isKindOfClass:[NSNumber class]])
+        visibleOnly = [visibleOnlyParameter boolValue];
+    
+    AccessibilitySearchCriteria criteria = AccessibilitySearchCriteria(startElement, direction, searchText, resultsLimit, visibleOnly, immediateDescendantsOnly);
+    
+    if ([searchKeyParameter isKindOfClass:[NSString class]])
+        criteria.searchKeys.append(accessibilitySearchKeyForString(searchKeyParameter));
+    else if ([searchKeyParameter isKindOfClass:[NSArray class]]) {
+        size_t searchKeyCount = static_cast&lt;size_t&gt;([searchKeyParameter count]);
+        criteria.searchKeys.reserveInitialCapacity(searchKeyCount);
+        for (size_t i = 0; i &lt; searchKeyCount; ++i) {
+            NSString *searchKey = [searchKeyParameter objectAtIndex:i];
+            if ([searchKey isKindOfClass:[NSString class]])
+                criteria.searchKeys.uncheckedAppend(accessibilitySearchKeyForString(searchKey));
+        }
+    }
+    
+    return criteria;
+}
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #endif // HAVE(ACCESSIBILITY)
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilitymacWebAccessibilityObjectWrapperMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (211410 => 211411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm        2017-01-31 07:21:43 UTC (rev 211410)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm        2017-01-31 08:07:49 UTC (rev 211411)
</span><span class="lines">@@ -282,10 +282,6 @@
</span><span class="cx"> #define NSAccessibilityARIARowCountAttribute @&quot;AXARIARowCount&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-// Search
-#ifndef NSAccessibilityImmediateDescendantsOnly
-#define NSAccessibilityImmediateDescendantsOnly @&quot;AXImmediateDescendantsOnly&quot;
-#endif
</del><span class="cx"> 
</span><span class="cx"> #ifndef NSAccessibilityUIElementCountForSearchPredicateParameterizedAttribute
</span><span class="cx"> #define NSAccessibilityUIElementCountForSearchPredicateParameterizedAttribute @&quot;AXUIElementCountForSearchPredicate&quot;
</span><span class="lines">@@ -295,163 +291,6 @@
</span><span class="cx"> #define NSAccessibilityUIElementsForSearchPredicateParameterizedAttribute @&quot;AXUIElementsForSearchPredicate&quot;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-// Search Keys
-#ifndef NSAccessibilityAnyTypeSearchKey
-#define NSAccessibilityAnyTypeSearchKey @&quot;AXAnyTypeSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityBlockquoteSameLevelSearchKey
-#define NSAccessibilityBlockquoteSameLevelSearchKey @&quot;AXBlockquoteSameLevelSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityBlockquoteSearchKey
-#define NSAccessibilityBlockquoteSearchKey @&quot;AXBlockquoteSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityBoldFontSearchKey
-#define NSAccessibilityBoldFontSearchKey @&quot;AXBoldFontSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityButtonSearchKey
-#define NSAccessibilityButtonSearchKey @&quot;AXButtonSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityCheckBoxSearchKey
-#define NSAccessibilityCheckBoxSearchKey @&quot;AXCheckBoxSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityControlSearchKey
-#define NSAccessibilityControlSearchKey @&quot;AXControlSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityDifferentTypeSearchKey
-#define NSAccessibilityDifferentTypeSearchKey @&quot;AXDifferentTypeSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityFontChangeSearchKey
-#define NSAccessibilityFontChangeSearchKey @&quot;AXFontChangeSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityFontColorChangeSearchKey
-#define NSAccessibilityFontColorChangeSearchKey @&quot;AXFontColorChangeSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityFrameSearchKey
-#define NSAccessibilityFrameSearchKey @&quot;AXFrameSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityGraphicSearchKey
-#define NSAccessibilityGraphicSearchKey @&quot;AXGraphicSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityHeadingLevel1SearchKey
-#define NSAccessibilityHeadingLevel1SearchKey @&quot;AXHeadingLevel1SearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityHeadingLevel2SearchKey
-#define NSAccessibilityHeadingLevel2SearchKey @&quot;AXHeadingLevel2SearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityHeadingLevel3SearchKey
-#define NSAccessibilityHeadingLevel3SearchKey @&quot;AXHeadingLevel3SearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityHeadingLevel4SearchKey
-#define NSAccessibilityHeadingLevel4SearchKey @&quot;AXHeadingLevel4SearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityHeadingLevel5SearchKey
-#define NSAccessibilityHeadingLevel5SearchKey @&quot;AXHeadingLevel5SearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityHeadingLevel6SearchKey
-#define NSAccessibilityHeadingLevel6SearchKey @&quot;AXHeadingLevel6SearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityHeadingSameLevelSearchKey
-#define NSAccessibilityHeadingSameLevelSearchKey @&quot;AXHeadingSameLevelSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityHeadingSearchKey
-#define NSAccessibilityHeadingSearchKey @&quot;AXHeadingSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityHighlightedSearchKey
-#define NSAccessibilityHighlightedSearchKey @&quot;AXHighlightedSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityItalicFontSearchKey
-#define NSAccessibilityItalicFontSearchKey @&quot;AXItalicFontSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityLandmarkSearchKey
-#define NSAccessibilityLandmarkSearchKey @&quot;AXLandmarkSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityLinkSearchKey
-#define NSAccessibilityLinkSearchKey @&quot;AXLinkSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityListSearchKey
-#define NSAccessibilityListSearchKey @&quot;AXListSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityLiveRegionSearchKey
-#define NSAccessibilityLiveRegionSearchKey @&quot;AXLiveRegionSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityMisspelledWordSearchKey
-#define NSAccessibilityMisspelledWordSearchKey @&quot;AXMisspelledWordSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityOutlineSearchKey
-#define NSAccessibilityOutlineSearchKey @&quot;AXOutlineSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityPlainTextSearchKey
-#define NSAccessibilityPlainTextSearchKey @&quot;AXPlainTextSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityRadioGroupSearchKey
-#define NSAccessibilityRadioGroupSearchKey @&quot;AXRadioGroupSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilitySameTypeSearchKey
-#define NSAccessibilitySameTypeSearchKey @&quot;AXSameTypeSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityStaticTextSearchKey
-#define NSAccessibilityStaticTextSearchKey @&quot;AXStaticTextSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityStyleChangeSearchKey
-#define NSAccessibilityStyleChangeSearchKey @&quot;AXStyleChangeSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityTableSameLevelSearchKey
-#define NSAccessibilityTableSameLevelSearchKey @&quot;AXTableSameLevelSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityTableSearchKey
-#define NSAccessibilityTableSearchKey @&quot;AXTableSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityTextFieldSearchKey
-#define NSAccessibilityTextFieldSearchKey @&quot;AXTextFieldSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityUnderlineSearchKey
-#define NSAccessibilityUnderlineSearchKey @&quot;AXUnderlineSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityUnvisitedLinkSearchKey
-#define NSAccessibilityUnvisitedLinkSearchKey @&quot;AXUnvisitedLinkSearchKey&quot;
-#endif
-
-#ifndef NSAccessibilityVisitedLinkSearchKey
-#define NSAccessibilityVisitedLinkSearchKey @&quot;AXVisitedLinkSearchKey&quot;
-#endif
-
</del><span class="cx"> // Text markers
</span><span class="cx"> #ifndef NSAccessibilityEndTextMarkerForBoundsParameterizedAttribute
</span><span class="cx"> #define NSAccessibilityEndTextMarkerForBoundsParameterizedAttribute @&quot;AXEndTextMarkerForBounds&quot;
</span><span class="lines">@@ -632,129 +471,6 @@
</span><span class="cx">     return IntRect(startPoint.x(), startPoint.y(), endPoint.x() - startPoint.x(), endPoint.y() - startPoint.y());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#pragma mark Search helpers
-
-typedef HashMap&lt;String, AccessibilitySearchKey&gt; AccessibilitySearchKeyMap;
-
-struct SearchKeyEntry {
-    String key;
-    AccessibilitySearchKey value;
-};
-
-static AccessibilitySearchKeyMap* createAccessibilitySearchKeyMap()
-{
-    const SearchKeyEntry searchKeys[] = {
-        { NSAccessibilityAnyTypeSearchKey, AnyTypeSearchKey },
-        { NSAccessibilityBlockquoteSameLevelSearchKey, BlockquoteSameLevelSearchKey },
-        { NSAccessibilityBlockquoteSearchKey, BlockquoteSearchKey },
-        { NSAccessibilityBoldFontSearchKey, BoldFontSearchKey },
-        { NSAccessibilityButtonSearchKey, ButtonSearchKey },
-        { NSAccessibilityCheckBoxSearchKey, CheckBoxSearchKey },
-        { NSAccessibilityControlSearchKey, ControlSearchKey },
-        { NSAccessibilityDifferentTypeSearchKey, DifferentTypeSearchKey },
-        { NSAccessibilityFontChangeSearchKey, FontChangeSearchKey },
-        { NSAccessibilityFontColorChangeSearchKey, FontColorChangeSearchKey },
-        { NSAccessibilityFrameSearchKey, FrameSearchKey },
-        { NSAccessibilityGraphicSearchKey, GraphicSearchKey },
-        { NSAccessibilityHeadingLevel1SearchKey, HeadingLevel1SearchKey },
-        { NSAccessibilityHeadingLevel2SearchKey, HeadingLevel2SearchKey },
-        { NSAccessibilityHeadingLevel3SearchKey, HeadingLevel3SearchKey },
-        { NSAccessibilityHeadingLevel4SearchKey, HeadingLevel4SearchKey },
-        { NSAccessibilityHeadingLevel5SearchKey, HeadingLevel5SearchKey },
-        { NSAccessibilityHeadingLevel6SearchKey, HeadingLevel6SearchKey },
-        { NSAccessibilityHeadingSameLevelSearchKey, HeadingSameLevelSearchKey },
-        { NSAccessibilityHeadingSearchKey, HeadingSearchKey },
-        { NSAccessibilityHighlightedSearchKey, HighlightedSearchKey },
-        { NSAccessibilityItalicFontSearchKey, ItalicFontSearchKey },
-        { NSAccessibilityLandmarkSearchKey, LandmarkSearchKey },
-        { NSAccessibilityLinkSearchKey, LinkSearchKey },
-        { NSAccessibilityListSearchKey, ListSearchKey },
-        { NSAccessibilityLiveRegionSearchKey, LiveRegionSearchKey },
-        { NSAccessibilityMisspelledWordSearchKey, MisspelledWordSearchKey },
-        { NSAccessibilityOutlineSearchKey, OutlineSearchKey },
-        { NSAccessibilityPlainTextSearchKey, PlainTextSearchKey },
-        { NSAccessibilityRadioGroupSearchKey, RadioGroupSearchKey },
-        { NSAccessibilitySameTypeSearchKey, SameTypeSearchKey },
-        { NSAccessibilityStaticTextSearchKey, StaticTextSearchKey },
-        { NSAccessibilityStyleChangeSearchKey, StyleChangeSearchKey },
-        { NSAccessibilityTableSameLevelSearchKey, TableSameLevelSearchKey },
-        { NSAccessibilityTableSearchKey, TableSearchKey },
-        { NSAccessibilityTextFieldSearchKey, TextFieldSearchKey },
-        { NSAccessibilityUnderlineSearchKey, UnderlineSearchKey },
-        { NSAccessibilityUnvisitedLinkSearchKey, UnvisitedLinkSearchKey },
-        { NSAccessibilityVisitedLinkSearchKey, VisitedLinkSearchKey }
-    };
-    
-    AccessibilitySearchKeyMap* searchKeyMap = new AccessibilitySearchKeyMap;
-    for (size_t i = 0; i &lt; WTF_ARRAY_LENGTH(searchKeys); i++)
-        searchKeyMap-&gt;set(searchKeys[i].key, searchKeys[i].value);
-    
-    return searchKeyMap;
-}
-
-static AccessibilitySearchKey accessibilitySearchKeyForString(const String&amp; value)
-{
-    if (value.isEmpty())
-        return AnyTypeSearchKey;
-    
-    static const AccessibilitySearchKeyMap* searchKeyMap = createAccessibilitySearchKeyMap();
-    
-    AccessibilitySearchKey searchKey = searchKeyMap-&gt;get(value);
-    
-    return searchKey ? searchKey : AnyTypeSearchKey;
-}
-
-static AccessibilitySearchCriteria accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute(const NSDictionary *parameterizedAttribute)
-{
-    NSString *directionParameter = [parameterizedAttribute objectForKey:@&quot;AXDirection&quot;];
-    NSNumber *immediateDescendantsOnlyParameter = [parameterizedAttribute objectForKey:NSAccessibilityImmediateDescendantsOnly];
-    NSNumber *resultsLimitParameter = [parameterizedAttribute objectForKey:@&quot;AXResultsLimit&quot;];
-    NSString *searchTextParameter = [parameterizedAttribute objectForKey:@&quot;AXSearchText&quot;];
-    WebAccessibilityObjectWrapper *startElementParameter = [parameterizedAttribute objectForKey:@&quot;AXStartElement&quot;];
-    NSNumber *visibleOnlyParameter = [parameterizedAttribute objectForKey:@&quot;AXVisibleOnly&quot;];
-    id searchKeyParameter = [parameterizedAttribute objectForKey:@&quot;AXSearchKey&quot;];
-    
-    AccessibilitySearchDirection direction = SearchDirectionNext;
-    if ([directionParameter isKindOfClass:[NSString class]])
-        direction = [directionParameter isEqualToString:@&quot;AXDirectionNext&quot;] ? SearchDirectionNext : SearchDirectionPrevious;
-    
-    bool immediateDescendantsOnly = false;
-    if ([immediateDescendantsOnlyParameter isKindOfClass:[NSNumber class]])
-        immediateDescendantsOnly = [immediateDescendantsOnlyParameter boolValue];
-    
-    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 = false;
-    if ([visibleOnlyParameter isKindOfClass:[NSNumber class]])
-        visibleOnly = [visibleOnlyParameter boolValue];
-    
-    AccessibilitySearchCriteria criteria = AccessibilitySearchCriteria(startElement, direction, searchText, resultsLimit, visibleOnly, immediateDescendantsOnly);
-    
-    if ([searchKeyParameter isKindOfClass:[NSString class]])
-        criteria.searchKeys.append(accessibilitySearchKeyForString(searchKeyParameter));
-    else if ([searchKeyParameter isKindOfClass:[NSArray class]]) {
-        size_t searchKeyCount = static_cast&lt;size_t&gt;([searchKeyParameter count]);
-        criteria.searchKeys.reserveInitialCapacity(searchKeyCount);
-        for (size_t i = 0; i &lt; searchKeyCount; ++i) {
-            NSString *searchKey = [searchKeyParameter objectAtIndex:i];
-            if ([searchKey isKindOfClass:[NSString class]])
-                criteria.searchKeys.uncheckedAppend(accessibilitySearchKeyForString(searchKey));
-        }
-    }
-    
-    return criteria;
-}
-
</del><span class="cx"> #pragma mark Select text helpers
</span><span class="cx"> 
</span><span class="cx"> static AccessibilitySelectTextCriteria accessibilitySelectTextCriteriaForCriteriaParameterizedAttribute(const NSDictionary *parameterizedAttribute)
</span><span class="lines">@@ -1950,24 +1666,6 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static NSMutableArray* convertToNSArray(const AccessibilityObject::AccessibilityChildrenVector&amp; vector)
-{
-    NSMutableArray* array = [NSMutableArray arrayWithCapacity:vector.size()];
-    for (const auto&amp; child : vector) {
-        WebAccessibilityObjectWrapper* wrapper = child-&gt;wrapper();
-        ASSERT(wrapper);
-        if (wrapper) {
-            // we want to return the attachment view instead of the object representing the attachment.
-            // otherwise, we get palindrome errors in the AX hierarchy
-            if (child-&gt;isAttachment() &amp;&amp; [wrapper attachmentView])
-                [array addObject:[wrapper attachmentView]];
-            else
-                [array addObject:wrapper];
-        }
-    }
-    return array;
-}
-
</del><span class="cx"> static NSMutableArray *convertStringsToNSArray(const Vector&lt;String&gt;&amp; vector)
</span><span class="cx"> {
</span><span class="cx">     NSMutableArray *array = [NSMutableArray arrayWithCapacity:vector.size()];
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (211410 => 211411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-01-31 07:21:43 UTC (rev 211410)
+++ trunk/Tools/ChangeLog        2017-01-31 08:07:49 UTC (rev 211411)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2017-01-31  Chris Fleizach  &lt;cfleizach@apple.com&gt;
+
+        AX: enable search predication for iOS
+        https://bugs.webkit.org/show_bug.cgi?id=167558
+        &lt;rdar://problem/30251367&gt;
+
+        Reviewed by Joanmarie Diggs.
+
+        * DumpRenderTree/ios/AccessibilityUIElementIOS.mm:
+        (AccessibilityUIElement::uiElementForSearchPredicate):
+        * DumpRenderTree/mac/AccessibilityCommonMac.h:
+        * DumpRenderTree/mac/AccessibilityCommonMac.mm:
+        (searchPredicateParameterizedAttributeForSearchCriteria):
+        * DumpRenderTree/mac/AccessibilityUIElementMac.mm:
+        (searchPredicateParameterizedAttributeForSearchCriteria): Deleted.
+        * WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm:
+        (WTR::AccessibilityUIElement::uiElementCountForSearchPredicate):
+        (WTR::AccessibilityUIElement::uiElementForSearchPredicate):
+        * WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.h:
+        * WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.mm:
+        (WTR::searchPredicateParameterizedAttributeForSearchCriteria):
+        * WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm:
+        (WTR::searchPredicateParameterizedAttributeForSearchCriteria): Deleted.
+        * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
+
</ins><span class="cx"> 2017-01-30  Jonathan Bedard  &lt;jbedard@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Workaround for simctl launch bug
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeiosAccessibilityUIElementIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm (211410 => 211411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm        2017-01-31 07:21:43 UTC (rev 211410)
+++ trunk/Tools/DumpRenderTree/ios/AccessibilityUIElementIOS.mm        2017-01-31 08:07:49 UTC (rev 211411)
</span><span class="lines">@@ -100,6 +100,7 @@
</span><span class="cx"> - (NSString *)accessibilitySortDirection;
</span><span class="cx"> - (BOOL)accessibilityIsExpanded;
</span><span class="cx"> - (NSUInteger)accessibilityBlockquoteLevel;
</span><ins>+- (NSArray *)accessibilityFindMatchingObjects:(NSDictionary *)parameters;
</ins><span class="cx"> 
</span><span class="cx"> // TextMarker related
</span><span class="cx"> - (NSArray *)textMarkerRange;
</span><span class="lines">@@ -1120,10 +1121,13 @@
</span><span class="cx">     return 0;
</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, bool immediateDescendantsOnly)
</del><ins>+AccessibilityUIElement AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef context, AccessibilityUIElement *startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly, bool immediateDescendantsOnly)
</ins><span class="cx"> {
</span><del>-    // FIXME: implement
-    return 0;
</del><ins>+    NSDictionary *parameterizedAttribute = searchPredicateParameterizedAttributeForSearchCriteria(context, startElement, isDirectionNext, 1, searchKey, searchText, visibleOnly, immediateDescendantsOnly);
+    id value = [m_element accessibilityFindMatchingObjects:parameterizedAttribute];
+    if (![value isKindOfClass:[NSArray class]])
+        return nullptr;
+    return AccessibilityUIElement([value lastObject]);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> JSStringRef AccessibilityUIElement::selectTextWithCriteria(JSContextRef context, JSStringRef ambiguityResolution, JSValueRef searchStrings, JSStringRef replacementString, JSStringRef activity)
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacAccessibilityCommonMach"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/AccessibilityCommonMac.h (211410 => 211411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/AccessibilityCommonMac.h        2017-01-31 07:21:43 UTC (rev 211410)
+++ trunk/Tools/DumpRenderTree/mac/AccessibilityCommonMac.h        2017-01-31 08:07:49 UTC (rev 211411)
</span><span class="lines">@@ -31,6 +31,8 @@
</span><span class="cx"> #ifndef AccessibilityCommonMac_h
</span><span class="cx"> #define AccessibilityCommonMac_h
</span><span class="cx"> 
</span><ins>+#import &quot;AccessibilityUIElement.h&quot;
+
</ins><span class="cx"> #import &lt;JavaScriptCore/JSStringRef.h&gt;
</span><span class="cx"> 
</span><span class="cx"> // If an unsupported attribute is passed in, it will raise an accessibility exception. These are usually caught by the Accessibility Runtime to inform
</span><span class="lines">@@ -44,4 +46,6 @@
</span><span class="cx"> - (JSStringRef)createJSStringRef;
</span><span class="cx"> @end
</span><span class="cx"> 
</span><ins>+extern NSDictionary *searchPredicateParameterizedAttributeForSearchCriteria(JSContextRef, AccessibilityUIElement *startElement, bool isDirectionNext, unsigned resultsLimit, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly, bool immediateDescendantsOnly);
+
</ins><span class="cx"> #endif // AccessibilityCommonMac_h
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacAccessibilityCommonMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/AccessibilityCommonMac.mm (211410 => 211411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/AccessibilityCommonMac.mm        2017-01-31 07:21:43 UTC (rev 211410)
+++ trunk/Tools/DumpRenderTree/mac/AccessibilityCommonMac.mm        2017-01-31 08:07:49 UTC (rev 211411)
</span><span class="lines">@@ -31,6 +31,8 @@
</span><span class="cx"> #import &quot;config.h&quot;
</span><span class="cx"> #import &quot;AccessibilityCommonMac.h&quot;
</span><span class="cx"> 
</span><ins>+#import &lt;JavaScriptCore/JSRetainPtr.h&gt;
+#import &lt;JavaScriptCore/JSStringRef.h&gt;
</ins><span class="cx"> #import &lt;JavaScriptCore/JSStringRefCF.h&gt;
</span><span class="cx"> 
</span><span class="cx"> @implementation NSString (JSStringRefAdditions)
</span><span class="lines">@@ -49,4 +51,56 @@
</span><span class="cx">     return JSStringCreateWithCFString((CFStringRef)self);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+NSDictionary *searchPredicateParameterizedAttributeForSearchCriteria(JSContextRef context, AccessibilityUIElement *startElement, bool isDirectionNext, unsigned resultsLimit, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly, bool immediateDescendantsOnly)
+{
+    NSMutableDictionary *parameterizedAttribute = [NSMutableDictionary dictionary];
+    
+    if (startElement &amp;&amp; startElement-&gt;platformUIElement())
+        [parameterizedAttribute setObject:(id)startElement-&gt;platformUIElement() forKey:@&quot;AXStartElement&quot;];
+    
+    [parameterizedAttribute setObject:(isDirectionNext) ? @&quot;AXDirectionNext&quot; : @&quot;AXDirectionPrevious&quot; forKey:@&quot;AXDirection&quot;];
+    
+    [parameterizedAttribute setObject:@(resultsLimit) forKey:@&quot;AXResultsLimit&quot;];
+    
+    if (searchKey) {
+        id searchKeyParameter = nil;
+        if (JSValueIsString(context, searchKey)) {
+            JSRetainPtr&lt;JSStringRef&gt; 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&lt;JSStringRef&gt; lengthPropertyString(Adopt, JSStringCreateWithUTF8CString(&quot;length&quot;));
+            JSValueRef searchKeyArrayLengthValue = JSObjectGetProperty(context, searchKeyArray, lengthPropertyString.get(), nullptr);
+            if (searchKeyArrayLengthValue &amp;&amp; JSValueIsNumber(context, searchKeyArrayLengthValue))
+                searchKeyArrayLength = static_cast&lt;unsigned&gt;(JSValueToNumber(context, searchKeyArrayLengthValue, nullptr));
+            
+            for (unsigned i = 0; i &lt; 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:@&quot;AXSearchKey&quot;];
+    }
+    
+    if (searchText &amp;&amp; JSStringGetLength(searchText))
+        [parameterizedAttribute setObject:[NSString stringWithJSStringRef:searchText] forKey:@&quot;AXSearchText&quot;];
+    
+    [parameterizedAttribute setObject:@(visibleOnly) forKey:@&quot;AXVisibleOnly&quot;];
+    
+    [parameterizedAttribute setObject:@(immediateDescendantsOnly) forKey:@&quot;AXImmediateDescendantsOnly&quot;];
+    
+    return parameterizedAttribute;
+}
+
+
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacAccessibilityUIElementMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm (211410 => 211411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm        2017-01-31 07:21:43 UTC (rev 211410)
+++ trunk/Tools/DumpRenderTree/mac/AccessibilityUIElementMac.mm        2017-01-31 08:07:49 UTC (rev 211411)
</span><span class="lines">@@ -203,58 +203,6 @@
</span><span class="cx">     return [allElementString createJSStringRef];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static NSDictionary *searchPredicateParameterizedAttributeForSearchCriteria(JSContextRef context, AccessibilityUIElement *startElement, bool isDirectionNext, unsigned resultsLimit, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly, bool immediateDescendantsOnly)
-{
-    NSMutableDictionary *parameterizedAttribute = [NSMutableDictionary dictionary];
-    
-    if (startElement &amp;&amp; startElement-&gt;platformUIElement())
-        [parameterizedAttribute setObject:(id)startElement-&gt;platformUIElement() forKey:@&quot;AXStartElement&quot;];
-    
-    [parameterizedAttribute setObject:(isDirectionNext) ? @&quot;AXDirectionNext&quot; : @&quot;AXDirectionPrevious&quot; forKey:@&quot;AXDirection&quot;];
-    
-    [parameterizedAttribute setObject:@(resultsLimit) forKey:@&quot;AXResultsLimit&quot;];
-    
-    if (searchKey) {
-        id searchKeyParameter = nil;
-        if (JSValueIsString(context, searchKey)) {
-            JSRetainPtr&lt;JSStringRef&gt; 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&lt;JSStringRef&gt; lengthPropertyString(Adopt, JSStringCreateWithUTF8CString(&quot;length&quot;));
-            JSValueRef searchKeyArrayLengthValue = JSObjectGetProperty(context, searchKeyArray, lengthPropertyString.get(), nullptr);
-            if (searchKeyArrayLengthValue &amp;&amp; JSValueIsNumber(context, searchKeyArrayLengthValue))
-                searchKeyArrayLength = static_cast&lt;unsigned&gt;(JSValueToNumber(context, searchKeyArrayLengthValue, nullptr));
-            
-            for (unsigned i = 0; i &lt; 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:@&quot;AXSearchKey&quot;];
-    }
-    
-    if (searchText &amp;&amp; JSStringGetLength(searchText))
-        [parameterizedAttribute setObject:[NSString stringWithJSStringRef:searchText] forKey:@&quot;AXSearchText&quot;];
-    
-    [parameterizedAttribute setObject:@(visibleOnly) forKey:@&quot;AXVisibleOnly&quot;];
-    
-    [parameterizedAttribute setObject:@(immediateDescendantsOnly) forKey:@&quot;AXImmediateDescendantsOnly&quot;];
-    
-    return parameterizedAttribute;
-}
-
</del><span class="cx"> static NSDictionary *selectTextParameterizedAttributeForCriteria(JSContextRef context, JSStringRef ambiguityResolution, JSValueRef searchStrings, JSStringRef replacementString, JSStringRef activity)
</span><span class="cx"> {
</span><span class="cx">     NSMutableDictionary *parameterizedAttribute = [NSMutableDictionary dictionary];
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleiosAccessibilityUIElementIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm (211410 => 211411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm        2017-01-31 07:21:43 UTC (rev 211410)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/ios/AccessibilityUIElementIOS.mm        2017-01-31 08:07:49 UTC (rev 211411)
</span><span class="lines">@@ -24,6 +24,7 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #import &quot;config.h&quot;
</span><ins>+#import &quot;AccessibilityCommonMac.h&quot;
</ins><span class="cx"> #import &quot;AccessibilityNotificationHandler.h&quot;
</span><span class="cx"> #import &quot;AccessibilityUIElement.h&quot;
</span><span class="cx"> #import &quot;InjectedBundle.h&quot;
</span><span class="lines">@@ -77,6 +78,7 @@
</span><span class="cx"> - (NSString *)accessibilitySortDirection;
</span><span class="cx"> - (BOOL)accessibilityIsExpanded;
</span><span class="cx"> - (NSUInteger)accessibilityBlockquoteLevel;
</span><ins>+- (NSArray *)accessibilityFindMatchingObjects:(NSDictionary *)parameters;
</ins><span class="cx"> 
</span><span class="cx"> // TextMarker related
</span><span class="cx"> - (NSArray *)textMarkerRange;
</span><span class="lines">@@ -653,14 +655,18 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-unsigned AccessibilityUIElement::uiElementCountForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly, bool immediateDescendantsOnly)
</del><ins>+unsigned AccessibilityUIElement::uiElementCountForSearchPredicate(JSContextRef context, AccessibilityUIElement *startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly, bool immediateDescendantsOnly)
</ins><span class="cx"> {
</span><span class="cx">     return 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;AccessibilityUIElement&gt; AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef context, AccessibilityUIElement* startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly, bool immediateDescendantsOnly)
</del><ins>+RefPtr&lt;AccessibilityUIElement&gt; AccessibilityUIElement::uiElementForSearchPredicate(JSContextRef context, AccessibilityUIElement *startElement, bool isDirectionNext, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly, bool immediateDescendantsOnly)
</ins><span class="cx"> {
</span><del>-    return nullptr;
</del><ins>+    NSDictionary *parameterizedAttribute = searchPredicateParameterizedAttributeForSearchCriteria(context, startElement, isDirectionNext, 1, searchKey, searchText, visibleOnly, immediateDescendantsOnly);
+    id value = [m_element accessibilityFindMatchingObjects:parameterizedAttribute];
+    if (![value isKindOfClass:[NSArray class]])
+        return nullptr;
+    return AccessibilityUIElement::create([value lastObject]);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> JSRetainPtr&lt;JSStringRef&gt; AccessibilityUIElement::selectTextWithCriteria(JSContextRef, JSStringRef ambiguityResolution, JSValueRef searchStrings, JSStringRef replacementString, JSStringRef activity)
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundlemacAccessibilityCommonMach"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.h (211410 => 211411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.h        2017-01-31 07:21:43 UTC (rev 211410)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.h        2017-01-31 08:07:49 UTC (rev 211411)
</span><span class="lines">@@ -31,6 +31,8 @@
</span><span class="cx"> #ifndef AccessibilityCommonMac_h
</span><span class="cx"> #define AccessibilityCommonMac_h
</span><span class="cx"> 
</span><ins>+#import &quot;AccessibilityUIElement.h&quot;
+
</ins><span class="cx"> #import &lt;JavaScriptCore/JSStringRef.h&gt;
</span><span class="cx"> 
</span><span class="cx"> // If an unsupported attribute is passed in, it will raise an accessibility exception. These are usually caught by the Accessibility Runtime to inform
</span><span class="lines">@@ -44,4 +46,10 @@
</span><span class="cx"> - (JSStringRef)createJSStringRef;
</span><span class="cx"> @end
</span><span class="cx"> 
</span><ins>+namespace WTR {
+    
+extern NSDictionary *searchPredicateParameterizedAttributeForSearchCriteria(JSContextRef, AccessibilityUIElement *startElement, bool isDirectionNext, unsigned resultsLimit, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly, bool immediateDescendantsOnly);
+
+};
+
</ins><span class="cx"> #endif // AccessibilityCommonMac_h
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundlemacAccessibilityCommonMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.mm (211410 => 211411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.mm        2017-01-31 07:21:43 UTC (rev 211410)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityCommonMac.mm        2017-01-31 08:07:49 UTC (rev 211411)
</span><span class="lines">@@ -31,6 +31,8 @@
</span><span class="cx"> #import &quot;config.h&quot;
</span><span class="cx"> #import &quot;AccessibilityCommonMac.h&quot;
</span><span class="cx"> 
</span><ins>+#import &lt;JavaScriptCore/JSRetainPtr.h&gt;
+#import &lt;JavaScriptCore/JSStringRef.h&gt;
</ins><span class="cx"> #import &lt;JavaScriptCore/JSStringRefCF.h&gt;
</span><span class="cx"> 
</span><span class="cx"> @implementation NSString (JSStringRefAdditions)
</span><span class="lines">@@ -49,4 +51,59 @@
</span><span class="cx">     return JSStringCreateWithCFString((CFStringRef)self);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+namespace WTR {
+
+NSDictionary *searchPredicateParameterizedAttributeForSearchCriteria(JSContextRef context, AccessibilityUIElement *startElement, bool isDirectionNext, unsigned resultsLimit, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly, bool immediateDescendantsOnly)
+{
+    NSMutableDictionary *parameterizedAttribute = [NSMutableDictionary dictionary];
+    
+    if (startElement &amp;&amp; startElement-&gt;platformUIElement())
+        [parameterizedAttribute setObject:(id)startElement-&gt;platformUIElement() forKey:@&quot;AXStartElement&quot;];
+    
+    [parameterizedAttribute setObject:(isDirectionNext) ? @&quot;AXDirectionNext&quot; : @&quot;AXDirectionPrevious&quot; forKey:@&quot;AXDirection&quot;];
+    
+    [parameterizedAttribute setObject:@(resultsLimit) forKey:@&quot;AXResultsLimit&quot;];
+    
+    if (searchKey) {
+        id searchKeyParameter = nil;
+        if (JSValueIsString(context, searchKey)) {
+            JSRetainPtr&lt;JSStringRef&gt; 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&lt;JSStringRef&gt; lengthPropertyString(Adopt, JSStringCreateWithUTF8CString(&quot;length&quot;));
+            JSValueRef searchKeyArrayLengthValue = JSObjectGetProperty(context, searchKeyArray, lengthPropertyString.get(), nullptr);
+            if (searchKeyArrayLengthValue &amp;&amp; JSValueIsNumber(context, searchKeyArrayLengthValue))
+                searchKeyArrayLength = static_cast&lt;unsigned&gt;(JSValueToNumber(context, searchKeyArrayLengthValue, nullptr));
+            
+            for (unsigned i = 0; i &lt; 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:@&quot;AXSearchKey&quot;];
+    }
+    
+    if (searchText &amp;&amp; JSStringGetLength(searchText))
+        [parameterizedAttribute setObject:[NSString stringWithJSStringRef:searchText] forKey:@&quot;AXSearchText&quot;];
+    
+    [parameterizedAttribute setObject:@(visibleOnly) forKey:@&quot;AXVisibleOnly&quot;];
+    
+    [parameterizedAttribute setObject:@(immediateDescendantsOnly) forKey:@&quot;AXImmediateDescendantsOnly&quot;];
+    
+    return parameterizedAttribute;
+}
+    
+} // namespace WTR
+
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundlemacAccessibilityUIElementMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm (211410 => 211411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm        2017-01-31 07:21:43 UTC (rev 211410)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/AccessibilityUIElementMac.mm        2017-01-31 08:07:49 UTC (rev 211411)
</span><span class="lines">@@ -229,58 +229,6 @@
</span><span class="cx">     return [allElementString createJSStringRef];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static NSDictionary *searchPredicateParameterizedAttributeForSearchCriteria(JSContextRef context, AccessibilityUIElement *startElement, bool isDirectionNext, unsigned resultsLimit, JSValueRef searchKey, JSStringRef searchText, bool visibleOnly, bool immediateDescendantsOnly)
-{
-    NSMutableDictionary *parameterizedAttribute = [NSMutableDictionary dictionary];
-    
-    if (startElement &amp;&amp; startElement-&gt;platformUIElement())
-        [parameterizedAttribute setObject:(id)startElement-&gt;platformUIElement() forKey:@&quot;AXStartElement&quot;];
-    
-    [parameterizedAttribute setObject:(isDirectionNext) ? @&quot;AXDirectionNext&quot; : @&quot;AXDirectionPrevious&quot; forKey:@&quot;AXDirection&quot;];
-    
-    [parameterizedAttribute setObject:@(resultsLimit) forKey:@&quot;AXResultsLimit&quot;];
-    
-    if (searchKey) {
-        id searchKeyParameter = nil;
-        if (JSValueIsString(context, searchKey)) {
-            JSRetainPtr&lt;JSStringRef&gt; 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&lt;JSStringRef&gt; lengthPropertyString(Adopt, JSStringCreateWithUTF8CString(&quot;length&quot;));
-            JSValueRef searchKeyArrayLengthValue = JSObjectGetProperty(context, searchKeyArray, lengthPropertyString.get(), nullptr);
-            if (searchKeyArrayLengthValue &amp;&amp; JSValueIsNumber(context, searchKeyArrayLengthValue))
-                searchKeyArrayLength = static_cast&lt;unsigned&gt;(JSValueToNumber(context, searchKeyArrayLengthValue, nullptr));
-            
-            for (unsigned i = 0; i &lt; 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:@&quot;AXSearchKey&quot;];
-    }
-    
-    if (searchText &amp;&amp; JSStringGetLength(searchText))
-        [parameterizedAttribute setObject:[NSString stringWithJSStringRef:searchText] forKey:@&quot;AXSearchText&quot;];
-    
-    [parameterizedAttribute setObject:@(visibleOnly) forKey:@&quot;AXVisibleOnly&quot;];
-    
-    [parameterizedAttribute setObject:@(immediateDescendantsOnly) forKey:@&quot;AXImmediateDescendantsOnly&quot;];
-    
-    return parameterizedAttribute;
-}
-
</del><span class="cx"> static NSDictionary *selectTextParameterizedAttributeForCriteria(JSContextRef context, JSStringRef ambiguityResolution, JSValueRef searchStrings, JSStringRef replacementString, JSStringRef activity)
</span><span class="cx"> {
</span><span class="cx">     NSMutableDictionary *parameterizedAttribute = [NSMutableDictionary dictionary];
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerWebKitTestRunnerxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj (211410 => 211411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj        2017-01-31 07:21:43 UTC (rev 211410)
+++ trunk/Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj        2017-01-31 08:07:49 UTC (rev 211411)
</span><span class="lines">@@ -229,6 +229,7 @@
</span><span class="cx">                 29210EDC144CD56E00835BB5 /* AccessibilityUIElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AccessibilityUIElement.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 29210EE1144CDE6789815EE5 /* JSAccessibilityTextMarker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAccessibilityTextMarker.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 29210EE1145CDE6789815EE5 /* JSAccessibilityTextMarker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAccessibilityTextMarker.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                299E2AA41E3DEE140065DC30 /* AccessibilityCommonMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityCommonMac.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 29A8FCC5145B93C6009045A6 /* AccessibilityTextMarker.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = AccessibilityTextMarker.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 29A8FCD2145EF8F2009045A6 /* AccessibilityTextMarkerRange.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = AccessibilityTextMarkerRange.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 29A8FCDF145F0358009045A6 /* AccessibilityTextMarkerRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityTextMarkerRange.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -597,6 +598,7 @@
</span><span class="cx">                         children = (
</span><span class="cx">                                 29210EAB144CACB200835BB6 /* AccessibilityCommonMac.mm */,
</span><span class="cx">                                 8034C6611487636400AC32E9 /* AccessibilityControllerMac.mm */,
</span><ins>+                                299E2AA41E3DEE140065DC30 /* AccessibilityCommonMac.h */,
</ins><span class="cx">                                 29A8FCE4145F0464009045A6 /* AccessibilityTextMarkerRangeMac.mm */,
</span><span class="cx">                                 29210EAB144CACB200835BB5 /* AccessibilityUIElementMac.mm */,
</span><span class="cx">                                 BC8DAD771316D7B900EC96FC /* InjectedBundleMac.mm */,
</span></span></pre>
</div>
</div>

</body>
</html>