Bug 197004

Summary: [Pointer Events WPT] Unskip imported/w3c/web-platform-tests/pointerevents/pointerevent_lostpointercapture_for_disconnected_node.html
Product: WebKit Reporter: Antoine Quint <graouts>
Component: UI EventsAssignee: Antoine Quint <graouts>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, cmarcelo, dbates, esprehn+autocc, ews-watchlist, kangil.han, koivisto, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch koivisto: review+

Description Antoine Quint 2019-04-17 07:02:16 PDT
The test at imported/w3c/web-platform-tests/pointerevents/pointerevent_lostpointercapture_for_disconnected_node.html is timing out and is skipped currently.
Comment 1 Antoine Quint 2019-04-17 07:07:26 PDT
We don't release pointer capture when a node that has pointer capture is disconnected.
Comment 2 Antoine Quint 2019-04-18 02:26:49 PDT
Created attachment 367722 [details]
Patch
Comment 3 Antti Koivisto 2019-04-18 06:11:56 PDT
Comment on attachment 367722 [details]
Patch

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

> Source/WebCore/page/PointerCaptureController.cpp:133
> +    for (auto& keyAndValue : m_activePointerIdsToCapturingData) {

I suppose this map is mostly empty/has very few items?

> Source/WebCore/page/PointerCaptureController.cpp:147
> +        return;
> +    }

I feel for loops read better if the bail out case is a branch, not the body of the loop.
Comment 4 Antoine Quint 2019-04-18 06:24:49 PDT
(In reply to Antti Koivisto from comment #3)
> Comment on attachment 367722 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=367722&action=review
> 
> > Source/WebCore/page/PointerCaptureController.cpp:133
> > +    for (auto& keyAndValue : m_activePointerIdsToCapturingData) {
> 
> I suppose this map is mostly empty/has very few items?

Yes. On macOS, it will be empty except if the page has explicitly requested pointer capture for the single active pointer. So the map would have at most one item in it on macOS.

On iOS, pointer capture is implicit, so that map will have as many items as there are active touches, which most likely will be 1 or 2.

> > Source/WebCore/page/PointerCaptureController.cpp:147
> > +        return;
> > +    }
> 
> I feel for loops read better if the bail out case is a branch, not the body
> of the loop.

Cool, I'll change it.
Comment 5 Antoine Quint 2019-04-18 06:31:24 PDT
Committed r244423: <https://trac.webkit.org/changeset/244423>
Comment 6 Radar WebKit Bug Importer 2019-04-18 06:32:22 PDT
<rdar://problem/50014329>