haikuwebkit/LayoutTests/pointerevents/ios/pointer-events-implicit-cap...

26 lines
865 B
HTML
Raw Permalink Normal View History

Implement capture for Pointer Events on iOS https://bugs.webkit.org/show_bug.cgi?id=193917 <rdar://problem/47605689> Reviewed by Dean Jackson. Source/WebCore: We add a new PointerCaptureController object which gets notified upon dispatch of pointer events to implement implicit pointer capture, dispatch the gotpointercapture and lostpointercaptiure events, and implement the Element APIs for pointer capture: hasPointerCapture(), setPointerCapture() and releasePointerCapture(). Tests: pointerevents/ios/pointer-events-implicit-capture-has-pointer-capture-in-pointer-down.html pointerevents/ios/pointer-events-implicit-capture-release-exception.html pointerevents/ios/pointer-events-implicit-capture-release.html pointerevents/ios/pointer-events-implicit-capture.html pointerevents/ios/pointer-events-set-pointer-capture-exceptions.html * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * dom/Element.cpp: (WebCore::Element::setPointerCapture): (WebCore::Element::releasePointerCapture): (WebCore::Element::hasPointerCapture): * dom/Element.h: * dom/Element.idl: * dom/EventNames.h: * dom/PointerEvent.h: * page/Page.cpp: (WebCore::Page::Page): * page/Page.h: (WebCore::Page::pointerCaptureController const): * page/PointerCaptureController.cpp: Added. (WebCore::PointerCaptureController::PointerCaptureController): (WebCore::PointerCaptureController::setPointerCapture): (WebCore::PointerCaptureController::releasePointerCapture): (WebCore::PointerCaptureController::hasPointerCapture): (WebCore::PointerCaptureController::pointerLockWasApplied): (WebCore::PointerCaptureController::touchEndedOrWasCancelledForIdentifier): (WebCore::PointerCaptureController::pointerEventWillBeDispatched): (WebCore::PointerCaptureController::pointerEventWasDispatched): (WebCore::PointerCaptureController::processPendingPointerCapture): * page/PointerCaptureController.h: Added. * page/PointerLockController.cpp: (WebCore::PointerLockController::requestPointerLock): * page/PointerLockController.h: LayoutTests: New tests for implicit pointer capture and the Element APIs related to pointer capture. * pointerevents/ios/pointer-events-implicit-capture-expected.txt: Added. * pointerevents/ios/pointer-events-implicit-capture-has-pointer-capture-in-pointer-down-expected.txt: Added. * pointerevents/ios/pointer-events-implicit-capture-has-pointer-capture-in-pointer-down.html: Added. * pointerevents/ios/pointer-events-implicit-capture-release-exception-expected.txt: Added. * pointerevents/ios/pointer-events-implicit-capture-release-exception.html: Added. * pointerevents/ios/pointer-events-implicit-capture-release-expected.txt: Added. * pointerevents/ios/pointer-events-implicit-capture-release.html: Added. * pointerevents/ios/pointer-events-implicit-capture.html: Added. * pointerevents/ios/pointer-events-set-pointer-capture-exceptions-expected.txt: Added. * pointerevents/ios/pointer-events-set-pointer-capture-exceptions.html: Added. Canonical link: https://commits.webkit.org/208432@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240634 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-29 03:15:02 +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';
target_test((target, test) => {
target.addEventListener("pointerdown", event => {
assert_true(target.hasPointerCapture(event.pointerId));
assert_throws("NotFoundError", () => target.releasePointerCapture(event.pointerId + 1));
assert_true(target.hasPointerCapture(event.pointerId));
});
Tests under pointerevents/ios are flaky https://bugs.webkit.org/show_bug.cgi?id=197624 Reviewed by Dean Jackson. Tests under pointerevents/ios generate touches that use UIScriptController may not succeed if ran in multiple iterations or in a specific order due to not ensuring that all touches are released when the test completes. We now ensure that we do when running swipes, taps, and pinches. * pointerevents/ios/pointer-events-dispatch-on-stylus.html: Use the new ui.tapStylus() method to generate a tap with the stylus which ensures all touches are removed upon completion. * pointerevents/ios/pointer-events-dispatch-on-touch.html: Use a tap to ensure all touches are removed upon completion. * pointerevents/ios/pointer-events-implicit-capture-has-pointer-capture-in-pointer-down.html: Use a tap to ensure all touches are removed upon completion. * pointerevents/ios/pointer-events-implicit-capture-release-exception.html: Use a tap to ensure all touches are removed upon completion. * pointerevents/ios/pointer-events-implicit-capture-release.html: Use a tap to ensure all touches are removed upon completion. * pointerevents/ios/pointer-events-prevent-default-allows-click-event.html: Ensure both the "click" event and the tap generation have succeeded before marking the test as complete. * pointerevents/ios/pointer-events-set-pointer-capture-exceptions.html: Use a tap to ensure all touches are removed upon completion. * pointerevents/ios/touch-action-none-link-traversal.html: Ensure both the "load" event and the tap generation have succeeded before marking the test as complete. * pointerevents/ios/touch-action-pan-x-pan-y.html: Remove the requestAnimationFrame() call since ui.swipe() now resolves its promise once all touches have completed. * pointerevents/ios/touch-action-pan-x.html: Remove the requestAnimationFrame() call since ui.swipe() now resolves its promise once all touches have completed. * pointerevents/ios/touch-action-pan-y.html: Remove the requestAnimationFrame() call since ui.swipe() now resolves its promise once all touches have completed. * pointerevents/ios/touch-action-pinch-zoom-allows-zooming.html: Remove the requestAnimationFrame() call since ui.pinchOut() now resolves its promise once all touches have completed. * pointerevents/ios/touch-action-pointercancel-pan-x.html: We don't need to track "pointermove" events since dispatch of "pointercancel" is asynchronous and the number of "pointermove" events prior to its dispatch can legitimately vary. * pointerevents/ios/touch-action-pointercancel-pan-y.html: We don't need to track "pointermove" events since dispatch of "pointercancel" is asynchronous and the number of "pointermove" events prior to its dispatch can legitimately vary. * pointerevents/utils.js: (const.ui.new.UIController.prototype.swipe): Wait until the swipe is complete before resolving the promise. (const.ui.new.UIController.prototype.pinchOut): Use a custom sequence to ensure that the pinch releases touches upon completion. (const.ui.new.UIController.prototype.tapStylus): Introduce this new method to perform a stylus tap which ensures all touches are complete before resolving the promise. (const.ui.new.UIController.prototype.beginTouches): Deleted. (const.ui.new.UIController.prototype.beginStylus): Deleted. Canonical link: https://commits.webkit.org/211759@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244974 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-05-06 20:39:28 +00:00
ui.tap({ x: 50, y: 50 }).then(() => test.done());
Implement capture for Pointer Events on iOS https://bugs.webkit.org/show_bug.cgi?id=193917 <rdar://problem/47605689> Reviewed by Dean Jackson. Source/WebCore: We add a new PointerCaptureController object which gets notified upon dispatch of pointer events to implement implicit pointer capture, dispatch the gotpointercapture and lostpointercaptiure events, and implement the Element APIs for pointer capture: hasPointerCapture(), setPointerCapture() and releasePointerCapture(). Tests: pointerevents/ios/pointer-events-implicit-capture-has-pointer-capture-in-pointer-down.html pointerevents/ios/pointer-events-implicit-capture-release-exception.html pointerevents/ios/pointer-events-implicit-capture-release.html pointerevents/ios/pointer-events-implicit-capture.html pointerevents/ios/pointer-events-set-pointer-capture-exceptions.html * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * dom/Element.cpp: (WebCore::Element::setPointerCapture): (WebCore::Element::releasePointerCapture): (WebCore::Element::hasPointerCapture): * dom/Element.h: * dom/Element.idl: * dom/EventNames.h: * dom/PointerEvent.h: * page/Page.cpp: (WebCore::Page::Page): * page/Page.h: (WebCore::Page::pointerCaptureController const): * page/PointerCaptureController.cpp: Added. (WebCore::PointerCaptureController::PointerCaptureController): (WebCore::PointerCaptureController::setPointerCapture): (WebCore::PointerCaptureController::releasePointerCapture): (WebCore::PointerCaptureController::hasPointerCapture): (WebCore::PointerCaptureController::pointerLockWasApplied): (WebCore::PointerCaptureController::touchEndedOrWasCancelledForIdentifier): (WebCore::PointerCaptureController::pointerEventWillBeDispatched): (WebCore::PointerCaptureController::pointerEventWasDispatched): (WebCore::PointerCaptureController::processPendingPointerCapture): * page/PointerCaptureController.h: Added. * page/PointerLockController.cpp: (WebCore::PointerLockController::requestPointerLock): * page/PointerLockController.h: LayoutTests: New tests for implicit pointer capture and the Element APIs related to pointer capture. * pointerevents/ios/pointer-events-implicit-capture-expected.txt: Added. * pointerevents/ios/pointer-events-implicit-capture-has-pointer-capture-in-pointer-down-expected.txt: Added. * pointerevents/ios/pointer-events-implicit-capture-has-pointer-capture-in-pointer-down.html: Added. * pointerevents/ios/pointer-events-implicit-capture-release-exception-expected.txt: Added. * pointerevents/ios/pointer-events-implicit-capture-release-exception.html: Added. * pointerevents/ios/pointer-events-implicit-capture-release-expected.txt: Added. * pointerevents/ios/pointer-events-implicit-capture-release.html: Added. * pointerevents/ios/pointer-events-implicit-capture.html: Added. * pointerevents/ios/pointer-events-set-pointer-capture-exceptions-expected.txt: Added. * pointerevents/ios/pointer-events-set-pointer-capture-exceptions.html: Added. Canonical link: https://commits.webkit.org/208432@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240634 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-01-29 03:15:02 +00:00
}, "Calling releasePointerCapture() in the 'pointerdown' event handler with a bogus pointer id raises an exception and does not alter pointer capture.");
</script>
</body>
</html>