<!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>[171094] 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/171094">171094</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2014-07-14 17:14:03 -0700 (Mon, 14 Jul 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[iOS] Add tests to ensure CSS :active and :hover are applied when processing touch events
https://bugs.webkit.org/show_bug.cgi?id=134905
<rdar://problem/16602779>
Reviewed by Simon Fraser.
.:
Add a manual test to ensure that styles for CSS pseudo-class :hover aren't temporarily cleared
on the tapped element when processing a touchend as a result of finger pressing and releasing
on the same element that is initially positioned outside the visible content area.
* ManualTests/ios/touchstart-touchend-on-same-element-should-not-clear-hover.html: Added.
LayoutTests:
Upstream tests by Andreas Kling for <rdar://problem/14324231>.
Add a DRT test to ensure that we apply the style for the CSS pseudo-class :active when
processing touch events.
* platform/iphone-simulator/fast/events/ontouchstart-active-selector-expected.txt: Added.
* platform/iphone-simulator/fast/events/ontouchstart-active-selector.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkChangeLog">trunk/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/platform/iphone-simulator/</li>
<li>trunk/LayoutTests/platform/iphone-simulator/fast/</li>
<li>trunk/LayoutTests/platform/iphone-simulator/fast/events/</li>
<li><a href="#trunkLayoutTestsplatformiphonesimulatorfasteventsontouchstartactiveselectorexpectedtxt">trunk/LayoutTests/platform/iphone-simulator/fast/events/ontouchstart-active-selector-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformiphonesimulatorfasteventsontouchstartactiveselectorhtml">trunk/LayoutTests/platform/iphone-simulator/fast/events/ontouchstart-active-selector.html</a></li>
<li><a href="#trunkManualTestsiostouchstarttouchendonsameelementshouldnotclearhoverhtml">trunk/ManualTests/ios/touchstart-touchend-on-same-element-should-not-clear-hover.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/ChangeLog (171093 => 171094)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ChangeLog        2014-07-15 00:09:12 UTC (rev 171093)
+++ trunk/ChangeLog        2014-07-15 00:14:03 UTC (rev 171094)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-07-14 Daniel Bates <dabates@apple.com>
+
+ [iOS] Add tests to ensure CSS :active and :hover are applied when processing touch events
+ https://bugs.webkit.org/show_bug.cgi?id=134905
+ <rdar://problem/16602779>
+
+ Reviewed by Simon Fraser.
+
+ Add a manual test to ensure that styles for CSS pseudo-class :hover aren't temporarily cleared
+ on the tapped element when processing a touchend as a result of finger pressing and releasing
+ on the same element that is initially positioned outside the visible content area.
+
+ * ManualTests/ios/touchstart-touchend-on-same-element-should-not-clear-hover.html: Added.
+
</ins><span class="cx"> 2014-07-11 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><span class="cx"> [GTK] Enable VIDEO_TRACK by default
</span></span></pre></div>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (171093 => 171094)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-07-15 00:09:12 UTC (rev 171093)
+++ trunk/LayoutTests/ChangeLog        2014-07-15 00:14:03 UTC (rev 171094)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2014-07-14 Daniel Bates <dabates@apple.com>
+
+ [iOS] Add tests to ensure CSS :active and :hover are applied when processing touch events
+ https://bugs.webkit.org/show_bug.cgi?id=134905
+ <rdar://problem/16602779>
+
+ Reviewed by Simon Fraser.
+
+ Upstream tests by Andreas Kling for <rdar://problem/14324231>.
+
+ Add a DRT test to ensure that we apply the style for the CSS pseudo-class :active when
+ processing touch events.
+
+ * platform/iphone-simulator/fast/events/ontouchstart-active-selector-expected.txt: Added.
+ * platform/iphone-simulator/fast/events/ontouchstart-active-selector.html: Added.
+
</ins><span class="cx"> 2014-07-14 Manuel Rego Casasnovas <rego@igalia.com>
</span><span class="cx">
</span><span class="cx"> [CSS Grid Layout] Support sparse in auto-placement algorithm
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiphonesimulatorfasteventsontouchstartactiveselectorexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/iphone-simulator/fast/events/ontouchstart-active-selector-expected.txt (0 => 171094)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/iphone-simulator/fast/events/ontouchstart-active-selector-expected.txt         (rev 0)
+++ trunk/LayoutTests/platform/iphone-simulator/fast/events/ontouchstart-active-selector-expected.txt        2014-07-15 00:14:03 UTC (rev 171094)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+This tests the :active selector on touchable elements
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS getComputedStyle(touchMe).backgroundColor is 'rgb(0, 0, 255)'
+PASS getComputedStyle(touchMe).backgroundColor is 'rgb(255, 255, 0)'
+PASS getComputedStyle(touchMe).backgroundColor is 'rgb(0, 0, 255)'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformiphonesimulatorfasteventsontouchstartactiveselectorhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/iphone-simulator/fast/events/ontouchstart-active-selector.html (0 => 171094)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/iphone-simulator/fast/events/ontouchstart-active-selector.html         (rev 0)
+++ trunk/LayoutTests/platform/iphone-simulator/fast/events/ontouchstart-active-selector.html        2014-07-15 00:14:03 UTC (rev 171094)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../../../resources/js-test-pre.js"></script>
+
+<style>
+ #touchMe {
+ background-color: blue;
+ width: 200px;
+ height: 200px;
+ top: 0;
+ left: 0;
+ }
+ #touchMe:active {
+ background-color: yellow;
+ }
+</style>
+</head>
+<body>
+<div id="touchMe" ontouchstart=""></div>
+<script>
+
+description("This tests the :active selector on touchable elements");
+
+if (!window.eventSender)
+ debug("This test will FAIL outside of DRT, but you can test it manually by touching the blue square below. If it turns yellow when touched, the test is a PASS.");
+
+touchMe = document.getElementById("touchMe");
+
+shouldBe("getComputedStyle(touchMe).backgroundColor", "'rgb(0, 0, 255)'");
+
+if (window.eventSender) {
+ eventSender.clearTouchPoints();
+ eventSender.addTouchPoint(touchMe.offsetLeft + 10, touchMe.offsetTop + 10);
+ eventSender.touchStart();
+}
+
+shouldBe("getComputedStyle(touchMe).backgroundColor", "'rgb(255, 255, 0)'");
+
+if (window.eventSender) {
+ eventSender.clearTouchPoints();
+ eventSender.touchEnd();
+}
+
+shouldBe("getComputedStyle(touchMe).backgroundColor", "'rgb(0, 0, 255)'");
+
+</script>
+<script src="../../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkManualTestsiostouchstarttouchendonsameelementshouldnotclearhoverhtml"></a>
<div class="addfile"><h4>Added: trunk/ManualTests/ios/touchstart-touchend-on-same-element-should-not-clear-hover.html (0 => 171094)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/ManualTests/ios/touchstart-touchend-on-same-element-should-not-clear-hover.html         (rev 0)
+++ trunk/ManualTests/ios/touchstart-touchend-on-same-element-should-not-clear-hover.html        2014-07-15 00:14:03 UTC (rev 171094)
</span><span class="lines">@@ -0,0 +1,71 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.square {
+ -webkit-box-align: center;
+ -webkit-user-select: none;
+ background-color: blue;
+ color: red;
+ display: -webkit-box;
+ font-weight: bold;
+ height: 128px;
+ left: 700px;
+ position: absolute;
+ text-align: center;
+ top: 105%; /* Position the element such that we must scroll to it. */
+ width: 128px;
+}
+
+.square:hover {
+ background-color: yellow;
+}
+
+</style>
+</head>
+<body>
+<p>This test can be used to verify that we don't temporarily remove the CSS hover style between the touchend and click events when finger-pressing and -releasing on the same element that is positioned outside the visible content area initially. Perform the following:</p>
+<ol>
+ <li>Scroll the page until the blue square is visible.</li>
+ <li>Tap on the blue square.</li>
+</ol>
+<p>This test PASSED if there are three PASS messages followed by TEST COMPLETE below; otherwise, it FAILED.</p>
+<div id="square" class="square">Tap me then scroll up to see results</div>
+<pre id="console"></pre>
+<script>
+function addOrRemoveEventListeners(element, shouldAddListeners)
+{
+ var functionToCall = shouldAddListeners == undefined || shouldAddListeners ? "addEventListener" : "removeEventListener";
+ element[functionToCall]("touchstart", checkHoverState, true);
+ element[functionToCall]("touchend", checkHoverState, true);
+ element[functionToCall]("click", checkHoverState, true);
+}
+
+function log(message)
+{
+ document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
+}
+
+function testElementBackgroundColor(element, eventType, expectedResult)
+{
+ var actualResult = window.getComputedStyle(square, null).backgroundColor;
+ if (actualResult === expectedResult)
+ log("PASS, backgroundColor on " + eventType + " is " + expectedResult + ".");
+ else
+ log("FAIL, backgroundColor on " + eventType + " should be " + expectedResult + ". Was " + actualResult + ".");
+}
+
+function checkHoverState(e)
+{
+ testElementBackgroundColor(square, e.type, "rgb(255, 255, 0)" /* Yellow */);
+ if (e.type === "click") {
+ addOrRemoveEventListeners(square, false /* Remove event listeners */);
+ log("TEST COMPLETE");
+ }
+}
+
+var square = document.getElementById("square");
+addOrRemoveEventListeners(square);
+</script>
+</body>
+</html>
</ins></span></pre>
</div>
</div>
</body>
</html>