All PointerEvent.isTrusted is always false.
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Mar 2019 15:54:02 +0000 (15:54 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Mar 2019 15:54:02 +0000 (15:54 +0000)
commitb25de0d783f857419909657f1e03158e73c9c4b6
tree674f7065b7e382be4457f33ba5b118951a9ba225
parentef3ff6f9be096511131fcb7a6f30ec9266e55bef
All PointerEvent.isTrusted is always false.
https://bugs.webkit.org/show_bug.cgi?id=196075
<rdar://problem/49158778>

Reviewed by Chris Dumez.

Source/WebCore:

Test: pointerevents/ios/pointer-events-is-trusted.html

The constructors we were using for some PointerEvent::create() methods were using initializers which are expected to be used with JS APIs
and thus generate untrusted events. We switch to using constructors using dedicated parameters which will set isTrusted to true.

* dom/PointerEvent.cpp:
(WebCore::PointerEvent::create):
(WebCore::PointerEvent::createPointerCancelEvent):
(WebCore::PointerEvent::PointerEvent):
(WebCore::m_isPrimary):
(WebCore::m_pointerType):
* dom/PointerEvent.h:
* page/PointerCaptureController.cpp:
(WebCore::PointerCaptureController::cancelPointer):

LayoutTests:

Add tests to the macOS and iOS series of tests that check that isTrusted is indeed true. This uncovered a couple of issues with how some tests were written.

* pointerevents/ios/pointer-events-is-primary.html: Ensure we end both touches so that further tests run cleanly.
* pointerevents/ios/pointer-events-is-trusted-expected.txt: Added.
* pointerevents/ios/pointer-events-is-trusted.html: Added.
* pointerevents/mouse/pointer-event-basic-properties.html: Ensure we wait for the event to be handled before finishing the test.
* pointerevents/utils.js:
(prototype._handlePointerEvent):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243645 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/pointerevents/ios/pointer-events-is-primary.html
LayoutTests/pointerevents/ios/pointer-events-is-trusted-expected.txt [new file with mode: 0644]
LayoutTests/pointerevents/ios/pointer-events-is-trusted.html [new file with mode: 0644]
LayoutTests/pointerevents/mouse/pointer-event-basic-properties.html
LayoutTests/pointerevents/utils.js
Source/WebCore/ChangeLog
Source/WebCore/dom/PointerEvent.cpp
Source/WebCore/dom/PointerEvent.h
Source/WebCore/page/PointerCaptureController.cpp