Bug 226655

Summary: [iOS] Meaningful click heuristic should account for media state changes
Product: WebKit Reporter: Wenson Hsieh <wenson_hsieh>
Component: PlatformAssignee: Wenson Hsieh <wenson_hsieh>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, eric.carlson, ews-watchlist, glenn, hi, jer.noble, megan_gardner, philipj, sergio, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Renaming none

Description Wenson Hsieh 2021-06-04 12:26:14 PDT
rdar://78330664
Comment 1 Wenson Hsieh 2021-06-04 13:16:24 PDT Comment hidden (obsolete)
Comment 2 Wenson Hsieh 2021-06-04 13:36:49 PDT
Created attachment 430607 [details]
Patch
Comment 3 Tim Horton 2021-06-04 14:02:43 PDT
Comment on attachment 430607 [details]
Patch

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

> Source/WebKit/WebProcess/WebPage/WebPage.h:2195
>      bool m_didHandleOrPreventMouseDownOrMouseUpEventDuringSyntheticClick { false };
> +    bool m_didChangePlayingMediaStateDuringSyntheticClick { false };

How many of these are we going to end up with? Is it actually important that we keep track of /why/? 
Should we just "m_currentSyntheticClickMayBeMeaningful { true }" and then falsy it in all the callbacks? Then you don't need m_isCompletingSyntheticClick or separate bits for each thing.
Comment 4 Wenson Hsieh 2021-06-04 14:05:40 PDT
(In reply to Tim Horton from comment #3)
> Comment on attachment 430607 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=430607&action=review
> 
> > Source/WebKit/WebProcess/WebPage/WebPage.h:2195
> >      bool m_didHandleOrPreventMouseDownOrMouseUpEventDuringSyntheticClick { false };
> > +    bool m_didChangePlayingMediaStateDuringSyntheticClick { false };
> 
> How many of these are we going to end up with? Is it actually important that
> we keep track of /why/? 
> Should we just "m_currentSyntheticClickMayBeMeaningful { true }" and then
> falsy it in all the callbacks? Then you don't need
> m_isCompletingSyntheticClick or separate bits for each thing.

That's a good point — I'll change it to `m_currentSyntheticClickMayBeMeaningful` instead, in the way you described.

(As an aside, if we accumulate one or two more of these call sites in the future, we'll also probably want this to also turn it into an OptionSet).
Comment 5 Wenson Hsieh 2021-06-04 14:23:47 PDT
Created attachment 430611 [details]
Patch
Comment 6 Devin Rousso 2021-06-04 14:39:00 PDT
Comment on attachment 430611 [details]
Patch

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

r=me as well :)

> Source/WebKit/WebProcess/WebPage/WebPage.h:2193
> +    bool m_currentSyntheticClickMayBeNonMeaningful { true };

NIT: How about `m_currentSyntheticClickMayNotBeMeaningful`? 😅
Comment 7 Wenson Hsieh 2021-06-04 14:50:10 PDT
(In reply to Devin Rousso from comment #6)
> Comment on attachment 430611 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=430611&action=review
> 
> r=me as well :)
> 
> > Source/WebKit/WebProcess/WebPage/WebPage.h:2193
> > +    bool m_currentSyntheticClickMayBeNonMeaningful { true };
> 
> NIT: How about `m_currentSyntheticClickMayNotBeMeaningful`? 😅

Sure — I don't have a preference for either one, so I'll change it to `m_currentSyntheticClickMayNotBeMeaningful`.
Comment 8 Wenson Hsieh 2021-06-04 14:55:29 PDT
Created attachment 430616 [details]
Renaming
Comment 9 EWS 2021-06-04 17:57:50 PDT
Committed r278515 (238514@main): <https://commits.webkit.org/238514@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 430616 [details].