- Revision
- 264658
- Author
- za...@apple.com
- Date
- 2020-07-21 09:35:55 -0700 (Tue, 21 Jul 2020)
Log Message
[UI Events] Make mousemove cancelable
https://bugs.webkit.org/show_bug.cgi?id=214513
<rdar://problem/64267520>
Reviewed by Simon Fraser.
Source/WebCore:
This patch makes the mousemove event cancelable.
The event was initially specified to be non-cancelable in DOM Level 2 Events, but was changed to reflect existing interoperability between browsers.
The most user facing behavior change here is that when the mousemove event is prevent-defaulted (canceled) content selection is not possible.
Chrome is aligned with the latest version of the spec, the mousemove event is cancelable.
However they also have a TODO right at where the drag would happen:
// TODO(crbug.com/346473): Since there is no default action for the mousemove
// event we should consider doing drag&drop even when js cancels the
// mouse move event.
Firefox preforms the drag(select) operation but not sure if it’s because their mousemove event is still non-cancelable or whether they already went ahead with what the TODO says.
Test: fast/text/selection-is-prevent-defaulted.html
* dom/MouseEvent.cpp:
(WebCore::MouseEvent::create):
LayoutTests:
* fast/text/selection-is-prevent-defaulted-expected.txt: Added.
* fast/text/selection-is-prevent-defaulted.html: Added.
* platform/mac/fast/events/objc-event-api-expected.txt:
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (264657 => 264658)
--- trunk/LayoutTests/ChangeLog 2020-07-21 16:13:47 UTC (rev 264657)
+++ trunk/LayoutTests/ChangeLog 2020-07-21 16:35:55 UTC (rev 264658)
@@ -1,3 +1,15 @@
+2020-07-21 Zalan Bujtas <za...@apple.com>
+
+ [UI Events] Make mousemove cancelable
+ https://bugs.webkit.org/show_bug.cgi?id=214513
+ <rdar://problem/64267520>
+
+ Reviewed by Simon Fraser.
+
+ * fast/text/selection-is-prevent-defaulted-expected.txt: Added.
+ * fast/text/selection-is-prevent-defaulted.html: Added.
+ * platform/mac/fast/events/objc-event-api-expected.txt:
+
2020-07-21 Hector Lopez <hector_i_lo...@apple.com>
[ Release Mac wk2 ] svg/animations/smil-leak-element-instances.svg is flaky failing
Added: trunk/LayoutTests/fast/text/selection-is-prevent-defaulted-expected.txt (0 => 264658)
--- trunk/LayoutTests/fast/text/selection-is-prevent-defaulted-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/text/selection-is-prevent-defaulted-expected.txt 2020-07-21 16:35:55 UTC (rev 264658)
@@ -0,0 +1,4 @@
+Try to select this text.
+Pass if non-selection is visible.
+Try to select this text.
+Pass if non-selection is visible.
Added: trunk/LayoutTests/fast/text/selection-is-prevent-defaulted.html (0 => 264658)
--- trunk/LayoutTests/fast/text/selection-is-prevent-defaulted.html (rev 0)
+++ trunk/LayoutTests/fast/text/selection-is-prevent-defaulted.html 2020-07-21 16:35:55 UTC (rev 264658)
@@ -0,0 +1,36 @@
+<body _onload_="test()">
+Try to select this text.<br>Pass if non-selection is visible.
+<pre id=result_with_default_prevent></pre>
+<pre id=result_without_default_prevent></pre>
+</body>
+<script>
+
+function mousemoveFunction(event) {
+ event.preventDefault();
+}
+
+document.body._onmousemove_ = mousemoveFunction;
+
+function test() {
+ if (window.testRunner)
+ testRunner.dumpAsText();
+ if (!window.eventSender)
+ return;
+
+ eventSender.mouseMoveTo(0, 0);
+ eventSender.mouseDown();
+ eventSender.mouseMoveTo(400, 400);
+ eventSender.mouseUp();
+
+ result_with_default_prevent.innerHTML = window.getSelection();
+
+ document.body._onmousemove_ = "";
+
+ eventSender.mouseMoveTo(0, 0);
+ eventSender.mouseDown();
+ eventSender.mouseMoveTo(400, 400);
+ eventSender.mouseUp();
+
+ result_without_default_prevent.innerHTML = window.getSelection();
+}
+</script>
Modified: trunk/LayoutTests/platform/ios/TestExpectations (264657 => 264658)
--- trunk/LayoutTests/platform/ios/TestExpectations 2020-07-21 16:13:47 UTC (rev 264657)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2020-07-21 16:35:55 UTC (rev 264658)
@@ -3476,3 +3476,5 @@
webkit.org/b/214299 imported/w3c/web-platform-tests/css/css-ui/outline-with-padding-001.html [ ImageOnlyFailure ]
webkit.org/b/214498 imported/w3c/web-platform-tests/cors/remote-origin.htm [ Pass ]
+
+fast/text/selection-is-prevent-defaulted.html [ Failure ]
Modified: trunk/LayoutTests/platform/mac/fast/events/objc-event-api-expected.txt (264657 => 264658)
--- trunk/LayoutTests/platform/mac/fast/events/objc-event-api-expected.txt 2020-07-21 16:13:47 UTC (rev 264657)
+++ trunk/LayoutTests/platform/mac/fast/events/objc-event-api-expected.txt 2020-07-21 16:35:55 UTC (rev 264658)
@@ -59,7 +59,7 @@
target: <div>
eventPhase: 3
bubbles: 1
- cancelable: 0
+ cancelable: 1
detail: 0
view: OK (document: OK)
button: 0
@@ -216,7 +216,7 @@
target: <div>
eventPhase: 3
bubbles: 1
- cancelable: 0
+ cancelable: 1
detail: 0
view: OK (document: OK)
button: 0
@@ -273,7 +273,7 @@
target: <div>
eventPhase: 3
bubbles: 1
- cancelable: 0
+ cancelable: 1
detail: 0
view: OK (document: OK)
button: 0
@@ -332,7 +332,7 @@
target: <html>
eventPhase: 3
bubbles: 1
- cancelable: 0
+ cancelable: 1
detail: 0
view: OK (document: OK)
button: 0
@@ -358,7 +358,7 @@
target: <html>
eventPhase: 3
bubbles: 1
- cancelable: 0
+ cancelable: 1
detail: 0
view: OK (document: OK)
button: 0
Modified: trunk/Source/WebCore/ChangeLog (264657 => 264658)
--- trunk/Source/WebCore/ChangeLog 2020-07-21 16:13:47 UTC (rev 264657)
+++ trunk/Source/WebCore/ChangeLog 2020-07-21 16:35:55 UTC (rev 264658)
@@ -1,3 +1,28 @@
+2020-07-21 Zalan Bujtas <za...@apple.com>
+
+ [UI Events] Make mousemove cancelable
+ https://bugs.webkit.org/show_bug.cgi?id=214513
+ <rdar://problem/64267520>
+
+ Reviewed by Simon Fraser.
+
+ This patch makes the mousemove event cancelable.
+ The event was initially specified to be non-cancelable in DOM Level 2 Events, but was changed to reflect existing interoperability between browsers.
+ The most user facing behavior change here is that when the mousemove event is prevent-defaulted (canceled) content selection is not possible.
+
+ Chrome is aligned with the latest version of the spec, the mousemove event is cancelable.
+ However they also have a TODO right at where the drag would happen:
+ // TODO(crbug.com/346473): Since there is no default action for the mousemove
+ // event we should consider doing drag&drop even when js cancels the
+ // mouse move event.
+
+ Firefox preforms the drag(select) operation but not sure if it’s because their mousemove event is still non-cancelable or whether they already went ahead with what the TODO says.
+
+ Test: fast/text/selection-is-prevent-defaulted.html
+
+ * dom/MouseEvent.cpp:
+ (WebCore::MouseEvent::create):
+
2020-07-21 Clark Wang <clark_w...@apple.com>
Added OfflineAudioContext constructor
Modified: trunk/Source/WebCore/dom/MouseEvent.cpp (264657 => 264658)
--- trunk/Source/WebCore/dom/MouseEvent.cpp 2020-07-21 16:13:47 UTC (rev 264657)
+++ trunk/Source/WebCore/dom/MouseEvent.cpp 2020-07-21 16:35:55 UTC (rev 264658)
@@ -51,7 +51,7 @@
Ref<MouseEvent> MouseEvent::create(const AtomString& eventType, RefPtr<WindowProxy>&& view, const PlatformMouseEvent& event, int detail, Node* relatedTarget)
{
bool isMouseEnterOrLeave = eventType == eventNames().mouseenterEvent || eventType == eventNames().mouseleaveEvent;
- auto isCancelable = eventType != eventNames().mousemoveEvent && !isMouseEnterOrLeave ? IsCancelable::Yes : IsCancelable::No;
+ auto isCancelable = !isMouseEnterOrLeave ? IsCancelable::Yes : IsCancelable::No;
auto canBubble = !isMouseEnterOrLeave ? CanBubble::Yes : CanBubble::No;
auto isComposed = !isMouseEnterOrLeave ? IsComposed::Yes : IsComposed::No;