Title: [209215] trunk
Revision
209215
Author
cdu...@apple.com
Date
2016-12-01 14:48:55 -0800 (Thu, 01 Dec 2016)

Log Message

Source/WebKit2:
[iOS][WK2] Tapping an element generates a 'click' event that has 0 as timeStamp
https://bugs.webkit.org/show_bug.cgi?id=165270
<rdar://problem/29224355>

Reviewed by Simon Fraser.

Tapping an element generates a 'click' event that has 0 as timeStamp
instead of having a proper timeStamp value. This is breaking some
sites.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleSyntheticClick):
(WebKit::WebPage::completeSyntheticClick):

LayoutTests:
[iOS] Tapping an element generates a 'click' event that has 0 as timeStamp
https://bugs.webkit.org/show_bug.cgi?id=165270
<rdar://problem/29224355>

Reviewed by Simon Fraser.

Add layout test coverage.

* fast/events/ios/click-event-timestamp-expected.txt: Added.
* fast/events/ios/click-event-timestamp.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (209214 => 209215)


--- trunk/LayoutTests/ChangeLog	2016-12-01 22:36:22 UTC (rev 209214)
+++ trunk/LayoutTests/ChangeLog	2016-12-01 22:48:55 UTC (rev 209215)
@@ -1,3 +1,16 @@
+2016-12-01  Chris Dumez  <cdu...@apple.com>
+
+        [iOS] Tapping an element generates a 'click' event that has 0 as timeStamp
+        https://bugs.webkit.org/show_bug.cgi?id=165270
+        <rdar://problem/29224355>
+
+        Reviewed by Simon Fraser.
+
+        Add layout test coverage.
+
+        * fast/events/ios/click-event-timestamp-expected.txt: Added.
+        * fast/events/ios/click-event-timestamp.html: Added.
+
 2016-12-01  Dave Hyatt  <hy...@apple.com>
 
         [CSS Parser] Fix an invalid shadow DOM test

Added: trunk/LayoutTests/fast/events/ios/click-event-timestamp-expected.txt (0 => 209215)


--- trunk/LayoutTests/fast/events/ios/click-event-timestamp-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/ios/click-event-timestamp-expected.txt	2016-12-01 22:48:55 UTC (rev 209215)
@@ -0,0 +1 @@
+PASS: click events had increasing timeStamps

Added: trunk/LayoutTests/fast/events/ios/click-event-timestamp.html (0 => 209215)


--- trunk/LayoutTests/fast/events/ios/click-event-timestamp.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/ios/click-event-timestamp.html	2016-12-01 22:48:55 UTC (rev 209215)
@@ -0,0 +1,75 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<head>
+    <meta name="viewport" content="width=device-width">
+    <script id="ui-script" type="text/plain">
+        (function() {
+            uiController.singleTapAtPoint(50, 50, function() {
+                uiController.uiScriptComplete();
+            });
+        })();
+    </script>
+    <script>
+        var uiScriptHasCompleted = false;
+        var boxClickCount = 0;
+        var firstClickEventTimeStamp = 0;
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+        
+        function getUIScript()
+        {
+            return document.getElementById('ui-script').text;
+        }
+
+        function runTest()
+        {
+            if (testRunner.runUIScript) {
+                testRunner.runUIScript(getUIScript(), function() {
+                    setTimeout(function() {
+                        testRunner.runUIScript(getUIScript(), function() {
+                            uiScriptHasCompleted = true;
+                            if (boxClickCount == 2)
+                                testRunner.notifyDone();
+                        });
+                    }, 100);
+                });
+            }
+        }
+        
+        function boxClicked(event)
+        {
+            boxClickCount++;
+            if (boxClickCount == 1) {
+                document.getElementById('target').textContent = 'FAIL: only received one click event';
+                firstClickEventTimeStamp = event.timeStamp;
+                return;
+            }
+            if (boxClickCount == 2) {
+                if (event.timeStamp > firstClickEventTimeStamp)
+                    document.getElementById('target').textContent = 'PASS: click events had increasing timeStamps';
+                else
+                    document.getElementById('target').textContent = 'FAIL: click events did not have increasing timeStamps';
+                if (uiScriptHasCompleted && window.testRunner)
+                    testRunner.notifyDone();
+            }
+        }
+    </script>
+    <style>
+        #target {
+            height: 100px;
+            width: 100px;
+            background-color: silver;
+        }
+    </style>
+</head>
+<body _onload_="runTest()">
+
+<div id="target" _onclick_="boxClicked(event)">
+    FAIL: did not receive click event.
+</div>
+
+</body>
+</html>

Modified: trunk/Source/WebKit2/ChangeLog (209214 => 209215)


--- trunk/Source/WebKit2/ChangeLog	2016-12-01 22:36:22 UTC (rev 209214)
+++ trunk/Source/WebKit2/ChangeLog	2016-12-01 22:48:55 UTC (rev 209215)
@@ -1,3 +1,19 @@
+2016-12-01  Chris Dumez  <cdu...@apple.com>
+
+        [iOS][WK2] Tapping an element generates a 'click' event that has 0 as timeStamp
+        https://bugs.webkit.org/show_bug.cgi?id=165270
+        <rdar://problem/29224355>
+
+        Reviewed by Simon Fraser.
+
+        Tapping an element generates a 'click' event that has 0 as timeStamp
+        instead of having a proper timeStamp value. This is breaking some
+        sites.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::handleSyntheticClick):
+        (WebKit::WebPage::completeSyntheticClick):
+
 2016-12-01  Tim Horton  <timothy_hor...@apple.com>
 
         Try to fix the EFL/Gtk build

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


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2016-12-01 22:36:22 UTC (rev 209214)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2016-12-01 22:48:55 UTC (rev 209215)
@@ -522,7 +522,7 @@
 
     WKBeginObservingContentChanges(true);
 
-    mainframe.eventHandler().mouseMoved(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, NoButton, PlatformEvent::MouseMoved, 0, false, false, false, false, 0, WebCore::ForceAtClick, WebCore::NoTap));
+    mainframe.eventHandler().mouseMoved(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, NoButton, PlatformEvent::MouseMoved, 0, false, false, false, false, currentTime(), WebCore::ForceAtClick, WebCore::NoTap));
     mainframe.document()->updateStyleIfNeeded();
 
     WKStopObservingContentChanges();
@@ -569,8 +569,8 @@
 
     bool tapWasHandled = false;
     m_lastInteractionLocation = roundedAdjustedPoint;
-    tapWasHandled |= mainframe.eventHandler().handleMousePressEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MousePressed, 1, false, false, false, false, 0, WebCore::ForceAtClick, syntheticClickType));
-    tapWasHandled |= mainframe.eventHandler().handleMouseReleaseEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MouseReleased, 1, false, false, false, false, 0, WebCore::ForceAtClick, syntheticClickType));
+    tapWasHandled |= mainframe.eventHandler().handleMousePressEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime(), WebCore::ForceAtClick, syntheticClickType));
+    tapWasHandled |= mainframe.eventHandler().handleMouseReleaseEvent(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::MouseReleased, 1, false, false, false, false, currentTime(), WebCore::ForceAtClick, syntheticClickType));
 
     RefPtr<Frame> newFocusedFrame = m_page->focusController().focusedFrame();
     RefPtr<Element> newFocusedElement = newFocusedFrame ? newFocusedFrame->document()->focusedElement() : nullptr;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to