WebKit Bugzilla
Attachment 370500 Details for
Bug 198177
: [Pointer Events] The mouseover, mouseout, mouseenter, and mouseleave events should not be prevented while the pointer is down
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198177-20190523140907.patch (text/plain), 6.90 KB, created by
Antoine Quint
on 2019-05-23 05:09:08 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Antoine Quint
Created:
2019-05-23 05:09:08 PDT
Size:
6.90 KB
patch
obsolete
>Subversion Revision: 245679 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index a17fe395da205d1decb0f28a541aaf411e8cf03d..2fcf16d63f0654b1b9377bb559647ee177ff408d 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,20 @@ >+2019-05-23 Antoine Quint <graouts@apple.com> >+ >+ [Pointer Events] The mouseover, mouseout, mouseenter, and mouseleave events should not be prevented while the pointer is down >+ https://bugs.webkit.org/show_bug.cgi?id=198177 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Test: pointerevents/mouse/compatibility-mouse-events-prevention-mouse-pressed.html >+ >+ The Pointer Event spec, in https://www.w3.org/TR/pointerevents/#compatibility-mapping-with-mouse-events, says that "the mouseover, >+ mouseout, mouseenter, and mouseleave events are never prevented (even if the pointer is down)." We add a new static function which >+ indicates what is "compatibility" mouse event since those should be excluded, along with "click", which we already excluded. >+ >+ * dom/Element.cpp: >+ (WebCore::isCompatibilityMouseEvent): >+ (WebCore::Element::dispatchMouseEvent): >+ > 2019-05-22 Myles C. Maxfield <mmaxfield@apple.com> > > font-optical-sizing applies the wrong variation value >diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp >index 77ba33ba9777adefd2b4fd8734b82f2e8f23139b..d0b45009ef1b0709561af935b7c0c25fe8967180 100644 >--- a/Source/WebCore/dom/Element.cpp >+++ b/Source/WebCore/dom/Element.cpp >@@ -288,6 +288,13 @@ static bool isForceEvent(const PlatformMouseEvent& platformEvent) > return platformEvent.type() == PlatformEvent::MouseForceChanged || platformEvent.type() == PlatformEvent::MouseForceDown || platformEvent.type() == PlatformEvent::MouseForceUp; > } > >+static bool isCompatibilityMouseEvent(const MouseEvent& mouseEvent) >+{ >+ // https://www.w3.org/TR/pointerevents/#compatibility-mapping-with-mouse-events >+ const auto& type = mouseEvent.type(); >+ return type != eventNames().clickEvent && type != eventNames().mouseoverEvent && type != eventNames().mouseoutEvent && type != eventNames().mouseenterEvent && type != eventNames().mouseleaveEvent; >+} >+ > bool Element::dispatchMouseEvent(const PlatformMouseEvent& platformEvent, const AtomicString& eventType, int detail, Element* relatedTarget) > { > if (isDisabledFormControl()) >@@ -314,7 +321,7 @@ bool Element::dispatchMouseEvent(const PlatformMouseEvent& platformEvent, const > if (auto pointerEvent = PointerEvent::create(mouseEvent)) { > if (auto* page = document().page()) { > page->pointerCaptureController().dispatchEvent(*pointerEvent, this); >- if (mouseEvent->type() != eventNames().clickEvent && page->pointerCaptureController().preventsCompatibilityMouseEventsForIdentifier(pointerEvent->pointerId())) >+ if (isCompatibilityMouseEvent(mouseEvent) && page->pointerCaptureController().preventsCompatibilityMouseEventsForIdentifier(pointerEvent->pointerId())) > return false; > } > if (pointerEvent->defaultPrevented() || pointerEvent->defaultHandled()) { >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 47453ae318256f230dadef3e0ecfe9e78400d930..cb2a3357798afa681b2cbc6a5a54400ebfd9e5d3 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,16 @@ >+2019-05-23 Antoine Quint <graouts@apple.com> >+ >+ [Pointer Events] The mouseover, mouseout, mouseenter, and mouseleave events should not be prevented while the pointer is down >+ https://bugs.webkit.org/show_bug.cgi?id=198177 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a test that listens to all mouse events and checks which are dispatched in the case preventDefault() is called when handling >+ "pointerdown" and when it isn't. >+ >+ * pointerevents/mouse/compatibility-mouse-events-prevention-mouse-pressed-expected.txt: Added. >+ * pointerevents/mouse/compatibility-mouse-events-prevention-mouse-pressed.html: Added. >+ > 2019-05-22 Myles C. Maxfield <mmaxfield@apple.com> > > font-optical-sizing applies the wrong variation value >diff --git a/LayoutTests/pointerevents/mouse/compatibility-mouse-events-prevention-mouse-pressed-expected.txt b/LayoutTests/pointerevents/mouse/compatibility-mouse-events-prevention-mouse-pressed-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..f2587a7f11a695b03565a87216bd20af233a027e >--- /dev/null >+++ b/LayoutTests/pointerevents/mouse/compatibility-mouse-events-prevention-mouse-pressed-expected.txt >@@ -0,0 +1,3 @@ >+ >+PASS Testing that calling preventDefault() when handling a "pointerdown" event only blocks expected events. >+ >diff --git a/LayoutTests/pointerevents/mouse/compatibility-mouse-events-prevention-mouse-pressed.html b/LayoutTests/pointerevents/mouse/compatibility-mouse-events-prevention-mouse-pressed.html >new file mode 100644 >index 0000000000000000000000000000000000000000..9e4a992afb023d209a2e5eef9e59fb491bd103c0 >--- /dev/null >+++ b/LayoutTests/pointerevents/mouse/compatibility-mouse-events-prevention-mouse-pressed.html >@@ -0,0 +1,59 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<meta charset=utf-8> >+</head> >+<body> >+<script src="../../resources/testharness.js"></script> >+<script src="../../resources/testharnessreport.js"></script> >+<script src="../utils.js"></script> >+<script> >+ >+'use strict'; >+ >+function runMouseSequence() >+{ >+ eventSender.mouseDown(); >+ eventSender.mouseMoveTo(25, 25); >+ eventSender.mouseMoveTo(75, 75); >+ eventSender.mouseUp(); >+} >+ >+target_test({ x: "50px", y: "50px", width: "100px", height: "100px" }, (target, test) => { >+ const eventTracker = new EventTracker(target, ["mousedown", "mouseover", "mouseenter", "mousemove", "mouseout", "mouseleave", "mouseup"]); >+ >+ // First, move the mouse over the element to start in that state. >+ eventSender.mouseMoveTo(75, 75); >+ eventTracker.clear(); >+ >+ // Then, press the mouse, don't call preventDefault() while handling "pointerdown", move the mouse out, then back over and finally release. >+ runMouseSequence(); >+ >+ eventTracker.assertMatchesEvents([ >+ {"type": "mousedown" }, >+ {"type": "mouseout" }, >+ {"type": "mouseleave" }, >+ {"type": "mouseover" }, >+ {"type": "mouseenter" }, >+ {"type": "mousemove" }, >+ {"type": "mouseup" } >+ ]); >+ >+ eventTracker.clear(); >+ >+ // Then do the same thing but calling preventDefault() while handling "pointerdown". >+ target.addEventListener("pointerdown", event => event.preventDefault()); >+ runMouseSequence(); >+ >+ eventTracker.assertMatchesEvents([ >+ {"type": "mouseout" }, >+ {"type": "mouseleave" }, >+ {"type": "mouseover" }, >+ {"type": "mouseenter" }, >+ ]); >+ test.done(); >+}, `Testing that calling preventDefault() when handling a "pointerdown" event only blocks expected events.`); >+ >+</script> >+</body> >+</html> >\ No newline at end of file
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 198177
:
370500
|
370503
|
370504