Title: [204720] trunk
Revision
204720
Author
dba...@webkit.org
Date
2016-08-22 09:13:28 -0700 (Mon, 22 Aug 2016)

Log Message

[iOS] <a ping> and <area ping> tests time out
https://bugs.webkit.org/show_bug.cgi?id=156857

Reviewed by Simon Fraser.

Source/WebCore:

Export HTMLAreaElement::imageElement() so that we can make use of it in WebKit2.

* html/HTMLAreaElement.h:

Source/WebKit2:

Support single tapping on an HTML area element in WebKit2 just as we do in Legacy WebKit.

WebKit2 commits to clicking a "clickable" DOM node on a single tap only if it has a
renderer. An HTML area element represents a hyperlink in an image map and does not have
a renderer.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::sendTapHighlightForNodeIfNecessary): Compute the tap highlight with respect
to the renderer for the image map associated with the tapped HTML area element (if it has one).
(WebKit::WebPage::commitPotentialTap): Allow committing a potential tap on an HTML area element.

LayoutTests:

Update test to use work in WebKitTestRunner and unskip the tests.

Also remove some unused files.

* http/tests/navigation/ping-attribute/anchor-cross-origin-from-https.html: Include external _javascript_
script resources/utilities.js and write code in terms of clickElement(). Additionally, add HTML5 doctype
tag and put <head> on its own line so as to be consistent with the placement of </head> on its own line.
* http/tests/navigation/ping-attribute/anchor-cross-origin.html: Ditto.
* http/tests/navigation/ping-attribute/anchor-same-origin.html: Ditto.
* http/tests/navigation/ping-attribute/resources/check-ping.php: Removed.
* http/tests/navigation/ping-attribute/resources/delete-ping.php: Removed.
* http/tests/navigation/ping-attribute/resources/ping-file-path.php: Removed.
* http/tests/navigation/ping-attribute/resources/save-Ping.php: Removed.
* http/tests/navigation/ping-attribute/resources/utilities.js:
(clearLastPingResultAndRunTest):
(clickElement): Make use of UIScriptController to click the element via a tap on platforms that
support touch events and implement UIScriptController (window.uiController).
* platform/ios-simulator-wk2/TestExpectations: Unskip ping-attribute tests.
* platform/ios-simulator/TestExpectations: Ditto.

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (204719 => 204720)


--- trunk/LayoutTests/ChangeLog	2016-08-22 16:05:17 UTC (rev 204719)
+++ trunk/LayoutTests/ChangeLog	2016-08-22 16:13:28 UTC (rev 204720)
@@ -1,3 +1,30 @@
+2016-08-22  Daniel Bates  <daba...@apple.com>
+
+        [iOS] <a ping> and <area ping> tests time out
+        https://bugs.webkit.org/show_bug.cgi?id=156857
+
+        Reviewed by Simon Fraser.
+
+        Update test to use work in WebKitTestRunner and unskip the tests.
+
+        Also remove some unused files.
+
+        * http/tests/navigation/ping-attribute/anchor-cross-origin-from-https.html: Include external _javascript_
+        script resources/utilities.js and write code in terms of clickElement(). Additionally, add HTML5 doctype
+        tag and put <head> on its own line so as to be consistent with the placement of </head> on its own line.
+        * http/tests/navigation/ping-attribute/anchor-cross-origin.html: Ditto.
+        * http/tests/navigation/ping-attribute/anchor-same-origin.html: Ditto.
+        * http/tests/navigation/ping-attribute/resources/check-ping.php: Removed.
+        * http/tests/navigation/ping-attribute/resources/delete-ping.php: Removed.
+        * http/tests/navigation/ping-attribute/resources/ping-file-path.php: Removed.
+        * http/tests/navigation/ping-attribute/resources/save-Ping.php: Removed.
+        * http/tests/navigation/ping-attribute/resources/utilities.js:
+        (clearLastPingResultAndRunTest):
+        (clickElement): Make use of UIScriptController to click the element via a tap on platforms that
+        support touch events and implement UIScriptController (window.uiController).
+        * platform/ios-simulator-wk2/TestExpectations: Unskip ping-attribute tests.
+        * platform/ios-simulator/TestExpectations: Ditto.
+
 2016-08-22  Youenn Fablet  <you...@apple.com>
 
         LayoutTest http/tests/fetch/fetch-in-worker-crash.html is flaky

Modified: trunk/LayoutTests/http/tests/navigation/ping-attribute/anchor-cross-origin-from-https.html (204719 => 204720)


--- trunk/LayoutTests/http/tests/navigation/ping-attribute/anchor-cross-origin-from-https.html	2016-08-22 16:05:17 UTC (rev 204719)
+++ trunk/LayoutTests/http/tests/navigation/ping-attribute/anchor-cross-origin-from-https.html	2016-08-22 16:13:28 UTC (rev 204720)
@@ -1,5 +1,8 @@
-<html><head>
+<!DOCTYPE html>
+<html>
+<head>
 <title>Ping</title>
+<script src=""
 <script>
 
 if (window.testRunner) {
@@ -23,12 +26,7 @@
         return;
     }
 
-    if (window.eventSender) {
-        var a = document.getElementById("a");
-        eventSender.mouseMoveTo(a.offsetLeft + 2, a.offsetTop + 2);
-        eventSender.mouseDown();
-        eventSender.mouseUp();
-    }
+    clickElement(document.getElementById("a"));
 }
 
 </script>

Modified: trunk/LayoutTests/http/tests/navigation/ping-attribute/anchor-cross-origin.html (204719 => 204720)


--- trunk/LayoutTests/http/tests/navigation/ping-attribute/anchor-cross-origin.html	2016-08-22 16:05:17 UTC (rev 204719)
+++ trunk/LayoutTests/http/tests/navigation/ping-attribute/anchor-cross-origin.html	2016-08-22 16:13:28 UTC (rev 204720)
@@ -1,5 +1,8 @@
-<html><head>
+<!DOCTYPE html>
+<html>
+<head>
 <title>Ping</title>
+<script src=""
 <script>
 
 var testCalled = false;
@@ -15,12 +18,7 @@
         return;
     }
 
-    if (window.eventSender) {
-        var a = document.getElementById("a");
-        eventSender.mouseMoveTo(a.offsetLeft + 2, a.offsetTop + 2);
-        eventSender.mouseDown();
-        eventSender.mouseUp();
-    }
+    clickElement(document.getElementById("a"));
 }
 
 </script>

Modified: trunk/LayoutTests/http/tests/navigation/ping-attribute/anchor-same-origin.html (204719 => 204720)


--- trunk/LayoutTests/http/tests/navigation/ping-attribute/anchor-same-origin.html	2016-08-22 16:05:17 UTC (rev 204719)
+++ trunk/LayoutTests/http/tests/navigation/ping-attribute/anchor-same-origin.html	2016-08-22 16:13:28 UTC (rev 204720)
@@ -1,5 +1,8 @@
-<html><head>
+<!DOCTYPE html>
+<html>
+<head>
 <title>Ping</title>
+<script src=""
 <script>
 
 var testCalled = false;
@@ -15,12 +18,7 @@
         return;
     }
 
-    if (window.eventSender) {
-        var a = document.getElementById("a");
-        eventSender.mouseMoveTo(a.offsetLeft + 2, a.offsetTop + 2);
-        eventSender.mouseDown();
-        eventSender.mouseUp();
-    }
+    clickElement(document.getElementById("a"));
 }
 
 </script>

Deleted: trunk/LayoutTests/http/tests/navigation/ping-attribute/resources/check-ping.php (204719 => 204720)


--- trunk/LayoutTests/http/tests/navigation/ping-attribute/resources/check-ping.php	2016-08-22 16:05:17 UTC (rev 204719)
+++ trunk/LayoutTests/http/tests/navigation/ping-attribute/resources/check-ping.php	2016-08-22 16:13:28 UTC (rev 204720)
@@ -1,24 +0,0 @@
-<?php
-require_once 'ping-file-path.php';
-
-while (!file_exists($pingFilePath)) {
-    usleep(10000);
-    // file_exists() caches results, we want to invalidate the cache.
-    clearstatcache();
-}
-
-echo "<html><body>\n";
-echo "Ping sent successfully";
-$pingFile = fopen($pingFilePath, 'r');
-while ($line = fgets($pingFile)) {
-    echo "<br>";
-    echo trim($line);
-}
-fclose($pingFile);
-unlink($pingFilePath);
-echo "<script>";
-echo "if (window.testRunner)";
-echo "    testRunner.notifyDone();";
-echo "</script>";
-echo "</body></html>";
-?>

Deleted: trunk/LayoutTests/http/tests/navigation/ping-attribute/resources/delete-ping.php (204719 => 204720)


--- trunk/LayoutTests/http/tests/navigation/ping-attribute/resources/delete-ping.php	2016-08-22 16:05:17 UTC (rev 204719)
+++ trunk/LayoutTests/http/tests/navigation/ping-attribute/resources/delete-ping.php	2016-08-22 16:13:28 UTC (rev 204720)
@@ -1,5 +0,0 @@
-<?php
-require_once 'ping-file-path.php';
-
-unlink($pingFilePath);
-?>

Deleted: trunk/LayoutTests/http/tests/navigation/ping-attribute/resources/ping-file-path.php (204719 => 204720)


--- trunk/LayoutTests/http/tests/navigation/ping-attribute/resources/ping-file-path.php	2016-08-22 16:05:17 UTC (rev 204719)
+++ trunk/LayoutTests/http/tests/navigation/ping-attribute/resources/ping-file-path.php	2016-08-22 16:13:28 UTC (rev 204720)
@@ -1,16 +0,0 @@
-<?php
-require_once '../../../resources/portabilityLayer.php';
-
-if (isset($_GET['test'])) {
-    $pingFilePath = sys_get_temp_dir() . "/" . str_replace("/", "-", $_GET['test']) . ".ping.txt"; 
-} elseif (isset($_SERVER["HTTP_REFERER"]) and strpos($_SERVER["HTTP_REFERER"], '/resources/') === false) {
-    $pingFilePath = sys_get_temp_dir() . "/" . str_replace("/", "-", parse_url($_SERVER["HTTP_REFERER"], PHP_URL_PATH)) . ".ping.txt"; 
-} elseif (isset($_SERVER["HTTP_PING_FROM"]) and strpos($_SERVER["HTTP_PING_FROM"], '/resources/') === false) {
-    $pingFilePath = sys_get_temp_dir() . "/" . str_replace("/", "-", parse_url($_SERVER["HTTP_PING_FROM"], PHP_URL_PATH)) . ".ping.txt"; 
-} else {
-    header("HTTP/1.1 500 Internal Server Error");
-    echo "This script needs to know the name of the test to form a unique temporary file path. It can get one either from HTTP referrer, or from a 'test' parameter.\n";
-    exit();
-}
-
-?>

Deleted: trunk/LayoutTests/http/tests/navigation/ping-attribute/resources/save-Ping.php (204719 => 204720)


--- trunk/LayoutTests/http/tests/navigation/ping-attribute/resources/save-Ping.php	2016-08-22 16:05:17 UTC (rev 204719)
+++ trunk/LayoutTests/http/tests/navigation/ping-attribute/resources/save-Ping.php	2016-08-22 16:13:28 UTC (rev 204720)
@@ -1,15 +0,0 @@
-<?php
-require_once 'ping-file-path.php';
-
-$pingFile = fopen($pingFilePath . ".tmp", 'w');
-$httpHeaders = $_SERVER;
-ksort($httpHeaders, SORT_STRING);
-foreach ($httpHeaders as $name => $value) {
-    if ($name === "CONTENT_TYPE" || $name === "HTTP_REFERER" || $name === "HTTP_PING_TO" || $name === "HTTP_PING_FROM" || $name === "REQUEST_METHOD" || $name === "HTTP_COOKIE")
-        fwrite($pingFile, "$name: $value\n");
-}
-fclose($pingFile);
-rename($pingFilePath . ".tmp", $pingFilePath);
-foreach ($_COOKIE as $name => $value)
-    setcookie($name, "deleted", time() - 60, "/");
-?>

Modified: trunk/LayoutTests/http/tests/navigation/ping-attribute/resources/utilities.js (204719 => 204720)


--- trunk/LayoutTests/http/tests/navigation/ping-attribute/resources/utilities.js	2016-08-22 16:05:17 UTC (rev 204719)
+++ trunk/LayoutTests/http/tests/navigation/ping-attribute/resources/utilities.js	2016-08-22 16:13:28 UTC (rev 204720)
@@ -26,7 +26,7 @@
     }
 
     var xhr = new XMLHttpRequest;
-    xhr.open("GET", "resources/delete-ping.php", true /* async */);
+    xhr.open("GET", "../../resources/delete-ping.php", true /* async */);
     xhr.send(null);
     xhr._onload_ = callback;
     xhr._onerror_ = done;
@@ -34,9 +34,14 @@
 
 function clickElement(element)
 {
-    if (!window.eventSender)
-        return;
-    eventSender.mouseMoveTo(element.offsetLeft + 2, element.offsetTop + 2);
-    eventSender.mouseDown();
-    eventSender.mouseUp();
+    var x = element.offsetLeft + 2;
+    var y = element.offsetTop + 2;
+    var supportsTouchEvents = "TouchEvent" in window;
+    if (testRunner.runUIScript && supportsTouchEvents)
+        testRunner.runUIScript("(function() { uiController.singleTapAtPoint(" + x + ", " + y + "); })()");
+    else if (window.eventSender) {
+        eventSender.mouseMoveTo(x, y);
+        eventSender.mouseDown();
+        eventSender.mouseUp();
+    }
 }

Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (204719 => 204720)


--- trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-08-22 16:05:17 UTC (rev 204719)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-08-22 16:13:28 UTC (rev 204720)
@@ -317,8 +317,6 @@
 # The file-wrapper part of <attachment> is not yet working on iOS
 fast/attachment/attachment-type-attribute.html [ Skip ]
 
-webkit.org/b/156857 http/tests/navigation/ping-attribute [ Skip ]
-
 # RTL Scrollbars are only implemented on certain versions of OS X
 fast/scrolling/rtl-scrollbars-iframe-scrolled.html [ Skip ]
 fast/scrolling/rtl-scrollbars-listbox-scroll.html [ Skip ]

Modified: trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations (204719 => 204720)


--- trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2016-08-22 16:05:17 UTC (rev 204719)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2016-08-22 16:13:28 UTC (rev 204720)
@@ -405,9 +405,6 @@
 http/tests/navigation/no-referrer-same-window.html
 http/tests/navigation/no-referrer-subframe.html
 http/tests/navigation/no-referrer-target-blank.html
-http/tests/navigation/ping-attribute/anchor-cross-origin-from-https.html
-http/tests/navigation/ping-attribute/anchor-cross-origin.html
-http/tests/navigation/ping-attribute/anchor-same-origin.html
 http/tests/navigation/redirect-preserves-referrer.html
 http/tests/navigation/redirect-to-random-url-versus-memory-cache.html
 http/tests/security/aboutBlank/xss-DENIED-navigate-opener-document-write.html
@@ -1741,7 +1738,6 @@
 # Skip timeouts
 fast/dom/Geolocation/startUpdatingOnlyWhenPageVisible.html [ Skip ]
 fast/dom/Geolocation/stopUpdatingForHiddenPage.html [ Skip ]
-http/tests/navigation/ping-attribute/anchor-cookie.html [ Skip ]
 webkit.org/b/148709 fast/events/wheelevent-basic.html [ Skip ]
 webkit.org/b/148709 fast/events/wheelevent-mousewheel-interaction.html [ Skip ]
 

Modified: trunk/Source/WebCore/ChangeLog (204719 => 204720)


--- trunk/Source/WebCore/ChangeLog	2016-08-22 16:05:17 UTC (rev 204719)
+++ trunk/Source/WebCore/ChangeLog	2016-08-22 16:13:28 UTC (rev 204720)
@@ -1,3 +1,14 @@
+2016-08-22  Daniel Bates  <daba...@apple.com>
+
+        [iOS] <a ping> and <area ping> tests time out
+        https://bugs.webkit.org/show_bug.cgi?id=156857
+
+        Reviewed by Simon Fraser.
+
+        Export HTMLAreaElement::imageElement() so that we can make use of it in WebKit2.
+
+        * html/HTMLAreaElement.h:
+
 2016-08-22  Darin Adler  <da...@apple.com>
 
         [Cocoa] Move Objective-C DOM bindings from WebCore to legacy WebKit

Modified: trunk/Source/WebCore/html/HTMLAreaElement.h (204719 => 204720)


--- trunk/Source/WebCore/html/HTMLAreaElement.h	2016-08-22 16:05:17 UTC (rev 204719)
+++ trunk/Source/WebCore/html/HTMLAreaElement.h	2016-08-22 16:13:28 UTC (rev 204720)
@@ -46,7 +46,7 @@
     Path computePathForFocusRing(const LayoutSize& elementSize) const;
 
     // The parent map's image.
-    HTMLImageElement* imageElement() const;
+    WEBCORE_EXPORT HTMLImageElement* imageElement() const;
     
 private:
     HTMLAreaElement(const QualifiedName&, Document&);

Modified: trunk/Source/WebKit2/ChangeLog (204719 => 204720)


--- trunk/Source/WebKit2/ChangeLog	2016-08-22 16:05:17 UTC (rev 204719)
+++ trunk/Source/WebKit2/ChangeLog	2016-08-22 16:13:28 UTC (rev 204720)
@@ -1,3 +1,21 @@
+2016-08-22  Daniel Bates  <daba...@apple.com>
+
+        [iOS] <a ping> and <area ping> tests time out
+        https://bugs.webkit.org/show_bug.cgi?id=156857
+
+        Reviewed by Simon Fraser.
+
+        Support single tapping on an HTML area element in WebKit2 just as we do in Legacy WebKit.
+
+        WebKit2 commits to clicking a "clickable" DOM node on a single tap only if it has a
+        renderer. An HTML area element represents a hyperlink in an image map and does not have
+        a renderer.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::sendTapHighlightForNodeIfNecessary): Compute the tap highlight with respect
+        to the renderer for the image map associated with the tapped HTML area element (if it has one).
+        (WebKit::WebPage::commitPotentialTap): Allow committing a potential tap on an HTML area element.
+
 2016-08-22  Darin Adler  <da...@apple.com>
 
         Move Objective-C DOM bindings from WebCore to legacy WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (204719 => 204720)


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2016-08-22 16:05:17 UTC (rev 204719)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2016-08-22 16:13:28 UTC (rev 204720)
@@ -64,6 +64,7 @@
 #import <WebCore/FrameLoaderClient.h>
 #import <WebCore/FrameView.h>
 #import <WebCore/GeometryUtilities.h>
+#import <WebCore/HTMLAreaElement.h>
 #import <WebCore/HTMLAttachmentElement.h>
 #import <WebCore/HTMLElementTypeHelpers.h>
 #import <WebCore/HTMLFormElement.h>
@@ -610,6 +611,12 @@
         m_page->mainFrame().loader().client().prefetchDNS(downcast<Element>(*node).absoluteLinkURL().host());
     }
 
+    if (is<HTMLAreaElement>(node)) {
+        node = downcast<HTMLAreaElement>(node)->imageElement();
+        if (!node)
+            return;
+    }
+
     Vector<FloatQuad> quads;
     if (RenderObject *renderer = node->renderer()) {
         renderer->absoluteQuads(quads);
@@ -665,7 +672,7 @@
 
 void WebPage::commitPotentialTap(uint64_t lastLayerTreeTransactionId)
 {
-    if (!m_potentialTapNode || !m_potentialTapNode->renderer()) {
+    if (!m_potentialTapNode || (!m_potentialTapNode->renderer() && !is<HTMLAreaElement>(m_potentialTapNode.get()))) {
         commitPotentialTapFailed();
         return;
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to