<!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>[204525] 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/204525">204525</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2016-08-16 15:15:47 -0700 (Tue, 16 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Make it possible to test iOS select elements, and add iPhone and iPad tests for them
https://bugs.webkit.org/show_bug.cgi?id=160909

Reviewed by Enrica Casucci.

Source/WebKit2:

Hook up form-related UIScriptController functions, and plumb through the various
&lt;select&gt; pickers the ability to select a row.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView dismissFormAccessoryView]):
(-[WKWebView selectFormAccessoryPickerRow:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView selectFormAccessoryPickerRow:]):
* UIProcess/ios/forms/WKFormSelectControl.h:
* UIProcess/ios/forms/WKFormSelectControl.mm:
(-[WKFormSelectControl selectRow:inComponent:extendingSelection:]):
* UIProcess/ios/forms/WKFormSelectPicker.mm:
(-[WKMultipleSelectPicker selectRow:inComponent:extendingSelection:]):
(-[WKSelectSinglePicker selectRow:inComponent:extendingSelection:]):
* UIProcess/ios/forms/WKFormSelectPopover.mm:
(-[WKSelectPopover selectRow:inComponent:extendingSelection:]):

Tools:

Add functions to UIScriptController to dismiss the form accessory view for iOS,
and to programmatically pick a row from a &lt;select&gt; picker.

* WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl:
* WebKitTestRunner/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::dismissFormAccessoryView):
(WTR::UIScriptController::selectFormAccessoryPickerRow):
* WebKitTestRunner/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptController::dismissFormAccessoryView):
(WTR::UIScriptController::selectFormAccessoryPickerRow):

LayoutTests:

Add iPhone and iPad tests for the &lt;select&gt; pickers. The iPhone test has to
use a didShowKeyboardCallback to know when to select the appropriate row,
and to dismiss the picker. The iPad test can just select the row, which also
dismisses the popover.

* fast/forms/ios/choose-select-option-expected.txt: Added.
* fast/forms/ios/choose-select-option.html: Added.
* fast/forms/ios/ipad/choose-select-option-expected.txt: Added.
* fast/forms/ios/ipad/choose-select-option.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewInteractionh">trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm">trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosformsWKFormSelectControlh">trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectControl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosformsWKFormSelectControlmm">trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectControl.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosformsWKFormSelectPickermm">trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectPicker.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosformsWKFormSelectPopovermm">trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectPopover.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsWebKitTestRunnerUIScriptContextBindingsUIScriptControlleridl">trunk/Tools/WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl</a></li>
<li><a href="#trunkToolsWebKitTestRunnerUIScriptContextUIScriptControllercpp">trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerUIScriptContextUIScriptControllerh">trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h</a></li>
<li><a href="#trunkToolsWebKitTestRunneriosUIScriptControllerIOSmm">trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastformsioschooseselectoptionexpectedtxt">trunk/LayoutTests/fast/forms/ios/choose-select-option-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsioschooseselectoptionhtml">trunk/LayoutTests/fast/forms/ios/choose-select-option.html</a></li>
<li><a href="#trunkLayoutTestsfastformsiosipadchooseselectoptionexpectedtxt">trunk/LayoutTests/fast/forms/ios/ipad/choose-select-option-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsiosipadchooseselectoptionhtml">trunk/LayoutTests/fast/forms/ios/ipad/choose-select-option.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (204524 => 204525)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-08-16 21:44:25 UTC (rev 204524)
+++ trunk/LayoutTests/ChangeLog        2016-08-16 22:15:47 UTC (rev 204525)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-08-16  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Make it possible to test iOS select elements, and add iPhone and iPad tests for them
+        https://bugs.webkit.org/show_bug.cgi?id=160909
+
+        Reviewed by Enrica Casucci.
+        
+        Add iPhone and iPad tests for the &lt;select&gt; pickers. The iPhone test has to 
+        use a didShowKeyboardCallback to know when to select the appropriate row,
+        and to dismiss the picker. The iPad test can just select the row, which also
+        dismisses the popover.
+
+        * fast/forms/ios/choose-select-option-expected.txt: Added.
+        * fast/forms/ios/choose-select-option.html: Added.
+        * fast/forms/ios/ipad/choose-select-option-expected.txt: Added.
+        * fast/forms/ios/ipad/choose-select-option.html: Added.
+
</ins><span class="cx"> 2016-08-15  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Add iPad viewport and form tests, and revert the iPad-testing part of r202132
</span></span></pre></div>
<a id="trunkLayoutTestsfastformsioschooseselectoptionexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ios/choose-select-option-expected.txt (0 => 204525)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ios/choose-select-option-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/choose-select-option-expected.txt        2016-08-16 22:15:47 UTC (rev 204525)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+Tests that a basic select element works
+
+
+Successfully handled oninput, value is now &quot;april&quot;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsioschooseselectoptionhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ios/choose-select-option.html (0 => 204525)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ios/choose-select-option.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/choose-select-option.html        2016-08-16 22:15:47 UTC (rev 204525)
</span><span class="lines">@@ -0,0 +1,84 @@
</span><ins>+&lt;!DOCTYPE html&gt; &lt;!-- webkit-test-runner [ useFlexibleViewport=true ] --&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width&quot;&gt;
+    &lt;style&gt;
+    &lt;/style&gt;
+    
+    &lt;script src=&quot;resources/zooming-test-utils.js&quot;&gt;&lt;/script&gt;
+    &lt;script&gt;
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    }
+
+    var uiScriptHasCompleted = false;
+    var oninputHasBeenHandled = false;
+
+    function getUIScript(x, y)
+    {
+        return `
+            (function() {
+                uiController.didShowKeyboardCallback = function() {
+                    uiController.selectFormAccessoryPickerRow(3);
+                    uiController.dismissFormAccessoryView();
+                    uiController.uiScriptComplete();
+                }
+                uiController.singleTapAtPoint(${x}, ${y}, function() {});
+            })();`
+    }
+
+    function checkDone()
+    {
+        if (oninputHasBeenHandled &amp;&amp; uiScriptHasCompleted)
+            testRunner.notifyDone();
+    }
+
+    function handleValueChanged(value)
+    {
+        document.getElementById(&quot;console&quot;).textContent = &quot;Successfully handled oninput, value is now \&quot;&quot; + value.toLowerCase() + &quot;\&quot;&quot;;
+        oninputHasBeenHandled = true;
+        checkDone();
+    }
+    
+    function doTest()
+    {
+        if (!window.testRunner || !testRunner.runUIScript)
+            return;
+
+        var targetElement = document.getElementsByTagName('select')[0];
+        var point = getPointInsideElement(targetElement, 10, 10);
+
+        testRunner.runUIScript(getUIScript(point.x, point.y), function() {
+            uiScriptHasCompleted = true;
+            checkDone();
+        });
+    }
+
+    window.addEventListener('load', doTest, false);
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Tests that a basic select element works&lt;/p&gt;
+
+&lt;select oninput=&quot;handleValueChanged(this.value)&quot;&gt;
+    &lt;option&gt;January&lt;/option&gt;
+    &lt;option&gt;February&lt;/option&gt;
+    &lt;option&gt;March&lt;/option&gt;
+    &lt;option&gt;April&lt;/option&gt;
+    &lt;option&gt;May&lt;/option&gt;
+    &lt;option&gt;June&lt;/option&gt;
+    &lt;option&gt;July&lt;/option&gt;
+    &lt;option&gt;August&lt;/option&gt;
+    &lt;option&gt;September&lt;/option&gt;
+    &lt;option&gt;October&lt;/option&gt;
+    &lt;option&gt;November&lt;/option&gt;
+    &lt;option&gt;December&lt;/option&gt;
+&lt;/select&gt;
+
+&lt;div id=&quot;console&quot;&gt;Failed to handle oninput&lt;div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsiosipadchooseselectoptionexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ios/ipad/choose-select-option-expected.txt (0 => 204525)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ios/ipad/choose-select-option-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/ipad/choose-select-option-expected.txt        2016-08-16 22:15:47 UTC (rev 204525)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+Tests that a basic select element works
+
+
+Successfully handled oninput, value is now &quot;april&quot;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsiosipadchooseselectoptionhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ios/ipad/choose-select-option.html (0 => 204525)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ios/ipad/choose-select-option.html                                (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/ipad/choose-select-option.html        2016-08-16 22:15:47 UTC (rev 204525)
</span><span class="lines">@@ -0,0 +1,91 @@
</span><ins>+&lt;!DOCTYPE html&gt; &lt;!-- webkit-test-runner [ useFlexibleViewport=true ] --&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width&quot;&gt;
+    &lt;style&gt;
+    &lt;/style&gt;
+    
+    &lt;script src=&quot;../resources/zooming-test-utils.js&quot;&gt;&lt;/script&gt;
+    &lt;script&gt;
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    }
+
+    var uiScriptHasCompleted = false;
+    var oninputHasBeenHandled = false;
+
+    function getTapOnSelectUIScript(x, y)
+    {
+        return `
+            (function() {
+                uiController.singleTapAtPoint(${x}, ${y}, function() {
+                    uiController.uiScriptComplete('');
+                });
+            })();`
+    }
+
+    function getUIScriptForSelectRow()
+    {
+        return `
+            (function() {
+                uiController.selectFormAccessoryPickerRow(3);
+            })();`
+    }
+    
+    function checkDone()
+    {
+        if (oninputHasBeenHandled &amp;&amp; uiScriptHasCompleted)
+            testRunner.notifyDone();
+    }
+
+    function handleValueChanged(value)
+    {
+        document.getElementById(&quot;console&quot;).textContent = &quot;Successfully handled oninput, value is now \&quot;&quot; + value.toLowerCase() + &quot;\&quot;&quot;;
+        oninputHasBeenHandled = true;
+        checkDone();
+    }
+    
+    function doTest()
+    {
+        if (!window.testRunner || !testRunner.runUIScript)
+            return;
+
+        var targetElement = document.getElementsByTagName('select')[0];
+        var point = getPointInsideElement(targetElement, 10, 10);
+
+        testRunner.runUIScript(getTapOnSelectUIScript(point.x, point.y), function() {
+            testRunner.runUIScript(getUIScriptForSelectRow(), function() {
+                uiScriptHasCompleted = true;
+                checkDone();
+            });
+        });
+    }
+
+    window.addEventListener('load', doTest, false);
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Tests that a basic select element works&lt;/p&gt;
+
+&lt;select oninput=&quot;handleValueChanged(this.value)&quot;&gt;
+    &lt;option&gt;January&lt;/option&gt;
+    &lt;option&gt;February&lt;/option&gt;
+    &lt;option&gt;March&lt;/option&gt;
+    &lt;option&gt;April&lt;/option&gt;
+    &lt;option&gt;May&lt;/option&gt;
+    &lt;option&gt;June&lt;/option&gt;
+    &lt;option&gt;July&lt;/option&gt;
+    &lt;option&gt;August&lt;/option&gt;
+    &lt;option&gt;September&lt;/option&gt;
+    &lt;option&gt;October&lt;/option&gt;
+    &lt;option&gt;November&lt;/option&gt;
+    &lt;option&gt;December&lt;/option&gt;
+&lt;/select&gt;
+
+&lt;div id=&quot;console&quot;&gt;Failed to handle oninput&lt;div&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (204524 => 204525)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-08-16 21:44:25 UTC (rev 204524)
+++ trunk/Source/WebKit2/ChangeLog        2016-08-16 22:15:47 UTC (rev 204525)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2016-08-16  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Make it possible to test iOS select elements, and add iPhone and iPad tests for them
+        https://bugs.webkit.org/show_bug.cgi?id=160909
+
+        Reviewed by Enrica Casucci.
+        
+        Hook up form-related UIScriptController functions, and plumb through the various
+        &lt;select&gt; pickers the ability to select a row.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView dismissFormAccessoryView]):
+        (-[WKWebView selectFormAccessoryPickerRow:]):
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView selectFormAccessoryPickerRow:]):
+        * UIProcess/ios/forms/WKFormSelectControl.h:
+        * UIProcess/ios/forms/WKFormSelectControl.mm:
+        (-[WKFormSelectControl selectRow:inComponent:extendingSelection:]):
+        * UIProcess/ios/forms/WKFormSelectPicker.mm:
+        (-[WKMultipleSelectPicker selectRow:inComponent:extendingSelection:]):
+        (-[WKSelectSinglePicker selectRow:inComponent:extendingSelection:]):
+        * UIProcess/ios/forms/WKFormSelectPopover.mm:
+        (-[WKSelectPopover selectRow:inComponent:extendingSelection:]):
+
</ins><span class="cx"> 2016-08-16  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Cleanup WK2 platform gamepad handling.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (204524 => 204525)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2016-08-16 21:44:25 UTC (rev 204524)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2016-08-16 22:15:47 UTC (rev 204525)
</span><span class="lines">@@ -4517,6 +4517,16 @@
</span><span class="cx">     [_contentView accessoryTab:NO];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)dismissFormAccessoryView
+{
+    [_contentView accessoryDone];
+}
+
+- (void)selectFormAccessoryPickerRow:(int)rowIndex
+{
+    [_contentView selectFormAccessoryPickerRow:rowIndex];
+}
+
</ins><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (204524 => 204525)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2016-08-16 21:44:25 UTC (rev 204524)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2016-08-16 22:15:47 UTC (rev 204525)
</span><span class="lines">@@ -254,6 +254,7 @@
</span><span class="cx"> @interface WKWebView (WKTesting)
</span><span class="cx"> 
</span><span class="cx"> #if TARGET_OS_IPHONE
</span><ins>+
</ins><span class="cx"> @property (nonatomic, readonly) CGRect _contentVisibleRect WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
</span><span class="cx"> - (CGPoint)_convertPointFromContentsToView:(CGPoint)point WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
</span><span class="cx"> - (CGPoint)_convertPointFromViewToContents:(CGPoint)point WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
</span><span class="lines">@@ -260,6 +261,9 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)keyboardAccessoryBarNext WK_API_AVAILABLE(ios(WK_IOS_TBA));
</span><span class="cx"> - (void)keyboardAccessoryBarPrevious WK_API_AVAILABLE(ios(WK_IOS_TBA));
</span><ins>+- (void)dismissFormAccessoryView WK_API_AVAILABLE(ios(WK_IOS_TBA));
+- (void)selectFormAccessoryPickerRow:(int)rowIndex WK_API_AVAILABLE(ios(WK_IOS_TBA));
+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if !TARGET_OS_IPHONE
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewInteractionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h (204524 => 204525)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h        2016-08-16 21:44:25 UTC (rev 204524)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h        2016-08-16 22:15:47 UTC (rev 204525)
</span><span class="lines">@@ -223,6 +223,12 @@
</span><span class="cx"> - (NSArray *)_dataDetectionResults;
</span><span class="cx"> @end
</span><span class="cx"> 
</span><ins>+@interface WKContentView (WKTesting)
+
+- (void)selectFormAccessoryPickerRow:(NSInteger)rowIndex;
+
+@end
+
</ins><span class="cx"> #if HAVE(LINK_PREVIEW)
</span><span class="cx"> @interface WKContentView (WKInteractionPreview) &lt;UIPreviewItemDelegate&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (204524 => 204525)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2016-08-16 21:44:25 UTC (rev 204524)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2016-08-16 22:15:47 UTC (rev 204525)
</span><span class="lines">@@ -3797,6 +3797,16 @@
</span><span class="cx"> 
</span><span class="cx"> @end
</span><span class="cx"> 
</span><ins>+@implementation WKContentView (WKTesting)
+
+- (void)selectFormAccessoryPickerRow:(NSInteger)rowIndex
+{
+    if ([_inputPeripheral isKindOfClass:[WKFormSelectControl self]])
+        [(WKFormSelectControl *)_inputPeripheral selectRow:rowIndex inComponent:0 extendingSelection:NO];
+}
+
+@end
+
</ins><span class="cx"> #if HAVE(LINK_PREVIEW)
</span><span class="cx"> 
</span><span class="cx"> @implementation WKContentView (WKInteractionPreview)
</span><span class="lines">@@ -4108,7 +4118,7 @@
</span><span class="cx"> 
</span><span class="cx"> @end
</span><span class="cx"> 
</span><del>-#endif
</del><ins>+#endif // HAVE(LINK_PREVIEW)
</ins><span class="cx"> 
</span><span class="cx"> // UITextRange, UITextPosition and UITextSelectionRect implementations for WK2
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosformsWKFormSelectControlh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectControl.h (204524 => 204525)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectControl.h        2016-08-16 21:44:25 UTC (rev 204524)
+++ trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectControl.h        2016-08-16 22:15:47 UTC (rev 204525)
</span><span class="lines">@@ -39,6 +39,10 @@
</span><span class="cx"> - (instancetype)initWithView:(WKContentView *)view;
</span><span class="cx"> @end
</span><span class="cx"> 
</span><ins>+@interface WKFormSelectControl(WKTesting)
+- (void)selectRow:(NSInteger)rowIndex inComponent:(NSInteger)componentIndex extendingSelection:(BOOL)extendingSelection;
+@end
+
</ins><span class="cx"> @interface WKSelectPopover : WKFormRotatingAccessoryPopover&lt;WKFormControl&gt;
</span><span class="cx"> - (instancetype)initWithView:(WKContentView *)view hasGroups:(BOOL)hasGroups;
</span><span class="cx"> - (void)_userActionDismissedPopover:(id)sender;
</span><span class="lines">@@ -52,5 +56,10 @@
</span><span class="cx"> - (instancetype)initWithView:(WKContentView *)view;
</span><span class="cx"> @end
</span><span class="cx"> 
</span><ins>+@protocol WKSelectTesting
+@optional
+- (void)selectRow:(NSInteger)rowIndex inComponent:(NSInteger)componentIndex extendingSelection:(BOOL)extendingSelection;
+@end
+
</ins><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosformsWKFormSelectControlmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectControl.mm (204524 => 204525)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectControl.mm        2016-08-16 21:44:25 UTC (rev 204524)
+++ trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectControl.mm        2016-08-16 22:15:47 UTC (rev 204525)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> @implementation WKFormSelectControl {
</span><del>-    RetainPtr&lt;id&lt;WKFormControl&gt;&gt; _control;
</del><ins>+    RetainPtr&lt;NSObject&lt;WKFormControl&gt;&gt; _control;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (instancetype)initWithView:(WKContentView *)view
</span><span class="lines">@@ -101,4 +101,14 @@
</span><span class="cx"> 
</span><span class="cx"> @end
</span><span class="cx"> 
</span><ins>+@implementation WKFormSelectControl(WKTesting)
+
+- (void)selectRow:(NSInteger)rowIndex inComponent:(NSInteger)componentIndex extendingSelection:(BOOL)extendingSelection
+{
+    if ([_control respondsToSelector:@selector(selectRow:inComponent:extendingSelection:)])
+        [id&lt;WKSelectTesting&gt;(_control.get()) selectRow:rowIndex inComponent:componentIndex extendingSelection:extendingSelection];
+}
+
+@end
+
</ins><span class="cx"> #endif  // PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosformsWKFormSelectPickermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectPicker.mm (204524 => 204525)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectPicker.mm        2016-08-16 21:44:25 UTC (rev 204524)
+++ trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectPicker.mm        2016-08-16 22:15:47 UTC (rev 204525)
</span><span class="lines">@@ -303,6 +303,15 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+// WKSelectTesting
+- (void)selectRow:(NSInteger)rowIndex inComponent:(NSInteger)componentIndex extendingSelection:(BOOL)extendingSelection
+{
+    // FIXME: handle extendingSelection.
+    [self selectRow:rowIndex inComponent:0 animated:NO];
+    // Progammatic selection changes don't call the delegate, so do that manually.
+    [self.delegate pickerView:self didSelectRow:rowIndex inComponent:0];
+}
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> @implementation WKSelectSinglePicker {
</span><span class="lines">@@ -430,6 +439,15 @@
</span><span class="cx">     _selectedIndex = row;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+// WKSelectTesting
+- (void)selectRow:(NSInteger)rowIndex inComponent:(NSInteger)componentIndex extendingSelection:(BOOL)extendingSelection
+{
+    // FIXME: handle extendingSelection.
+    [self selectRow:rowIndex inComponent:0 animated:NO];
+    // Progammatic selection changes don't call the delegate, so do that manually.
+    [self.delegate pickerView:self didSelectRow:rowIndex inComponent:0];
+}
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #endif  // PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosformsWKFormSelectPopovermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectPopover.mm (204524 => 204525)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectPopover.mm        2016-08-16 21:44:25 UTC (rev 204524)
+++ trunk/Source/WebKit2/UIProcess/ios/forms/WKFormSelectPopover.mm        2016-08-16 22:15:47 UTC (rev 204525)
</span><span class="lines">@@ -448,4 +448,16 @@
</span><span class="cx"> 
</span><span class="cx"> @end
</span><span class="cx"> 
</span><ins>+@implementation WKSelectPopover(WKTesting)
+
+- (void)selectRow:(NSInteger)rowIndex inComponent:(NSInteger)componentIndex extendingSelection:(BOOL)extendingSelection
+{
+    NSIndexPath *indexPath = [NSIndexPath indexPathForRow:rowIndex inSection:componentIndex];
+    [[_tableViewController tableView] selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionMiddle];
+    // Inform the delegate, since -selectRowAtIndexPath:... doesn't do that.
+    [_tableViewController tableView:[_tableViewController tableView] didSelectRowAtIndexPath:indexPath];
+}
+
+@end
+
</ins><span class="cx"> #endif  // PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (204524 => 204525)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-08-16 21:44:25 UTC (rev 204524)
+++ trunk/Tools/ChangeLog        2016-08-16 22:15:47 UTC (rev 204525)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2016-08-16  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Make it possible to test iOS select elements, and add iPhone and iPad tests for them
+        https://bugs.webkit.org/show_bug.cgi?id=160909
+
+        Reviewed by Enrica Casucci.
+        
+        Add functions to UIScriptController to dismiss the form accessory view for iOS,
+        and to programmatically pick a row from a &lt;select&gt; picker.
+
+        * WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl:
+        * WebKitTestRunner/UIScriptContext/UIScriptController.cpp:
+        (WTR::UIScriptController::dismissFormAccessoryView):
+        (WTR::UIScriptController::selectFormAccessoryPickerRow):
+        * WebKitTestRunner/UIScriptContext/UIScriptController.h:
+        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+        (WTR::UIScriptController::dismissFormAccessoryView):
+        (WTR::UIScriptController::selectFormAccessoryPickerRow):
+
</ins><span class="cx"> 2016-08-15  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Add iPad viewport and form tests, and revert the iPad-testing part of r202132
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerUIScriptContextBindingsUIScriptControlleridl"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl (204524 => 204525)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl        2016-08-16 21:44:25 UTC (rev 204524)
+++ trunk/Tools/WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl        2016-08-16 22:15:47 UTC (rev 204525)
</span><span class="lines">@@ -42,9 +42,16 @@
</span><span class="cx">     void keyDownUsingHardwareKeyboard(DOMString character, object callback);
</span><span class="cx">     void keyUpUsingHardwareKeyboard(DOMString character, object callback);
</span><span class="cx"> 
</span><ins>+    // Equivalent of pressing the Done button in the form accessory bar.
+    void dismissFormAccessoryView();
+
+    // &lt;select&gt; picker
+    void selectFormAccessoryPickerRow(long rowIndex);
+
</ins><span class="cx">     void keyboardAccessoryBarNext();
</span><span class="cx">     void keyboardAccessoryBarPrevious();
</span><span class="cx"> 
</span><ins>+    // These callbacks also work for the form accessory views.
</ins><span class="cx">     attribute object didShowKeyboardCallback;
</span><span class="cx">     attribute object didHideKeyboardCallback;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerUIScriptContextUIScriptControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp (204524 => 204525)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp        2016-08-16 21:44:25 UTC (rev 204524)
+++ trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp        2016-08-16 22:15:47 UTC (rev 204525)
</span><span class="lines">@@ -150,6 +150,14 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void UIScriptController::dismissFormAccessoryView()
+{
+}
+
+void UIScriptController::selectFormAccessoryPickerRow(long)
+{
+}
+
</ins><span class="cx"> void UIScriptController::keyboardAccessoryBarNext()
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerUIScriptContextUIScriptControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h (204524 => 204525)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h        2016-08-16 21:44:25 UTC (rev 204524)
+++ trunk/Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h        2016-08-16 22:15:47 UTC (rev 204525)
</span><span class="lines">@@ -59,6 +59,9 @@
</span><span class="cx"> 
</span><span class="cx">     void keyboardAccessoryBarNext();
</span><span class="cx">     void keyboardAccessoryBarPrevious();
</span><ins>+    
+    void dismissFormAccessoryView();
+    void selectFormAccessoryPickerRow(long);
</ins><span class="cx"> 
</span><span class="cx">     void setWillBeginZoomingCallback(JSValueRef);
</span><span class="cx">     JSValueRef willBeginZoomingCallback() const;
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunneriosUIScriptControllerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (204524 => 204525)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm        2016-08-16 21:44:25 UTC (rev 204524)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm        2016-08-16 22:15:47 UTC (rev 204525)
</span><span class="lines">@@ -175,6 +175,18 @@
</span><span class="cx">     }];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void UIScriptController::dismissFormAccessoryView()
+{
+    TestRunnerWKWebView *webView = TestController::singleton().mainWebView()-&gt;platformView();
+    [webView dismissFormAccessoryView];
+}
+
+void UIScriptController::selectFormAccessoryPickerRow(long rowIndex)
+{
+    TestRunnerWKWebView *webView = TestController::singleton().mainWebView()-&gt;platformView();
+    [webView selectFormAccessoryPickerRow:rowIndex];
+}
+
</ins><span class="cx"> void UIScriptController::keyboardAccessoryBarNext()
</span><span class="cx"> {
</span><span class="cx">     TestRunnerWKWebView *webView = TestController::singleton().mainWebView()-&gt;platformView();
</span></span></pre>
</div>
</div>

</body>
</html>