WebKit Bugzilla
Attachment 340433 Details for
Bug 184250
: Unable to call event.preventDefault in dynamically added event listener
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for landing
bug-184250-20180515225741.patch (text/plain), 7.02 KB, created by
Tadeu Zagallo
on 2018-05-15 13:57:42 PDT
(
hide
)
Description:
Patch for landing
Filename:
MIME Type:
Creator:
Tadeu Zagallo
Created:
2018-05-15 13:57:42 PDT
Size:
7.02 KB
patch
obsolete
>Subversion Revision: 231264 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index dafc310176b91388edd5045ac722b97b5656085c..17e3d5902ee613a5febd21d696dfab935562b877 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,19 @@ >+2018-05-15 Tadeu Zagallo <tzagallo@apple.com> >+ >+ 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-02 Alex Christensen <achristensen@webkit.org> > > Add WKWebsiteDataStorePrivate._proxyConfiguration SPI >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index c9b48cb8fa9294568aded7be72fc2a3b0d210551..50eadd51464a84610c0cec04216bedfa2a2e6c42 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -2275,8 +2275,7 @@ void WebPageProxy::handleTouchEventSynchronously(NativeWebTouchEvent& event) > > TraceScope scope(SyncTouchEventStart, SyncTouchEventEnd); > >- if (event.type() == WebEvent::TouchStart) >- updateTouchEventTracking(event); >+ updateTouchEventTracking(event); > > TrackingType touchEventsTrackingType = touchEventTrackingType(event); > if (touchEventsTrackingType == TrackingType::NotTracking) >@@ -2327,8 +2326,7 @@ void WebPageProxy::handleTouchEvent(const NativeWebTouchEvent& event) > if (!isValid()) > return; > >- if (event.type() == WebEvent::TouchStart) >- updateTouchEventTracking(event); >+ updateTouchEventTracking(event); > > if (touchEventTrackingType(event) == TrackingType::NotTracking) > return; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 4a2a9201b7171c82716647c7b84f94f88853a6ea..090a7eaeb919ac3eee5673d615071ddafe9bcb75 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,18 @@ >+2018-05-15 Tadeu Zagallo <tzagallo@apple.com> >+ >+ 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-02 Youenn Fablet <youenn@apple.com> > > Use NetworkLoadChecker for navigation loads >diff --git a/LayoutTests/fast/events/touch/ios/touchmove-cancelable-after-touchstart-expected.txt b/LayoutTests/fast/events/touch/ios/touchmove-cancelable-after-touchstart-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..bdc35c1a85bc1d32ae0ad9dbf35ca67879723a98 >--- /dev/null >+++ b/LayoutTests/fast/events/touch/ios/touchmove-cancelable-after-touchstart-expected.txt >@@ -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 >+ >diff --git a/LayoutTests/fast/events/touch/ios/touchmove-cancelable-after-touchstart.html b/LayoutTests/fast/events/touch/ios/touchmove-cancelable-after-touchstart.html >new file mode 100644 >index 0000000000000000000000000000000000000000..c84a16d8da4d4ba47fe7eaf40d54bb5146afe5e6 >--- /dev/null >+++ b/LayoutTests/fast/events/touch/ios/touchmove-cancelable-after-touchstart.html >@@ -0,0 +1,96 @@ >+<!DOCTYPE html> >+<html> >+<head> >+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> >+ <script src="../../../../resources/js-test-pre.js"></script> >+ <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="../../../../resources/js-test-post.js"></script> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 184250
:
340412
| 340433 |
340528