Title: [242137] trunk
Revision
242137
Author
[email protected]
Date
2019-02-27 11:02:03 -0800 (Wed, 27 Feb 2019)

Log Message

Support Pointer Events on macOS
https://bugs.webkit.org/show_bug.cgi?id=195008
<rdar://problem/47454419>

Patch by Antoine Quint <[email protected]> on 2019-02-27
Reviewed by Dean Jackson.

Source/_javascript_Core:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

We now dispatch relevant pointer events as we prepare to dispatch mouse events. In most cases, this means we dispatch
a pointer event of the same type, with "mouse" being substituted by "pointer", and with the same properties with the
exception that if preventDefault() is called for a "pointerdown" event, the matching "mousedown" will not be dispatched,
and the same behavior also extends to "pointerup".

Tests: pointerevents/mouse/over-enter-out-leave.html
       pointerevents/mouse/pointer-capture.html
       pointerevents/mouse/pointer-event-basic-properties.html
       pointerevents/mouse/pointer-events-before-mouse-events.html
       pointerevents/mouse/pointerdown-prevent-default.html

* Configurations/FeatureDefines.xcconfig:
* dom/Document.cpp: All of the touch-action related members and functions should be iOS-specific since the touch-action
property does not have any effect on macOS.
(WebCore::Document::invalidateRenderingDependentRegions):
(WebCore::Document::nodeWillBeRemoved):
(WebCore::Document::updateTouchActionElements):
* dom/Document.h:
* dom/Element.cpp:
(WebCore::Element::dispatchMouseEvent): Dispatch a pointer event matching the mouse event that is about to be dispatched.
If preventDefault() is called in the event handler for either "pointerdown" or "pointerup", do not proceed with dispatching
the mouse event.
* dom/PointerEvent.cpp:
(WebCore::pointerEventType):
(WebCore::PointerEvent::create):
* dom/PointerEvent.h:
* page/EventHandler.cpp: Check both the pointer and mouse events to see if we need to dispatch "enter" and "leave" events.
(WebCore::hierarchyHasCapturingEventListeners):
(WebCore::EventHandler::updateMouseEventTargetNode):
* page/PointerCaptureController.cpp: Fix a build error which only happened on macOS.
(WebCore::PointerCaptureController::PointerCaptureController): Create the CapturingData for the unique mouse pointer.
(WebCore::PointerCaptureController::hasPointerCapture): The code did not match the spec cited in the comment, only the
pending target override needs to be considered to determine whether a given element has pointer capture enabled.
(WebCore::PointerCaptureController::dispatchEvent): Dispatch the provided pointer event, accounting for pointer capture if
it is set.
* page/PointerLockController.cpp: Fix a build error which only happened on macOS.
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolveElement): Code related to touch-action is only relevant to iOS.

Source/WebCore/PAL:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit:

* Configurations/FeatureDefines.xcconfig:

Source/WebKitLegacy/mac:

Add a WebKitLegacy API to enable and disable the Pointer Events runtime feature.

* Configurations/FeatureDefines.xcconfig:
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences pointerEventsEnabled]):
(-[WebPreferences setPointerEventsEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Tools:

* DumpRenderTree/mac/DumpRenderTree.mm:
(enableExperimentalFeatures): Enable the PointerEvents runtime feature in DumpRenderTree such that tests targeting WK1 may test the Pointer Events feature.
* TestWebKitAPI/Configurations/FeatureDefines.xcconfig:

LayoutTests:

* platform/mac-wk1/TestExpectations: Mark select tests as failures due to webkit.org/b/195008.
* platform/mac/TestExpectations: Enable the new mouse-based tests.
* pointerevents/mouse/over-enter-out-leave-expected.txt: Added.
* pointerevents/mouse/over-enter-out-leave.html: Added.
* pointerevents/mouse/pointer-capture-expected.txt: Added.
* pointerevents/mouse/pointer-capture.html: Added.
* pointerevents/mouse/pointer-event-basic-properties-expected.txt: Added.
* pointerevents/mouse/pointer-event-basic-properties.html: Added.
* pointerevents/mouse/pointer-events-before-mouse-events-expected.txt: Added.
* pointerevents/mouse/pointer-events-before-mouse-events.html: Added.
* pointerevents/mouse/pointerdown-prevent-default-expected.txt: Added.
* pointerevents/mouse/pointerdown-prevent-default.html: Added.
* pointerevents/utils.js:
(prototype.clear):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (242136 => 242137)


--- trunk/LayoutTests/ChangeLog	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/LayoutTests/ChangeLog	2019-02-27 19:02:03 UTC (rev 242137)
@@ -1,3 +1,26 @@
+2019-02-27  Antoine Quint  <[email protected]>
+
+        Support Pointer Events on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=195008
+        <rdar://problem/47454419>
+
+        Reviewed by Dean Jackson.
+
+        * platform/mac-wk1/TestExpectations: Mark select tests as failures due to webkit.org/b/195008.
+        * platform/mac/TestExpectations: Enable the new mouse-based tests.
+        * pointerevents/mouse/over-enter-out-leave-expected.txt: Added.
+        * pointerevents/mouse/over-enter-out-leave.html: Added.
+        * pointerevents/mouse/pointer-capture-expected.txt: Added.
+        * pointerevents/mouse/pointer-capture.html: Added.
+        * pointerevents/mouse/pointer-event-basic-properties-expected.txt: Added.
+        * pointerevents/mouse/pointer-event-basic-properties.html: Added.
+        * pointerevents/mouse/pointer-events-before-mouse-events-expected.txt: Added.
+        * pointerevents/mouse/pointer-events-before-mouse-events.html: Added.
+        * pointerevents/mouse/pointerdown-prevent-default-expected.txt: Added.
+        * pointerevents/mouse/pointerdown-prevent-default.html: Added.
+        * pointerevents/utils.js:
+        (prototype.clear):
+
 2019-02-27  Simon Fraser  <[email protected]>
 
         scrolling/ios/hit-testing-iframe* tests need to hide the tap highlight

Modified: trunk/LayoutTests/platform/mac/TestExpectations (242136 => 242137)


--- trunk/LayoutTests/platform/mac/TestExpectations	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2019-02-27 19:02:03 UTC (rev 242137)
@@ -39,6 +39,8 @@
 fast/text/mac [ Pass ]
 webkit.org/b/181964 fast/text/mac/select-character-before-zero-width-joiner.html [ ImageOnlyFailure ]
 
+pointerevents/mouse [ Pass ]
+
 #//////////////////////////////////////////////////////////////////////////////////////////
 # End platform-specific directories.
 #//////////////////////////////////////////////////////////////////////////////////////////

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (242136 => 242137)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2019-02-27 19:02:03 UTC (rev 242137)
@@ -672,4 +672,8 @@
 
 webkit.org/b/172384 fast/hidpi/hidpi-long-page-with-inset-element.html [ Skip ]
 
-webkit.org/b/194309 media/modern-media-controls/compact-media-controls/compact-media-controls-layout.html [ Pass Failure ]
\ No newline at end of file
+webkit.org/b/194309 media/modern-media-controls/compact-media-controls/compact-media-controls-layout.html [ Pass Failure ]
+
+webkit.org/b/195098 pointerevents/mouse/over-enter-out-leave.html [ Failure ]
+webkit.org/b/195098 pointerevents/mouse/pointer-capture.html [ Failure ]
+webkit.org/b/195098 pointerevents/mouse/pointer-events-before-mouse-events.html [ Failure ]

Added: trunk/LayoutTests/pointerevents/mouse/over-enter-out-leave-expected.txt (0 => 242137)


--- trunk/LayoutTests/pointerevents/mouse/over-enter-out-leave-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/pointerevents/mouse/over-enter-out-leave-expected.txt	2019-02-27 19:02:03 UTC (rev 242137)
@@ -0,0 +1,3 @@
+
+PASS Testing that "pointerover" and "pointerenter" are dispatched when entering an element's bounds and that "pointerout" and "pointerleave" are dispatched when leaving an element's bounds. 
+

Added: trunk/LayoutTests/pointerevents/mouse/over-enter-out-leave.html (0 => 242137)


--- trunk/LayoutTests/pointerevents/mouse/over-enter-out-leave.html	                        (rev 0)
+++ trunk/LayoutTests/pointerevents/mouse/over-enter-out-leave.html	2019-02-27 19:02:03 UTC (rev 242137)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+</head>
+<body>
+<script src=""
+<script src=""
+<script src=""
+<script>
+
+'use strict';
+
+target_test({ x: "100px", y: "100px", width: "100px", height: "100px" }, (target, test) => {
+    const eventTracker = new EventTracker(target, ["pointerover", "pointerenter", "pointerout", "pointerleave"]);
+
+    eventSender.mouseMoveTo(50, 50);
+    eventSender.mouseMoveTo(150, 150);
+    eventSender.mouseMoveTo(250, 250);
+
+    eventTracker.assertMatchesEvents([
+        { type: "pointerover", x: 150, y: 150, isPrimary: true },
+        { type: "pointerenter", x: 150, y: 150, isPrimary: true },
+        { type: "pointerout", x: 250, y: 250, isPrimary: true },
+        { type: "pointerleave", x: 250, y: 250, isPrimary: true },
+    ]);
+    test.done();
+}, `Testing that "pointerover" and "pointerenter" are dispatched when entering an element's bounds and that "pointerout" and "pointerleave" are dispatched when leaving an element's bounds.`);
+
+</script>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/pointerevents/mouse/pointer-capture-expected.txt (0 => 242137)


--- trunk/LayoutTests/pointerevents/mouse/pointer-capture-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/pointerevents/mouse/pointer-capture-expected.txt	2019-02-27 19:02:03 UTC (rev 242137)
@@ -0,0 +1,3 @@
+
+PASS Testing that setting pointer capture on an element dispatches pointermove events to that element even when the pointer is outside of its bounds. 
+

Added: trunk/LayoutTests/pointerevents/mouse/pointer-capture.html (0 => 242137)


--- trunk/LayoutTests/pointerevents/mouse/pointer-capture.html	                        (rev 0)
+++ trunk/LayoutTests/pointerevents/mouse/pointer-capture.html	2019-02-27 19:02:03 UTC (rev 242137)
@@ -0,0 +1,73 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+</head>
+<body>
+<script src=""
+<script src=""
+<script src=""
+<script>
+
+'use strict';
+
+target_test({ x: "100px", y: "100px", width: "100px", height: "100px" }, (target, test) => {
+    const eventTracker = new EventTracker(target, ["pointermove", "gotpointercapture", "lostpointercapture"]);
+
+    // Start with the mouse outside of the target.
+    eventSender.mouseMoveTo(50, 50);
+
+    // Move it over the target, this yields a "pointermove" event.
+    eventSender.mouseMoveTo(150, 150);
+    eventTracker.assertMatchesEvents([
+        { type: "pointermove", x: 150, y: 150 }
+    ]);
+    eventTracker.clear();
+
+    // Press the mouse and move it outside the target and release it, this does not yield a "pointermove" event since there is no capture.
+    eventSender.mouseDown();
+    eventSender.mouseMoveTo(250, 250);
+    eventSender.mouseUp();
+
+    // Now, move the mouse over the target again.
+    eventSender.mouseMoveTo(150, 150);
+    eventTracker.assertMatchesEvents([
+        { type: "pointermove", x: 150, y: 150 }
+    ]);
+    eventTracker.clear();
+
+    // And press the mouse button again, but set the capture while handling the "pointerdown" event.
+    let pointerId;
+    target.addEventListener("pointerdown", event => {
+        pointerId = event.pointerId;
+        assert_false(target.hasPointerCapture(pointerId), "The target does not have pointer capture by default.");
+        target.setPointerCapture(pointerId);
+        assert_true(target.hasPointerCapture(pointerId), "The target has pointer capture after calling setPointerCapture().");
+    });
+    eventSender.mouseDown();
+    eventTracker.assertMatchesEvents([
+        { type: "gotpointercapture" }
+    ]);
+    eventTracker.clear();
+
+    // Move the mouse oustide the target again, this time this yields a "pointermove" event since the target has pointer capture.
+    eventSender.mouseMoveTo(250, 250);
+    eventTracker.assertMatchesEvents([
+        { type: "pointermove", x: 250, y: 250 }
+    ]);
+    eventTracker.clear();
+
+    // Finally, release capture and mouse the mouse again, this should not yield a "pointermove" event.
+    target.releasePointerCapture(pointerId);
+    assert_false(target.hasPointerCapture(pointerId), "The target no longer has pointer capture after calling releasePointerCapture().");
+    eventSender.mouseMoveTo(240, 240);
+    eventTracker.assertMatchesEvents([
+        { type: "lostpointercapture" }
+    ]);
+
+    test.done();
+}, `Testing that setting pointer capture on an element dispatches pointermove events to that element even when the pointer is outside of its bounds.`);
+
+</script>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/pointerevents/mouse/pointer-event-basic-properties-expected.txt (0 => 242137)


--- trunk/LayoutTests/pointerevents/mouse/pointer-event-basic-properties-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/pointerevents/mouse/pointer-event-basic-properties-expected.txt	2019-02-27 19:02:03 UTC (rev 242137)
@@ -0,0 +1,3 @@
+
+PASS Testing the basic properties of a pointer event triggered by a mouse. 
+

Added: trunk/LayoutTests/pointerevents/mouse/pointer-event-basic-properties.html (0 => 242137)


--- trunk/LayoutTests/pointerevents/mouse/pointer-event-basic-properties.html	                        (rev 0)
+++ trunk/LayoutTests/pointerevents/mouse/pointer-event-basic-properties.html	2019-02-27 19:02:03 UTC (rev 242137)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+</head>
+<body>
+<script src=""
+<script src=""
+<script src=""
+<script>
+
+'use strict';
+
+target_test((target, test) => {
+    eventSender.mouseMoveTo(50, 50);
+    eventSender.mouseDown();
+
+    target.addEventListener("pointerdown", event => {
+        assert_equals(event.pointerId, 1, "The pointer's identifier is 1.");
+        assert_equals(event.pointerType, "mouse", "The pointer type is 'mouse'.");
+        assert_true(event.isPrimary, "The pointer is the primary pointer.");
+    });
+
+    test.done();
+}, `Testing the basic properties of a pointer event triggered by a mouse.`);
+
+</script>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/pointerevents/mouse/pointer-events-before-mouse-events-expected.txt (0 => 242137)


--- trunk/LayoutTests/pointerevents/mouse/pointer-events-before-mouse-events-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/pointerevents/mouse/pointer-events-before-mouse-events-expected.txt	2019-02-27 19:02:03 UTC (rev 242137)
@@ -0,0 +1,3 @@
+
+PASS Testing that pointer events are dispatched prior to compatibility mouse events. 
+

Added: trunk/LayoutTests/pointerevents/mouse/pointer-events-before-mouse-events.html (0 => 242137)


--- trunk/LayoutTests/pointerevents/mouse/pointer-events-before-mouse-events.html	                        (rev 0)
+++ trunk/LayoutTests/pointerevents/mouse/pointer-events-before-mouse-events.html	2019-02-27 19:02:03 UTC (rev 242137)
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+</head>
+<body>
+<script src=""
+<script src=""
+<script src=""
+<script>
+
+'use strict';
+
+target_test({ x: "100px", y: "100px", width: "100px", height: "100px" }, (target, test) => {
+    const eventTracker = new EventTracker(target, ["pointerover", "pointerenter", "pointermove", "pointerdown", "pointerup", "pointerout", "pointerleave",
+                                                   "mouseover", "mouseenter", "mousemove", "mousedown", "mouseup", "mouseout", "mouseleave", "click"]);
+    // Start outside of the target.
+    eventSender.mouseMoveTo(50, 50);
+
+    // Move the cursor over the target.
+    eventSender.mouseMoveTo(150, 150);
+    eventTracker.assertMatchesEvents([
+        { type: "pointerover", x: 150, y: 150 },
+        { type: "mouseover", x: 150, y: 150 },
+        { type: "pointerenter", x: 150, y: 150 },
+        { type: "mouseenter", x: 150, y: 150 },
+        { type: "pointermove", x: 150, y: 150 },
+        { type: "mousemove", x: 150, y: 150 },
+    ]);
+    eventTracker.clear();
+
+    // Click.
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+    eventTracker.assertMatchesEvents([
+        { type: "pointerdown", x: 150, y: 150 },
+        { type: "mousedown", x: 150, y: 150 },
+        { type: "pointerup", x: 150, y: 150 },
+        { type: "mouseup", x: 150, y: 150 },
+        { type: "click", x: 150, y: 150 },
+    ]);
+    eventTracker.clear();
+
+    // Move the cursor outside the target.
+    eventSender.mouseMoveTo(250, 250);
+    eventTracker.assertMatchesEvents([
+        { type: "pointerout", x: 250, y: 250 },
+        { type: "mouseout", x: 250, y: 250 },
+        { type: "pointerleave", x: 250, y: 250 },
+        { type: "mouseleave", x: 250, y: 250 },
+    ]);
+    eventTracker.clear();
+
+    test.done();
+}, `Testing that pointer events are dispatched prior to compatibility mouse events.`);
+
+</script>
+</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/pointerevents/mouse/pointerdown-prevent-default-expected.txt (0 => 242137)


--- trunk/LayoutTests/pointerevents/mouse/pointerdown-prevent-default-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/pointerevents/mouse/pointerdown-prevent-default-expected.txt	2019-02-27 19:02:03 UTC (rev 242137)
@@ -0,0 +1,3 @@
+
+PASS Testing that calling preventDefault() when handling a "pointerdown" event does not dispatch a "mousedown" event. 
+

Added: trunk/LayoutTests/pointerevents/mouse/pointerdown-prevent-default.html (0 => 242137)


--- trunk/LayoutTests/pointerevents/mouse/pointerdown-prevent-default.html	                        (rev 0)
+++ trunk/LayoutTests/pointerevents/mouse/pointerdown-prevent-default.html	2019-02-27 19:02:03 UTC (rev 242137)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset=utf-8>
+</head>
+<body>
+<script src=""
+<script src=""
+<script src=""
+<script>
+
+'use strict';
+
+target_test((target, test) => {
+    const eventTracker = new EventTracker(target, ["pointerdown", "mousedown"]);
+
+    // Press the mouse once without calling preventDefault().
+    eventSender.mouseMoveTo(50, 50);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+
+    // Press it again and call preventDefault().
+    target.addEventListener("pointerdown", event => event.preventDefault());
+    eventSender.mouseMoveTo(50, 50);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+
+    eventTracker.assertMatchesEvents([
+        { type: "pointerdown", x: 50, y: 50 },
+        { type: "mousedown", x: 50, y: 50 },
+        { type: "pointerdown", x: 50, y: 50 },
+    ]);
+    test.done();
+}, `Testing that calling preventDefault() when handling a "pointerdown" event does not dispatch a "mousedown" event.`);
+
+</script>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/LayoutTests/pointerevents/utils.js (242136 => 242137)


--- trunk/LayoutTests/pointerevents/utils.js	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/LayoutTests/pointerevents/utils.js	2019-02-27 19:02:03 UTC (rev 242137)
@@ -44,6 +44,11 @@
             target.addEventListener(eventName, this);
     }
 
+    clear()
+    {
+        this.events = [];
+    }
+
     handleEvent(event)
     {
         if (event instanceof PointerEvent)

Modified: trunk/Source/_javascript_Core/ChangeLog (242136 => 242137)


--- trunk/Source/_javascript_Core/ChangeLog	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-02-27 19:02:03 UTC (rev 242137)
@@ -1,3 +1,13 @@
+2019-02-27  Antoine Quint  <[email protected]>
+
+        Support Pointer Events on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=195008
+        <rdar://problem/47454419>
+
+        Reviewed by Dean Jackson.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2019-02-26  Mark Lam  <[email protected]>
 
         Remove poisons in JSCPoison and uses of them.

Modified: trunk/Source/_javascript_Core/Configurations/FeatureDefines.xcconfig (242136 => 242137)


--- trunk/Source/_javascript_Core/Configurations/FeatureDefines.xcconfig	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/_javascript_Core/Configurations/FeatureDefines.xcconfig	2019-02-27 19:02:03 UTC (rev 242137)
@@ -305,6 +305,7 @@
 ENABLE_POINTER_EVENTS_iosmac = ENABLE_POINTER_EVENTS;
 ENABLE_POINTER_EVENTS_iphoneos = ENABLE_POINTER_EVENTS;
 ENABLE_POINTER_EVENTS_iphonesimulator = ENABLE_POINTER_EVENTS;
+ENABLE_POINTER_EVENTS_macosx = ENABLE_POINTER_EVENTS;
 
 ENABLE_POINTER_LOCK = $(ENABLE_POINTER_LOCK_$(WK_PLATFORM_NAME));
 ENABLE_POINTER_LOCK_macosx = ENABLE_POINTER_LOCK;

Modified: trunk/Source/WebCore/ChangeLog (242136 => 242137)


--- trunk/Source/WebCore/ChangeLog	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/WebCore/ChangeLog	2019-02-27 19:02:03 UTC (rev 242137)
@@ -1,3 +1,50 @@
+2019-02-27  Antoine Quint  <[email protected]>
+
+        Support Pointer Events on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=195008
+        <rdar://problem/47454419>
+
+        Reviewed by Dean Jackson.
+
+        We now dispatch relevant pointer events as we prepare to dispatch mouse events. In most cases, this means we dispatch
+        a pointer event of the same type, with "mouse" being substituted by "pointer", and with the same properties with the
+        exception that if preventDefault() is called for a "pointerdown" event, the matching "mousedown" will not be dispatched,
+        and the same behavior also extends to "pointerup".
+
+        Tests: pointerevents/mouse/over-enter-out-leave.html
+               pointerevents/mouse/pointer-capture.html
+               pointerevents/mouse/pointer-event-basic-properties.html
+               pointerevents/mouse/pointer-events-before-mouse-events.html
+               pointerevents/mouse/pointerdown-prevent-default.html
+
+        * Configurations/FeatureDefines.xcconfig:
+        * dom/Document.cpp: All of the touch-action related members and functions should be iOS-specific since the touch-action
+        property does not have any effect on macOS.
+        (WebCore::Document::invalidateRenderingDependentRegions):
+        (WebCore::Document::nodeWillBeRemoved):
+        (WebCore::Document::updateTouchActionElements):
+        * dom/Document.h:
+        * dom/Element.cpp:
+        (WebCore::Element::dispatchMouseEvent): Dispatch a pointer event matching the mouse event that is about to be dispatched.
+        If preventDefault() is called in the event handler for either "pointerdown" or "pointerup", do not proceed with dispatching
+        the mouse event.
+        * dom/PointerEvent.cpp:
+        (WebCore::pointerEventType):
+        (WebCore::PointerEvent::create):
+        * dom/PointerEvent.h:
+        * page/EventHandler.cpp: Check both the pointer and mouse events to see if we need to dispatch "enter" and "leave" events.
+        (WebCore::hierarchyHasCapturingEventListeners):
+        (WebCore::EventHandler::updateMouseEventTargetNode):
+        * page/PointerCaptureController.cpp: Fix a build error which only happened on macOS.
+        (WebCore::PointerCaptureController::PointerCaptureController): Create the CapturingData for the unique mouse pointer.
+        (WebCore::PointerCaptureController::hasPointerCapture): The code did not match the spec cited in the comment, only the
+        pending target override needs to be considered to determine whether a given element has pointer capture enabled.
+        (WebCore::PointerCaptureController::dispatchEvent): Dispatch the provided pointer event, accounting for pointer capture if
+        it is set.
+        * page/PointerLockController.cpp: Fix a build error which only happened on macOS.
+        * style/StyleTreeResolver.cpp:
+        (WebCore::Style::TreeResolver::resolveElement): Code related to touch-action is only relevant to iOS.
+
 2019-02-27  Sihui Liu  <[email protected]>
 
         Network Process is put to suspended when holding locked IndexedDB files

Modified: trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig (242136 => 242137)


--- trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/WebCore/Configurations/FeatureDefines.xcconfig	2019-02-27 19:02:03 UTC (rev 242137)
@@ -305,6 +305,7 @@
 ENABLE_POINTER_EVENTS_iosmac = ENABLE_POINTER_EVENTS;
 ENABLE_POINTER_EVENTS_iphoneos = ENABLE_POINTER_EVENTS;
 ENABLE_POINTER_EVENTS_iphonesimulator = ENABLE_POINTER_EVENTS;
+ENABLE_POINTER_EVENTS_macosx = ENABLE_POINTER_EVENTS;
 
 ENABLE_POINTER_LOCK = $(ENABLE_POINTER_LOCK_$(WK_PLATFORM_NAME));
 ENABLE_POINTER_LOCK_macosx = ENABLE_POINTER_LOCK;

Modified: trunk/Source/WebCore/PAL/ChangeLog (242136 => 242137)


--- trunk/Source/WebCore/PAL/ChangeLog	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/WebCore/PAL/ChangeLog	2019-02-27 19:02:03 UTC (rev 242137)
@@ -1,3 +1,13 @@
+2019-02-27  Antoine Quint  <[email protected]>
+
+        Support Pointer Events on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=195008
+        <rdar://problem/47454419>
+
+        Reviewed by Dean Jackson.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2019-02-23  Keith Miller  <[email protected]>
 
         Add new mac target numbers

Modified: trunk/Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig (242136 => 242137)


--- trunk/Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig	2019-02-27 19:02:03 UTC (rev 242137)
@@ -305,6 +305,7 @@
 ENABLE_POINTER_EVENTS_iosmac = ENABLE_POINTER_EVENTS;
 ENABLE_POINTER_EVENTS_iphoneos = ENABLE_POINTER_EVENTS;
 ENABLE_POINTER_EVENTS_iphonesimulator = ENABLE_POINTER_EVENTS;
+ENABLE_POINTER_EVENTS_macosx = ENABLE_POINTER_EVENTS;
 
 ENABLE_POINTER_LOCK = $(ENABLE_POINTER_LOCK_$(WK_PLATFORM_NAME));
 ENABLE_POINTER_LOCK_macosx = ENABLE_POINTER_LOCK;

Modified: trunk/Source/WebCore/dom/Document.cpp (242136 => 242137)


--- trunk/Source/WebCore/dom/Document.cpp	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/WebCore/dom/Document.cpp	2019-02-27 19:02:03 UTC (rev 242137)
@@ -4134,7 +4134,7 @@
     setTouchEventRegionsNeedUpdate();
 #endif
 
-#if ENABLE(POINTER_EVENTS)
+#if PLATFORM(IOS_FAMILY) && ENABLE(POINTER_EVENTS)
     if (auto* page = this->page()) {
         if (auto* frameView = view()) {
             if (auto* scrollingCoordinator = page->scrollingCoordinator())
@@ -4526,7 +4526,7 @@
     if (is<Text>(node))
         m_markers->removeMarkers(node);
 
-#if ENABLE(POINTER_EVENTS)
+#if PLATFORM(IOS_FAMILY) && ENABLE(POINTER_EVENTS)
     if (m_touchActionElements && is<Element>(node))
         m_touchActionElements->remove(&downcast<Element>(node));
 #endif
@@ -8668,7 +8668,7 @@
 }
 #endif
 
-#if ENABLE(POINTER_EVENTS)
+#if PLATFORM(IOS_FAMILY) && ENABLE(POINTER_EVENTS)
 void Document::updateTouchActionElements(Element& element, const RenderStyle& style)
 {
     bool changed = false;
@@ -8680,7 +8680,6 @@
     } else if (m_touchActionElements)
         changed |= m_touchActionElements->remove(&element);
 
-#if PLATFORM(IOS_FAMILY)
     if (!changed)
         return;
 
@@ -8692,7 +8691,6 @@
         if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator())
             scrollingCoordinator->frameViewEventTrackingRegionsChanged(*frameView);
     }
-#endif
 }
 #endif
 

Modified: trunk/Source/WebCore/dom/Document.h (242136 => 242137)


--- trunk/Source/WebCore/dom/Document.h	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/WebCore/dom/Document.h	2019-02-27 19:02:03 UTC (rev 242137)
@@ -1254,7 +1254,7 @@
     bool hasTouchEventHandlers() const { return false; }
     bool touchEventTargetsContain(Node&) const { return false; }
 #endif
-#if ENABLE(POINTER_EVENTS)
+#if PLATFORM(IOS_FAMILY) && ENABLE(POINTER_EVENTS)
     void updateTouchActionElements(Element&, const RenderStyle&);
     const HashSet<RefPtr<Element>>* touchActionElements() const { return m_touchActionElements.get(); }
 #endif
@@ -1850,7 +1850,7 @@
 #if ENABLE(TOUCH_EVENTS)
     std::unique_ptr<EventTargetSet> m_touchEventTargets;
 #endif
-#if ENABLE(POINTER_EVENTS)
+#if PLATFORM(IOS_FAMILY) && ENABLE(POINTER_EVENTS)
     std::unique_ptr<HashSet<RefPtr<Element>>> m_touchActionElements;
 #endif
     std::unique_ptr<EventTargetSet> m_wheelEventTargets;

Modified: trunk/Source/WebCore/dom/Element.cpp (242136 => 242137)


--- trunk/Source/WebCore/dom/Element.cpp	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/WebCore/dom/Element.cpp	2019-02-27 19:02:03 UTC (rev 242137)
@@ -79,6 +79,7 @@
 #include "NodeRenderStyle.h"
 #include "PlatformWheelEvent.h"
 #include "PointerCaptureController.h"
+#include "PointerEvent.h"
 #include "PointerLockController.h"
 #include "RenderFragmentContainer.h"
 #include "RenderLayer.h"
@@ -288,9 +289,26 @@
     if (mouseEvent->type().isEmpty())
         return true; // Shouldn't happen.
 
+    bool didNotSwallowEvent = true;
+
+#if ENABLE(POINTER_EVENTS)
+    if (RuntimeEnabledFeatures::sharedFeatures().pointerEventsEnabled()) {
+        if (auto pointerEvent = PointerEvent::create(mouseEvent)) {
+            if (auto* page = document().page())
+                page->pointerCaptureController().dispatchEvent(*pointerEvent, this);
+            if (pointerEvent->defaultPrevented() || pointerEvent->defaultHandled()) {
+                didNotSwallowEvent = false;
+                if (pointerEvent->type() == eventNames().pointerdownEvent || pointerEvent->type() == eventNames().pointerupEvent)
+                    return false;
+            }
+        }
+    }
+#endif
+
     ASSERT(!mouseEvent->target() || mouseEvent->target() != relatedTarget);
     dispatchEvent(mouseEvent);
-    bool didNotSwallowEvent = !mouseEvent->defaultPrevented() && !mouseEvent->defaultHandled();
+    if (mouseEvent->defaultPrevented() || mouseEvent->defaultHandled())
+        didNotSwallowEvent = false;
 
     if (mouseEvent->type() == eventNames().clickEvent && mouseEvent->detail() == 2) {
         // Special case: If it's a double click event, we also send the dblclick event. This is not part

Modified: trunk/Source/WebCore/dom/PointerEvent.cpp (242136 => 242137)


--- trunk/Source/WebCore/dom/PointerEvent.cpp	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/WebCore/dom/PointerEvent.cpp	2019-02-27 19:02:03 UTC (rev 242137)
@@ -28,6 +28,8 @@
 
 #if ENABLE(POINTER_EVENTS)
 
+#import "EventNames.h"
+
 namespace WebCore {
 
 const String& PointerEvent::mousePointerType()
@@ -48,6 +50,27 @@
     return touchType;
 }
 
+static AtomicString pointerEventType(const AtomicString& mouseEventType)
+{
+    auto& names = eventNames();
+    if (mouseEventType == names.mousedownEvent)
+        return names.pointerdownEvent;
+    if (mouseEventType == names.mouseoverEvent)
+        return names.pointeroverEvent;
+    if (mouseEventType == names.mouseenterEvent)
+        return names.pointerenterEvent;
+    if (mouseEventType == names.mousemoveEvent)
+        return names.pointermoveEvent;
+    if (mouseEventType == names.mouseleaveEvent)
+        return names.pointerleaveEvent;
+    if (mouseEventType == names.mouseoutEvent)
+        return names.pointeroutEvent;
+    if (mouseEventType == names.mouseupEvent)
+        return names.pointerupEvent;
+
+    return nullAtom();
+}
+
 PointerEvent::PointerEvent() = default;
 
 PointerEvent::PointerEvent(const AtomicString& type, Init&& initializer)
@@ -65,6 +88,37 @@
 {
 }
 
+RefPtr<PointerEvent> PointerEvent::create(const MouseEvent& mouseEvent)
+{
+    auto type = pointerEventType(mouseEvent.type());
+    if (type.isEmpty())
+        return nullptr;
+
+    auto isEnterOrLeave = type == eventNames().pointerenterEvent || type == eventNames().pointerleaveEvent;
+
+    PointerEvent::Init init;
+    init.bubbles = !isEnterOrLeave;
+    init.cancelable = !isEnterOrLeave;
+    init.composed = !isEnterOrLeave;
+    init.view = mouseEvent.view();
+    init.ctrlKey = mouseEvent.ctrlKey();
+    init.shiftKey = mouseEvent.shiftKey();
+    init.altKey = mouseEvent.altKey();
+    init.metaKey = mouseEvent.metaKey();
+    init.modifierAltGraph = mouseEvent.altGraphKey();
+    init.modifierCapsLock = mouseEvent.capsLockKey();
+    init.screenX = mouseEvent.screenX();
+    init.screenY = mouseEvent.screenY();
+    init.clientX = mouseEvent.clientX();
+    init.clientY = mouseEvent.clientY();
+    init.button = mouseEvent.button();
+    init.buttons = mouseEvent.buttons();
+    init.relatedTarget = mouseEvent.relatedTarget();
+    init.isPrimary = true;
+
+    return PointerEvent::create(type, WTFMove(init));
+}
+
 PointerEvent::~PointerEvent() = default;
 
 EventInterface PointerEvent::eventInterface() const

Modified: trunk/Source/WebCore/dom/PointerEvent.h (242136 => 242137)


--- trunk/Source/WebCore/dom/PointerEvent.h	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/WebCore/dom/PointerEvent.h	2019-02-27 19:02:03 UTC (rev 242137)
@@ -40,7 +40,7 @@
 class PointerEvent final : public MouseEvent {
 public:
     struct Init : MouseEventInit {
-        PointerID pointerId { 0 };
+        PointerID pointerId { PointerEvent::defaultMousePointerIdentifier() };
         double width { 1 };
         double height { 1 };
         float pressure { 0 };
@@ -81,6 +81,8 @@
         return adoptRef(*new PointerEvent);
     }
 
+    static RefPtr<PointerEvent> create(const MouseEvent&);
+
 #if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY)
     static Ref<PointerEvent> create(const PlatformTouchEvent&, unsigned touchIndex, bool isPrimary, Ref<WindowProxy>&&);
     static Ref<PointerEvent> create(const String& type, const PlatformTouchEvent&, unsigned touchIndex, bool isPrimary, Ref<WindowProxy>&&);
@@ -89,6 +91,7 @@
     static const String& mousePointerType();
     static const String& penPointerType();
     static const String& touchPointerType();
+    static PointerID defaultMousePointerIdentifier() { return 1; }
 
     virtual ~PointerEvent();
 
@@ -114,7 +117,7 @@
     PointerEvent(const AtomicString& type, const PlatformTouchEvent&, IsCancelable isCancelable, unsigned touchIndex, bool isPrimary, Ref<WindowProxy>&&);
 #endif
 
-    PointerID m_pointerId { 0 };
+    PointerID m_pointerId { PointerEvent::defaultMousePointerIdentifier() };
     double m_width { 1 };
     double m_height { 1 };
     float m_pressure { 0 };

Modified: trunk/Source/WebCore/page/EventHandler.cpp (242136 => 242137)


--- trunk/Source/WebCore/page/EventHandler.cpp	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2019-02-27 19:02:03 UTC (rev 242137)
@@ -2467,10 +2467,10 @@
     return m_frame.document()->prepareMouseEvent(request, documentPointForWindowPoint(m_frame, mouseEvent.position()), mouseEvent);
 }
 
-static bool hierarchyHasCapturingEventListeners(Element* element, const AtomicString& eventName)
+static bool hierarchyHasCapturingEventListeners(Element* element, const AtomicString& pointerEventName, const AtomicString& compatibilityMouseEventName)
 {
     for (ContainerNode* curr = element; curr; curr = curr->parentInComposedTree()) {
-        if (curr->hasCapturingEventListeners(eventName))
+        if (curr->hasCapturingEventListeners(pointerEventName) || curr->hasCapturingEventListeners(compatibilityMouseEventName))
             return true;
     }
     return false;
@@ -2540,8 +2540,8 @@
             // mouseenter and mouseleave events are only dispatched if there is a capturing eventhandler on an ancestor
             // or a normal eventhandler on the element itself (they don't bubble).
             // This optimization is necessary since these events can cause O(n^2) capturing event-handler checks.
-            bool hasCapturingMouseEnterListener = hierarchyHasCapturingEventListeners(m_elementUnderMouse.get(), eventNames().mouseenterEvent);
-            bool hasCapturingMouseLeaveListener = hierarchyHasCapturingEventListeners(m_lastElementUnderMouse.get(), eventNames().mouseleaveEvent);
+            bool hasCapturingMouseEnterListener = hierarchyHasCapturingEventListeners(m_elementUnderMouse.get(), eventNames().pointerenterEvent, eventNames().mouseenterEvent);
+            bool hasCapturingMouseLeaveListener = hierarchyHasCapturingEventListeners(m_lastElementUnderMouse.get(), eventNames().pointerleaveEvent, eventNames().mouseleaveEvent);
 
             Vector<Ref<Element>, 32> leftElementsChain;
             for (Element* element = m_lastElementUnderMouse.get(); element; element = element->parentElementInComposedTree())
@@ -2565,7 +2565,7 @@
                 m_lastElementUnderMouse->dispatchMouseEvent(platformMouseEvent, eventNames().mouseoutEvent, 0, m_elementUnderMouse.get());
 
             for (auto& chain : leftElementsChain) {
-                if (hasCapturingMouseLeaveListener || chain->hasEventListeners(eventNames().mouseleaveEvent))
+                if (hasCapturingMouseLeaveListener || chain->hasEventListeners(eventNames().pointerleaveEvent) || chain->hasEventListeners(eventNames().mouseleaveEvent))
                     chain->dispatchMouseEvent(platformMouseEvent, eventNames().mouseleaveEvent, 0, m_elementUnderMouse.get());
             }
 
@@ -2573,7 +2573,7 @@
                 m_elementUnderMouse->dispatchMouseEvent(platformMouseEvent, eventNames().mouseoverEvent, 0, m_lastElementUnderMouse.get());
 
             for (auto& chain : enteredElementsChain) {
-                if (hasCapturingMouseEnterListener || chain->hasEventListeners(eventNames().mouseenterEvent))
+                if (hasCapturingMouseEnterListener || chain->hasEventListeners(eventNames().pointerenterEvent) || chain->hasEventListeners(eventNames().mouseenterEvent))
                     chain->dispatchMouseEvent(platformMouseEvent, eventNames().mouseenterEvent, 0, m_lastElementUnderMouse.get());
             }
         }

Modified: trunk/Source/WebCore/page/PointerCaptureController.cpp (242136 => 242137)


--- trunk/Source/WebCore/page/PointerCaptureController.cpp	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/WebCore/page/PointerCaptureController.cpp	2019-02-27 19:02:03 UTC (rev 242137)
@@ -35,11 +35,20 @@
 #include "Page.h"
 #include "PointerEvent.h"
 
+#if ENABLE(POINTER_LOCK)
+#include "PointerLockController.h"
+#endif
+
 namespace WebCore {
 
 PointerCaptureController::PointerCaptureController(Page& page)
     : m_page(page)
 {
+#if !ENABLE(TOUCH_EVENTS)
+    CapturingData capturingData;
+    capturingData.pointerType = PointerEvent::mousePointerType();
+    m_activePointerIdsToCapturingData.set(PointerEvent::defaultMousePointerIdentifier(), capturingData);
+#endif
 }
 
 ExceptionOr<void> PointerCaptureController::setPointerCapture(Element* capturingTarget, PointerID pointerId)
@@ -104,11 +113,7 @@
     // invoked, and false otherwise.
 
     auto iterator = m_activePointerIdsToCapturingData.find(pointerId);
-    if (iterator == m_activePointerIdsToCapturingData.end())
-        return false;
-
-    auto& capturingData = iterator->value;
-    return capturingData.pendingTargetOverride == capturingTarget || capturingData.targetOverride == capturingTarget;
+    return iterator != m_activePointerIdsToCapturingData.end() && iterator->value.pendingTargetOverride == capturingTarget;
 }
 
 void PointerCaptureController::pointerLockWasApplied()
@@ -175,6 +180,21 @@
 }
 #endif
 
+void PointerCaptureController::dispatchEvent(PointerEvent& event, EventTarget* target)
+{
+    auto iterator = m_activePointerIdsToCapturingData.find(event.pointerId());
+    if (iterator != m_activePointerIdsToCapturingData.end()) {
+        auto& capturingData = iterator->value;
+        if (capturingData.pendingTargetOverride && capturingData.targetOverride)
+            capturingData.targetOverride->dispatchEvent(event);
+    }
+
+    if (target && !event.target())
+        target->dispatchEvent(event);
+
+    pointerEventWasDispatched(event);
+}
+
 void PointerCaptureController::pointerEventWillBeDispatched(const PointerEvent& event, EventTarget* target)
 {
     // https://w3c.github.io/pointerevents/#implicit-pointer-capture

Modified: trunk/Source/WebCore/page/PointerLockController.cpp (242136 => 242137)


--- trunk/Source/WebCore/page/PointerLockController.cpp	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/WebCore/page/PointerLockController.cpp	2019-02-27 19:02:03 UTC (rev 242137)
@@ -38,6 +38,10 @@
 #include "UserGestureIndicator.h"
 #include "VoidCallback.h"
 
+#if ENABLE(POINTER_EVENTS)
+#include "PointerCaptureController.h"
+#endif
+
 namespace WebCore {
 
 PointerLockController::PointerLockController(Page& page)

Modified: trunk/Source/WebCore/style/StyleTreeResolver.cpp (242136 => 242137)


--- trunk/Source/WebCore/style/StyleTreeResolver.cpp	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/WebCore/style/StyleTreeResolver.cpp	2019-02-27 19:02:03 UTC (rev 242137)
@@ -237,7 +237,7 @@
     auto beforeUpdate = resolvePseudoStyle(element, update, PseudoId::Before);
     auto afterUpdate = resolvePseudoStyle(element, update, PseudoId::After);
 
-#if ENABLE(POINTER_EVENTS)
+#if ENABLE(POINTER_EVENTS) && PLATFORM(IOS_FAMILY)
     if (RuntimeEnabledFeatures::sharedFeatures().pointerEventsEnabled())
         m_document.updateTouchActionElements(element, *update.style.get());
 #endif

Modified: trunk/Source/WebKit/ChangeLog (242136 => 242137)


--- trunk/Source/WebKit/ChangeLog	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/WebKit/ChangeLog	2019-02-27 19:02:03 UTC (rev 242137)
@@ -1,3 +1,13 @@
+2019-02-27  Antoine Quint  <[email protected]>
+
+        Support Pointer Events on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=195008
+        <rdar://problem/47454419>
+
+        Reviewed by Dean Jackson.
+
+        * Configurations/FeatureDefines.xcconfig:
+
 2019-02-27  Sihui Liu  <[email protected]>
 
         Network Process is put to suspended when holding locked IndexedDB files

Modified: trunk/Source/WebKit/Configurations/FeatureDefines.xcconfig (242136 => 242137)


--- trunk/Source/WebKit/Configurations/FeatureDefines.xcconfig	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/WebKit/Configurations/FeatureDefines.xcconfig	2019-02-27 19:02:03 UTC (rev 242137)
@@ -305,6 +305,7 @@
 ENABLE_POINTER_EVENTS_iosmac = ENABLE_POINTER_EVENTS;
 ENABLE_POINTER_EVENTS_iphoneos = ENABLE_POINTER_EVENTS;
 ENABLE_POINTER_EVENTS_iphonesimulator = ENABLE_POINTER_EVENTS;
+ENABLE_POINTER_EVENTS_macosx = ENABLE_POINTER_EVENTS;
 
 ENABLE_POINTER_LOCK = $(ENABLE_POINTER_LOCK_$(WK_PLATFORM_NAME));
 ENABLE_POINTER_LOCK_macosx = ENABLE_POINTER_LOCK;

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (242136 => 242137)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2019-02-27 19:02:03 UTC (rev 242137)
@@ -1,3 +1,23 @@
+2019-02-27  Antoine Quint  <[email protected]>
+
+        Support Pointer Events on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=195008
+        <rdar://problem/47454419>
+
+        Reviewed by Dean Jackson.
+
+        Add a WebKitLegacy API to enable and disable the Pointer Events runtime feature.
+
+        * Configurations/FeatureDefines.xcconfig:
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences pointerEventsEnabled]):
+        (-[WebPreferences setPointerEventsEnabled:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2019-02-23  Keith Miller  <[email protected]>
 
         Add new mac target numbers

Modified: trunk/Source/WebKitLegacy/mac/Configurations/FeatureDefines.xcconfig (242136 => 242137)


--- trunk/Source/WebKitLegacy/mac/Configurations/FeatureDefines.xcconfig	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/WebKitLegacy/mac/Configurations/FeatureDefines.xcconfig	2019-02-27 19:02:03 UTC (rev 242137)
@@ -305,6 +305,7 @@
 ENABLE_POINTER_EVENTS_iosmac = ENABLE_POINTER_EVENTS;
 ENABLE_POINTER_EVENTS_iphoneos = ENABLE_POINTER_EVENTS;
 ENABLE_POINTER_EVENTS_iphonesimulator = ENABLE_POINTER_EVENTS;
+ENABLE_POINTER_EVENTS_macosx = ENABLE_POINTER_EVENTS;
 
 ENABLE_POINTER_LOCK = $(ENABLE_POINTER_LOCK_$(WK_PLATFORM_NAME));
 ENABLE_POINTER_LOCK_macosx = ENABLE_POINTER_LOCK;

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h (242136 => 242137)


--- trunk/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h	2019-02-27 19:02:03 UTC (rev 242137)
@@ -53,6 +53,7 @@
 #define WebKitJavaScriptEnabledPreferenceKey @"WebKitJavaScriptEnabled"
 #define WebKitJavaScriptMarkupEnabledPreferenceKey @"WebKitJavaScriptMarkupEnabled"
 #define WebKitWebAnimationsEnabledPreferenceKey @"WebKitWebAnimationsEnabled"
+#define WebKitPointerEventsEnabledPreferenceKey @"WebKitPointerEventsEnabled"
 #define WebKitWebSecurityEnabledPreferenceKey @"WebKitWebSecurityEnabled"
 #define WebKitAllowUniversalAccessFromFileURLsPreferenceKey @"WebKitAllowUniversalAccessFromFileURLs"
 #define WebKitAllowFileAccessFromFileURLsPreferenceKey @"WebKitAllowFileAccessFromFileURLs"

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm (242136 => 242137)


--- trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm	2019-02-27 19:02:03 UTC (rev 242137)
@@ -649,6 +649,7 @@
 #endif
         [NSNumber numberWithBool:NO], WebKitDirectoryUploadEnabledPreferenceKey,
         [NSNumber numberWithBool:YES], WebKitWebAnimationsEnabledPreferenceKey,
+        [NSNumber numberWithBool:NO], WebKitPointerEventsEnabledPreferenceKey,
 
 #if PLATFORM(IOS_FAMILY)
         @NO, WebKitVisualViewportAPIEnabledPreferenceKey,
@@ -3148,6 +3149,16 @@
     [self _setBoolValue:flag forKey:WebKitWebAnimationsEnabledPreferenceKey];
 }
 
+- (BOOL)pointerEventsEnabled
+{
+    return [self _boolValueForKey:WebKitPointerEventsEnabledPreferenceKey];
+}
+
+- (void)setPointerEventsEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitPointerEventsEnabledPreferenceKey];
+}
+
 - (BOOL)fetchAPIKeepAliveEnabled
 {
     return [self _boolValueForKey:WebKitFetchAPIEnabledPreferenceKey];

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h (242136 => 242137)


--- trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h	2019-02-27 19:02:03 UTC (rev 242137)
@@ -561,6 +561,9 @@
 - (void)setWebAnimationsEnabled:(BOOL)flag;
 - (BOOL)webAnimationsEnabled;
 
+- (void)setPointerEventsEnabled:(BOOL)flag;
+- (BOOL)pointerEventsEnabled;
+
 - (void)setFetchAPIKeepAliveEnabled:(BOOL)flag;
 - (BOOL)fetchAPIKeepAliveEnabled;
 

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (242136 => 242137)


--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2019-02-27 19:02:03 UTC (rev 242137)
@@ -3152,6 +3152,10 @@
 
     RuntimeEnabledFeatures::sharedFeatures().setWebAnimationsEnabled([preferences webAnimationsEnabled]);
 
+#if ENABLE(POINTER_EVENTS)
+    RuntimeEnabledFeatures::sharedFeatures().setPointerEventsEnabled([preferences pointerEventsEnabled]);
+#endif
+
 #if ENABLE(INTERSECTION_OBSERVER)
     RuntimeEnabledFeatures::sharedFeatures().setIntersectionObserverEnabled(preferences.intersectionObserverEnabled);
 #endif

Modified: trunk/Tools/ChangeLog (242136 => 242137)


--- trunk/Tools/ChangeLog	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Tools/ChangeLog	2019-02-27 19:02:03 UTC (rev 242137)
@@ -1,3 +1,15 @@
+2019-02-27  Antoine Quint  <[email protected]>
+
+        Support Pointer Events on macOS
+        https://bugs.webkit.org/show_bug.cgi?id=195008
+        <rdar://problem/47454419>
+
+        Reviewed by Dean Jackson.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (enableExperimentalFeatures): Enable the PointerEvents runtime feature in DumpRenderTree such that tests targeting WK1 may test the Pointer Events feature.
+        * TestWebKitAPI/Configurations/FeatureDefines.xcconfig:
+
 2019-02-26  Mark Lam  <[email protected]>
 
         Remove remaining poisoning code.

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (242136 => 242137)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2019-02-27 19:02:03 UTC (rev 242137)
@@ -875,6 +875,7 @@
     preferences.sourceBufferChangeTypeEnabled = YES;
     [preferences setCSSOMViewScrollingAPIEnabled:YES];
     [preferences setMediaRecorderEnabled:YES];
+    [preferences setPointerEventsEnabled:YES];
 }
 
 // Called before each test.

Modified: trunk/Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig (242136 => 242137)


--- trunk/Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig	2019-02-27 18:55:07 UTC (rev 242136)
+++ trunk/Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig	2019-02-27 19:02:03 UTC (rev 242137)
@@ -305,6 +305,7 @@
 ENABLE_POINTER_EVENTS_iosmac = ENABLE_POINTER_EVENTS;
 ENABLE_POINTER_EVENTS_iphoneos = ENABLE_POINTER_EVENTS;
 ENABLE_POINTER_EVENTS_iphonesimulator = ENABLE_POINTER_EVENTS;
+ENABLE_POINTER_EVENTS_macosx = ENABLE_POINTER_EVENTS;
 
 ENABLE_POINTER_LOCK = $(ENABLE_POINTER_LOCK_$(WK_PLATFORM_NAME));
 ENABLE_POINTER_LOCK_macosx = ENABLE_POINTER_LOCK;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to