Bug 226775 - [iOS] Safari tab pill should toggle visibility when tapping on article text on adventure.com
Summary: [iOS] Safari tab pill should toggle visibility when tapping on article text o...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Wenson Hsieh
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-06-08 12:38 PDT by Wenson Hsieh
Modified: 2021-06-08 16:30 PDT (History)
5 users (show)

See Also:


Attachments
Patch (13.78 KB, patch)
2021-06-08 12:46 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff
Small adjustment (13.83 KB, patch)
2021-06-08 13:45 PDT, Wenson Hsieh
thorton: review+
Details | Formatted Diff | Diff
Patch for landing (13.84 KB, patch)
2021-06-08 14:23 PDT, Wenson Hsieh
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wenson Hsieh 2021-06-08 12:38:16 PDT
rdar://78826820
Comment 1 Wenson Hsieh 2021-06-08 12:46:01 PDT Comment hidden (obsolete)
Comment 2 Wenson Hsieh 2021-06-08 13:45:39 PDT
Created attachment 430885 [details]
Small adjustment
Comment 3 Devin Rousso 2021-06-08 13:53:49 PDT
Comment on attachment 430885 [details]
Small adjustment

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

r=me as well :)

> Source/WebKit/ChangeLog:9
> +        Adjust the meaningful click heuristic to account for click event listeners added to the document node. See below

Do we also want to consider if the event listener was added to the `document.documentElement` or `window`?

> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:845
> +    if (is<HTMLBodyElement>(clickNode) || clickNode.isDocumentNode())

NIT: `is<Document>(clickNode)`

> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:1700
> +    auto frame = makeRefPtr(node.document().frame());

Is it actually necessary/desirable to keep `frame` alive for the lifetime of this function?  My understanding of the "rules" regarding this is that since `Frame::view` is a simple getter it's not necessary to keep the `frame` alive (this is also true for `FrameDestructionObserver::frame`).

> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:1735
> +    auto frame = makeRefPtr(node.document().frame());

ditto (:1700)

> LayoutTests/fast/events/ios/non-meaningful-click-when-tapping-document.html:6
> +body, html {

NIT: Is this actually necessary?
Comment 4 Wenson Hsieh 2021-06-08 14:22:02 PDT
Comment on attachment 430885 [details]
Small adjustment

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

>> Source/WebKit/ChangeLog:9
>> +        Adjust the meaningful click heuristic to account for click event listeners added to the document node. See below
> 
> Do we also want to consider if the event listener was added to the `document.documentElement` or `window`?

Good point — I'll a check for the documentElement(). However, we don't seem to dispatch synthetic clicks in the case where the click event listener is added on `window`...

>> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:845
>> +    if (is<HTMLBodyElement>(clickNode) || clickNode.isDocumentNode())
> 
> NIT: `is<Document>(clickNode)`

Sure.

>> Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:1700
>> +    auto frame = makeRefPtr(node.document().frame());
> 
> Is it actually necessary/desirable to keep `frame` alive for the lifetime of this function?  My understanding of the "rules" regarding this is that since `Frame::view` is a simple getter it's not necessary to keep the `frame` alive (this is also true for `FrameDestructionObserver::frame`).

My understanding is that it's considered better practice to use smart pointers to hold on to RefCounted objects in local variables, even if it's only being called with trivial getters.

>> LayoutTests/fast/events/ios/non-meaningful-click-when-tapping-document.html:6
>> +body, html {
> 
> NIT: Is this actually necessary?

Not all of them - just width and height. I'll remove the other properties, I suppose.
Comment 5 Wenson Hsieh 2021-06-08 14:23:01 PDT
Created attachment 430891 [details]
Patch for landing
Comment 6 EWS 2021-06-08 16:30:29 PDT
Committed r278633 (238616@main): <https://commits.webkit.org/238616@main>

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