Modified: trunk/LayoutTests/ChangeLog (231820 => 231821)
--- trunk/LayoutTests/ChangeLog 2018-05-15 23:45:53 UTC (rev 231820)
+++ trunk/LayoutTests/ChangeLog 2018-05-15 23:50:19 UTC (rev 231821)
@@ -1,3 +1,18 @@
+2018-05-15 Tadeu Zagallo <[email protected]>
+
+ Update touch event tracking type on every touch
+ https://bugs.webkit.org/show_bug.cgi?id=184250
+ <rdar://problem/39145092>
+
+ Reviewed by Geoffrey Garen.
+
+ The tracking type for touch events were only update on touchstart, which meant that event
+ listeners added after the touchstart would always be treated as passive, even if explicitly
+ setting passive to false.
+
+ * fast/events/touch/ios/touchmove-cancelable-after-touchstart-expected.txt: Added.
+ * fast/events/touch/ios/touchmove-cancelable-after-touchstart.html: Added.
+
2018-05-15 Jer Noble <[email protected]>
Media continues loading after rendered invisible (removed from DOM; scrolled off screen)
Added: trunk/LayoutTests/fast/events/touch/ios/touchmove-cancelable-after-touchstart-expected.txt (0 => 231821)
--- trunk/LayoutTests/fast/events/touch/ios/touchmove-cancelable-after-touchstart-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/touchmove-cancelable-after-touchstart-expected.txt 2018-05-15 23:50:19 UTC (rev 231821)
@@ -0,0 +1,12 @@
+Test that touchmove can be cancelled from event listeners dynamically added after touchstart
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS event.cancelable is true
+PASS event.defaultPrevented is true
+PASS document.body.scrollTop is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/events/touch/ios/touchmove-cancelable-after-touchstart.html (0 => 231821)
--- trunk/LayoutTests/fast/events/touch/ios/touchmove-cancelable-after-touchstart.html (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/touchmove-cancelable-after-touchstart.html 2018-05-15 23:50:19 UTC (rev 231821)
@@ -0,0 +1,96 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+ <script src=""
+ <style>
+ #square {
+ position: absolute;
+ left: 100px;
+ top: 100px;
+ width: 150px;
+ height: 2000px;
+ background: red;
+ opacity: 0.5;
+ }
+ </style>
+</head>
+
+<body>
+<div id="square" style=""></div>
+
+<script>
+description("Test that touchmove can be cancelled from event listeners dynamically added after touchstart");
+window.jsTestIsAsync = true;
+
+const getUIScript = (startX, startY, endX, endY) => `
+(function() {
+ var eventStream = {
+ events : [{
+ interpolate: "linear",
+ timestep: 0.025,
+ startEvent: {
+ inputType: "hand",
+ timeOffset: 0,
+ touches: [{
+ inputType: "finger",
+ phase: "began",
+ id: 1,
+ x: ${startX},
+ y: ${startY},
+ pressure: 0
+ }]
+ },
+ endEvent: {
+ inputType: "hand",
+ timeOffset: 3.0,
+ touches: [{
+ inputType: "finger",
+ phase: "stationary",
+ id: 1,
+ x: ${endX},
+ y: ${endY},
+ pressure : 500
+ }]
+ }
+ }]
+ };
+
+ uiController.sendEventStream(JSON.stringify(eventStream), function() {
+ uiController.uiScriptComplete();
+ });
+})();
+`;
+
+function runTest()
+{
+ function touchmoveEventHandler(event)
+ {
+ shouldBe("event.cancelable", "true");
+ event.preventDefault();
+ shouldBe("event.defaultPrevented", "true");
+ }
+
+ const square = document.querySelector('#square');
+ document.addEventListener("touchstart", event => {
+ // NOTE: For some reason, if we don't interact with the DOM here, the first few touchmove events we see will be passive (not cancelable)
+ // See https://bugs.webkit.org/show_bug.cgi?id=185656
+ document.body.appendChild(document.createElement('p'));
+ if (event.target === square)
+ window.addEventListener("touchmove", touchmoveEventHandler, { passive: false, once: true });
+ }, { passive: false, once: true });
+
+ if (window.testRunner) {
+ let clientRect = square.getBoundingClientRect();
+ testRunner.runUIScript(getUIScript(clientRect.left + 50, clientRect.top + 200, clientRect.left + 50, clientRect.top + 10), () => {
+ shouldBe("document.body.scrollTop", "0");
+ finishJSTest();
+ });
+ }
+}
+
+window.addEventListener('load', runTest, false);
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebKit/ChangeLog (231820 => 231821)
--- trunk/Source/WebKit/ChangeLog 2018-05-15 23:45:53 UTC (rev 231820)
+++ trunk/Source/WebKit/ChangeLog 2018-05-15 23:50:19 UTC (rev 231821)
@@ -1,3 +1,19 @@
+2018-05-15 Tadeu Zagallo <[email protected]>
+
+ Update touch event tracking type on every touch
+ https://bugs.webkit.org/show_bug.cgi?id=184250
+ <rdar://problem/39145092>
+
+ Reviewed by Geoffrey Garen.
+
+ The tracking type for touch events were only update on touchstart, which meant that event
+ listeners added after the touchstart would always be treated as passive, even if explicitly
+ setting passive to false.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::handleTouchEventSynchronously):
+ (WebKit::WebPageProxy::handleTouchEvent):
+
2018-05-15 Per Arne Vollan <[email protected]>
Pause display links when window is not visible.
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (231820 => 231821)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-05-15 23:45:53 UTC (rev 231820)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-05-15 23:50:19 UTC (rev 231821)
@@ -2300,8 +2300,7 @@
TraceScope scope(SyncTouchEventStart, SyncTouchEventEnd);
- if (event.type() == WebEvent::TouchStart)
- updateTouchEventTracking(event);
+ updateTouchEventTracking(event);
TrackingType touchEventsTrackingType = touchEventTrackingType(event);
if (touchEventsTrackingType == TrackingType::NotTracking)
@@ -2355,8 +2354,7 @@
if (!isValid())
return;
- if (event.type() == WebEvent::TouchStart)
- updateTouchEventTracking(event);
+ updateTouchEventTracking(event);
if (touchEventTrackingType(event) == TrackingType::NotTracking)
return;