Bug 191333 - PointerEvents should not require touch event listeners to be registered
Summary: PointerEvents should not require touch event listeners to be registered
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Antoine Quint
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-11-06 14:59 PST by Dean Jackson
Modified: 2021-11-25 09:07 PST (History)
8 users (show)

See Also:


Attachments
Patch (12.98 KB, patch)
2018-11-15 09:29 PST, Antoine Quint
dino: review+
ews-watchlist: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews106 for mac-sierra-wk2 (3.24 MB, application/zip)
2018-11-15 10:27 PST, EWS Watchlist
no flags Details
Archive of layout-test-results from ews200 for win-future (12.79 MB, application/zip)
2018-11-15 12:09 PST, EWS Watchlist
no flags Details
Archive of layout-test-results from ews123 for ios-simulator-wk2 (30.51 MB, application/zip)
2018-11-15 13:02 PST, EWS Watchlist
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dean Jackson 2018-11-06 14:59:45 PST
We have code to make sure that we don't handle touch events if there are no listeners. Since the implementation of pointer events is currently piggy-backing on touch events, it means we require a touch listener to be registered in order to dispatch pointer events.

We need to remove this restriction, or probably duplicate it for pointer events.
Comment 1 Radar WebKit Bug Importer 2018-11-06 15:00:16 PST
<rdar://problem/45857523>
Comment 2 Antoine Quint 2018-11-15 09:29:11 PST
Created attachment 354947 [details]
Patch
Comment 3 Dean Jackson 2018-11-15 09:52:19 PST
Comment on attachment 354947 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=354947&action=review

> Source/WebCore/dom/EventNames.h:362
> +    std::array<std::reference_wrapper<const AtomicString>, 9> touchEventNames() const;

Rename this to touchAndPointerEventNames

> Source/WebKit/UIProcess/WebPageProxy.cpp:2327
> +        updateTrackingType(m_touchEventTracking.touchStartTracking, names.pointerdownEvent);
> +        updateTrackingType(m_touchEventTracking.touchMoveTracking, names.pointermoveEvent);
> +        updateTrackingType(m_touchEventTracking.touchEndTracking, names.pointerupEvent);

Maybe m_touchEventTracking should be renamed as well.

> LayoutTests/pointerevents/utils.js:10
> +    if (arguments.length !== 2 && arguments.length !== 3) {
> +        console.error(`target_test expected 2 or 3 arguments but got ${arguments.length}.`);
> +        return;
> +    }
> +
> +    const impliedOptions = arguments.length == 2;
> +

Don't use the horrible arguments object. Instead, do a ..args rest parameter.

> LayoutTests/pointerevents/utils.js:54
> +            inputType : "hand",

Strange this isn't "finger"

> LayoutTests/pointerevents/utils.js:106
> +        events = [events];

Wouldn't this already take a list?

> LayoutTests/pointerevents/utils.js:107
> +        return this._run(`uiController.sendEventStream('${JSON.stringify({ events })}')`);

nice. You could probably Array-ify the events inside the ${} though.
Comment 4 EWS Watchlist 2018-11-15 10:27:28 PST
Comment on attachment 354947 [details]
Patch

Attachment 354947 [details] did not pass mac-wk2-ews (mac-wk2):
Output: https://webkit-queues.webkit.org/results/10005279

New failing tests:
pointerevents/ios/pointer-events-dispatch-on-touch.html
Comment 5 EWS Watchlist 2018-11-15 10:27:30 PST
Created attachment 354954 [details]
Archive of layout-test-results from ews106 for mac-sierra-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews106  Port: mac-sierra-wk2  Platform: Mac OS X 10.12.6
Comment 6 EWS Watchlist 2018-11-15 12:09:22 PST
Comment on attachment 354947 [details]
Patch

Attachment 354947 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/10005930

New failing tests:
pointerevents/ios/pointer-events-dispatch-on-touch.html
Comment 7 EWS Watchlist 2018-11-15 12:09:33 PST
Created attachment 354967 [details]
Archive of layout-test-results from ews200 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews200  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 8 EWS Watchlist 2018-11-15 13:02:15 PST
Comment on attachment 354947 [details]
Patch

Attachment 354947 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: https://webkit-queues.webkit.org/results/10006304

New failing tests:
pointerevents/ios/pointer-events-prevent-default.html
pointerevents/ios/pointer-events-dispatch-on-touch.html
Comment 9 EWS Watchlist 2018-11-15 13:02:18 PST
Created attachment 354975 [details]
Archive of layout-test-results from ews123 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews123  Port: ios-simulator-wk2  Platform: Mac OS X 10.13.6
Comment 10 Antoine Quint 2018-11-16 00:47:55 PST
(In reply to Dean Jackson from comment #3)
> Comment on attachment 354947 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=354947&action=review
> 
> > Source/WebCore/dom/EventNames.h:362
> > +    std::array<std::reference_wrapper<const AtomicString>, 9> touchEventNames() const;
> 
> Rename this to touchAndPointerEventNames

Will fix when landing.

> > Source/WebKit/UIProcess/WebPageProxy.cpp:2327
> > +        updateTrackingType(m_touchEventTracking.touchStartTracking, names.pointerdownEvent);
> > +        updateTrackingType(m_touchEventTracking.touchMoveTracking, names.pointermoveEvent);
> > +        updateTrackingType(m_touchEventTracking.touchEndTracking, names.pointerupEvent);
> 
> Maybe m_touchEventTracking should be renamed as well.

Will fix when landing.

> > LayoutTests/pointerevents/utils.js:10
> > +    if (arguments.length !== 2 && arguments.length !== 3) {
> > +        console.error(`target_test expected 2 or 3 arguments but got ${arguments.length}.`);
> > +        return;
> > +    }
> > +
> > +    const impliedOptions = arguments.length == 2;
> > +
> 
> Don't use the horrible arguments object. Instead, do a ..args rest parameter.

You got it, will fix when landing.

> > LayoutTests/pointerevents/utils.js:54
> > +            inputType : "hand",
> 
> Strange this isn't "finger"
> 
> > LayoutTests/pointerevents/utils.js:106
> > +        events = [events];
> 
> Wouldn't this already take a list?

In practice we'll always use a single item, so it felt easier on call sites to pass a single item rather than an array that's a single item.

> > LayoutTests/pointerevents/utils.js:107
> > +        return this._run(`uiController.sendEventStream('${JSON.stringify({ events })}')`);
> 
> nice. You could probably Array-ify the events inside the ${} though.

I tried and failed, but I will try harder!
Comment 11 Antoine Quint 2018-11-16 01:09:42 PST
Committed r238274: <https://trac.webkit.org/changeset/238274>