haikuwebkit/LayoutTests/pointerevents/ios/boundary-events-without-poi...

50 lines
1.8 KiB
HTML
Raw Permalink Normal View History

releasePointerCapture() not working for implicit capture; can't opt-in to pointerenter/leave for touches https://bugs.webkit.org/show_bug.cgi?id=199803 <rdar://problem/53127223> Reviewed by Dean Jackson. Source/WebCore: In order to dispatch boundary events (pointerover/out/enter/leave) when the implicit pointer capture is released on iOS, we need to track the target of the pointer events that was dispatched last for a given pointer id. Then we compare that target with the current target when dispatching a new pointer event and determine whether we should dispatch boundary events using the exact same approach used to dispatch mouse boundary events in EventHandler::updateMouseEventTargetNode(). Tests: pointerevents/ios/boundary-events-through-hierarchy-without-pointer-capture.html pointerevents/ios/boundary-events-without-pointer-capture.html * page/PointerCaptureController.cpp: (WebCore::hierarchyHasCapturingEventListeners): (WebCore::PointerCaptureController::dispatchEventForTouchAtIndex): (WebCore::PointerCaptureController::pointerEventWillBeDispatched): (WebCore::PointerCaptureController::ensureCapturingDataForPointerEvent): (WebCore::PointerCaptureController::cancelPointer): * page/PointerCaptureController.h: LayoutTests: Add new tests that check we correctly dispatch boundary events on iOS when pointer capture is disabled. * pointerevents/ios/boundary-events-through-hierarchy-without-pointer-capture-expected.txt: Added. * pointerevents/ios/boundary-events-through-hierarchy-without-pointer-capture.html: Added. * pointerevents/ios/boundary-events-without-pointer-capture-expected.txt: Added. * pointerevents/ios/boundary-events-without-pointer-capture.html: Added. * pointerevents/utils.js: Canonical link: https://commits.webkit.org/215679@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250182 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-09-21 15:34:43 +00:00
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../utils.js"></script>
<script>
'use strict';
async_test(test => {
const firstTarget = makeTarget(test, { x: "100px", y: "100px", width: "100px", height: "100px" });
firstTarget.id = "one";
const secondTarget = makeTarget(test, { x: "200px", y: "100px", width: "100px", height: "100px" });
secondTarget.id = "two";
const eventsLog = [];
const logger = event => eventsLog.push(`${event.type}@${event.currentTarget.id}`);
for (let eventType of ["pointerover", "pointerenter", "pointerout", "pointerleave"]) {
firstTarget.addEventListener(eventType, logger);
secondTarget.addEventListener(eventType, logger);
}
// Ensure we get pointer events for all touch events.
document.body.style.touchAction = "none";
// Ensure we disable pointer capture.
document.body.addEventListener("pointerdown", event => event.currentTarget.releasePointerCapture(event.pointerId));
const one = ui.finger();
ui.sequence([
one.begin({ x: 50, y: 150 }),
one.move({ x: 150, y: 150 }),
one.move({ x: 250, y: 150 }),
one.move({ x: 350, y: 150 }),
one.end()
]).then(() => {
assert_array_equals(eventsLog, ["pointerover@one", "pointerenter@one", "pointerout@one", "pointerleave@one", "pointerover@two", "pointerenter@two", "pointerout@two", "pointerleave@two"]);
test.done();
});
}, `Testing that "pointerover", "pointerenter", "pointerout" and "pointerleave" events are dispatched correctly with capture disabled as a touch moves between elements.`);
</script>
</body>
</html>