<!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>[202114] trunk/LayoutTests</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/202114">202114</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2016-06-15 16:07:42 -0700 (Wed, 15 Jun 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>[iOS WK2] Add tests for zooming to text fields on focus
https://bugs.webkit.org/show_bug.cgi?id=158786
Reviewed by Enrica Casucci.
Add tests that focus form controls, and test the resulting scroll position and zoom level.
* TestExpectations:
* fast/forms/ios/focus-input-via-button-expected.txt: Added.
* fast/forms/ios/focus-input-via-button-no-scaling-expected.txt: Added.
* fast/forms/ios/focus-input-via-button-no-scaling.html: Added.
* fast/forms/ios/focus-input-via-button.html: Added.
* fast/forms/ios/resources/zooming-test-utils.js: Added.
(testZoomAfterTap):
(tableFromJSON):
* fast/forms/ios/zoom-after-input-tap-expected.txt: Added.
* fast/forms/ios/zoom-after-input-tap-wide-input-expected.txt: Added.
* fast/forms/ios/zoom-after-input-tap-wide-input.html: Added.
* fast/forms/ios/zoom-after-input-tap.html: Added.
* platform/ios-simulator-wk2/TestExpectations:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/fast/forms/ios/</li>
<li><a href="#trunkLayoutTestsfastformsiosfocusinputviabuttonexpectedtxt">trunk/LayoutTests/fast/forms/ios/focus-input-via-button-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsiosfocusinputviabuttonnoscalingexpectedtxt">trunk/LayoutTests/fast/forms/ios/focus-input-via-button-no-scaling-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsiosfocusinputviabuttonnoscalinghtml">trunk/LayoutTests/fast/forms/ios/focus-input-via-button-no-scaling.html</a></li>
<li><a href="#trunkLayoutTestsfastformsiosfocusinputviabuttonhtml">trunk/LayoutTests/fast/forms/ios/focus-input-via-button.html</a></li>
<li>trunk/LayoutTests/fast/forms/ios/resources/</li>
<li><a href="#trunkLayoutTestsfastformsiosresourceszoomingtestutilsjs">trunk/LayoutTests/fast/forms/ios/resources/zooming-test-utils.js</a></li>
<li><a href="#trunkLayoutTestsfastformsioszoomafterinputtapexpectedtxt">trunk/LayoutTests/fast/forms/ios/zoom-after-input-tap-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsioszoomafterinputtapwideinputexpectedtxt">trunk/LayoutTests/fast/forms/ios/zoom-after-input-tap-wide-input-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastformsioszoomafterinputtapwideinputhtml">trunk/LayoutTests/fast/forms/ios/zoom-after-input-tap-wide-input.html</a></li>
<li><a href="#trunkLayoutTestsfastformsioszoomafterinputtaphtml">trunk/LayoutTests/fast/forms/ios/zoom-after-input-tap.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (202113 => 202114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-06-15 22:37:03 UTC (rev 202113)
+++ trunk/LayoutTests/ChangeLog        2016-06-15 23:07:42 UTC (rev 202114)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2016-06-15 Simon Fraser <simon.fraser@apple.com>
+
+ [iOS WK2] Add tests for zooming to text fields on focus
+ https://bugs.webkit.org/show_bug.cgi?id=158786
+
+ Reviewed by Enrica Casucci.
+
+ Add tests that focus form controls, and test the resulting scroll position and zoom level.
+
+ * TestExpectations:
+ * fast/forms/ios/focus-input-via-button-expected.txt: Added.
+ * fast/forms/ios/focus-input-via-button-no-scaling-expected.txt: Added.
+ * fast/forms/ios/focus-input-via-button-no-scaling.html: Added.
+ * fast/forms/ios/focus-input-via-button.html: Added.
+ * fast/forms/ios/resources/zooming-test-utils.js: Added.
+ (testZoomAfterTap):
+ (tableFromJSON):
+ * fast/forms/ios/zoom-after-input-tap-expected.txt: Added.
+ * fast/forms/ios/zoom-after-input-tap-wide-input-expected.txt: Added.
+ * fast/forms/ios/zoom-after-input-tap-wide-input.html: Added.
+ * fast/forms/ios/zoom-after-input-tap.html: Added.
+ * platform/ios-simulator-wk2/TestExpectations:
+
</ins><span class="cx"> 2016-06-15 Adam Bergkvist <adam.bergkvist@ericsson.com>
</span><span class="cx">
</span><span class="cx"> WebRTC: Add media setup test using the legacy callback APIs
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (202113 => 202114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations        2016-06-15 22:37:03 UTC (rev 202113)
+++ trunk/LayoutTests/TestExpectations        2016-06-15 23:07:42 UTC (rev 202114)
</span><span class="lines">@@ -17,6 +17,7 @@
</span><span class="cx"> tiled-drawing [ Skip ]
</span><span class="cx"> swipe [ Skip ]
</span><span class="cx"> fast/zooming/ios [ Skip ]
</span><ins>+fast/forms/ios [ Skip ]
</ins><span class="cx"> fast/viewport/ios [ Skip ]
</span><span class="cx"> fast/events/ios [ Skip ]
</span><span class="cx"> fast/events/touch/ios [ Skip ]
</span></span></pre></div>
<a id="trunkLayoutTestsfastformsiosfocusinputviabuttonexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ios/focus-input-via-button-expected.txt (0 => 202114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ios/focus-input-via-button-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/focus-input-via-button-expected.txt        2016-06-15 23:07:42 UTC (rev 202114)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+Tests zooming into a text input on tap.
+
+Click to focus input
+
+tap location        { x: 20.000, y: 62.000 }
+scale        1.455
+visibleRect        { left: 0.000, top: 791.923, width: 219.979, height: 329.968 }
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsiosfocusinputviabuttonnoscalingexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ios/focus-input-via-button-no-scaling-expected.txt (0 => 202114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ios/focus-input-via-button-no-scaling-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/focus-input-via-button-no-scaling-expected.txt        2016-06-15 23:07:42 UTC (rev 202114)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+Tests zooming into a text input on tap.
+
+Click to focus input
+
+tap location        { x: 20.000, y: 62.000 }
+scale        0.749
+visibleRect        { left: 0.000, top: 703.883, width: 427.000, height: 640.500 }
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsiosfocusinputviabuttonnoscalinghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ios/focus-input-via-button-no-scaling.html (0 => 202114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ios/focus-input-via-button-no-scaling.html         (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/focus-input-via-button-no-scaling.html        2016-06-15 23:07:42 UTC (rev 202114)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<head>
+ <meta name="viewport" content="initial-scale=0.75, user-scalable=no">
+ <style>
+ input[type="text"] {
+ margin: 800px 20px;
+ }
+ button {
+ display: block;
+ }
+ </style>
+
+ <script src="resources/zooming-test-utils.js"></script>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ function buttonClicked()
+ {
+ document.getElementById('input').focus();
+ }
+
+ function doTest()
+ {
+ testZoomAfterTap(document.getElementById('target'), 10, 10);
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+
+<p>Tests zooming into a text input on tap.</p>
+<button id="target" onclick="buttonClicked()">Click to focus input</button>
+
+<input id="input" type="text">
+
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsiosfocusinputviabuttonhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ios/focus-input-via-button.html (0 => 202114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ios/focus-input-via-button.html         (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/focus-input-via-button.html        2016-06-15 23:07:42 UTC (rev 202114)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<head>
+ <meta name="viewport" content="initial-scale=0.5">
+ <style>
+ input[type="text"] {
+ margin: 800px 20px;
+ }
+ button {
+ display: block;
+ }
+ </style>
+
+ <script src="resources/zooming-test-utils.js"></script>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ function buttonClicked()
+ {
+ document.getElementById('input').focus();
+ }
+
+ function doTest()
+ {
+ testZoomAfterTap(document.getElementById('target'), 10, 10);
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+
+<p>Tests zooming into a text input on tap.</p>
+<button id="target" onclick="buttonClicked()">Click to focus input</button>
+
+<input id="input" type="text">
+
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsiosresourceszoomingtestutilsjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ios/resources/zooming-test-utils.js (0 => 202114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ios/resources/zooming-test-utils.js         (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/resources/zooming-test-utils.js        2016-06-15 23:07:42 UTC (rev 202114)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+
+function testZoomAfterTap(targetElement, xOffset, yOffset)
+{
+ if (!window.testRunner || !testRunner.runUIScript)
+ return;
+
+ // Tap near the right end of the text.
+ var point = getPointInsideElement(targetElement, xOffset, yOffset);
+
+ var uiScript = zoomAfterSingleTapUIScript(point.x, point.y);
+ testRunner.runUIScript(uiScript, function(result) {
+ var results = tableFromJSON(result);
+ document.body.appendChild(results);
+ testRunner.notifyDone();
+ });
+}
+
+function zoomAfterSingleTapUIScript(x, y)
+{
+ return `
+ (function() {
+ uiController.didEndZoomingCallback = function() {
+ var result = {
+ 'tap location' : { 'x' : ${x}, 'y' : ${y}},
+ 'scale' : uiController.zoomScale,
+ 'visibleRect' : uiController.contentVisibleRect
+ };
+
+ var result = JSON.stringify(result, function(key, value) {
+ if (typeof value === "number")
+ return value.toFixed(3);
+ return value;
+ });
+
+ uiController.uiScriptComplete(result);
+ };
+
+ uiController.singleTapAtPoint(${x}, ${y}, function() {});
+ })();`
+}
+
+function getPointInsideElement(element, xOffset, yOffset)
+{
+ var clientRect = element.getBoundingClientRect();
+
+ var scrollLeft = document.scrollingElement.scrollLeft;
+ var scrollTop = document.scrollingElement.scrollTop;
+
+ // Returns point in document coordinates.
+ return { 'x' : clientRect.left + scrollLeft + xOffset, 'y' : clientRect.top + scrollTop + yOffset };
+}
+
+function tableFromJSON(value)
+{
+ var result = JSON.parse(value);
+
+ var table = document.createElement('table');
+ for (var property in result) {
+ var row = document.createElement('tr');
+
+ var th = document.createElement('th');
+ th.textContent = property;
+
+ var td = document.createElement('td');
+ var value = result[property];
+ if (typeof value === "object")
+ value = JSON.stringify(value, "", 2).replace(/"/g, '');
+
+ td.textContent = value;
+
+ row.appendChild(th);
+ row.appendChild(td);
+ table.appendChild(row);
+ }
+
+ return table;
+}
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsioszoomafterinputtapexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ios/zoom-after-input-tap-expected.txt (0 => 202114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ios/zoom-after-input-tap-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/zoom-after-input-tap-expected.txt        2016-06-15 23:07:42 UTC (rev 202114)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+Tests zooming into a text input on tap.
+
+
+tap location        { x: 38.000, y: 862.000 }
+scale        1.455
+visibleRect        { left: 0.000, top: 769.925, width: 219.979, height: 329.968 }
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsioszoomafterinputtapwideinputexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ios/zoom-after-input-tap-wide-input-expected.txt (0 => 202114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ios/zoom-after-input-tap-wide-input-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/zoom-after-input-tap-wide-input-expected.txt        2016-06-15 23:07:42 UTC (rev 202114)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+Tests zooming to an offset in a wide text input on tap.
+
+
+tap location        { x: 328.000, y: 862.000 }
+scale        1.455
+visibleRect        { left: 122.707, top: 769.928, width: 219.980, height: 329.969 }
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsioszoomafterinputtapwideinputhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ios/zoom-after-input-tap-wide-input.html (0 => 202114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ios/zoom-after-input-tap-wide-input.html         (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/zoom-after-input-tap-wide-input.html        2016-06-15 23:07:42 UTC (rev 202114)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<head>
+ <meta name="viewport" content="initial-scale=0.5">
+ <style>
+ input[type="text"] {
+ margin: 800px 20px;
+ }
+ </style>
+
+ <script src="resources/zooming-test-utils.js"></script>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ function doTest()
+ {
+ testZoomAfterTap(document.getElementById('input'), 300, 10);
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+
+<p>Tests zooming to an offset in a wide text input on tap.</p>
+<input id="input" type="text" size="100" value="abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz">
+
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsfastformsioszoomafterinputtaphtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/forms/ios/zoom-after-input-tap.html (0 => 202114)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/forms/ios/zoom-after-input-tap.html         (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/zoom-after-input-tap.html        2016-06-15 23:07:42 UTC (rev 202114)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<head>
+ <meta name="viewport" content="initial-scale=0.5">
+ <style>
+ input[type="text"] {
+ margin: 800px 20px;
+ }
+ </style>
+
+ <script src="resources/zooming-test-utils.js"></script>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ function doTest()
+ {
+ testZoomAfterTap(document.getElementById('input'), 10, 10);
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+
+<p>Tests zooming into a text input on tap.</p>
+<input id="input" type="text">
+
+</body>
+</html>
</ins></span></pre>
</div>
</div>
</body>
</html>