Bug 215329 - Add quirk to force touch events on mail.yahoo.com
Summary: Add quirk to force touch events on mail.yahoo.com
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Devin Rousso
URL:
Keywords: InRadar
Depends on:
Blocks: 260700
  Show dependency treegraph
 
Reported: 2020-08-10 12:19 PDT by Devin Rousso
Modified: 2023-08-24 23:30 PDT (History)
8 users (show)

See Also:


Attachments
Patch (5.26 KB, patch)
2020-08-10 12:22 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (6.33 KB, patch)
2020-08-10 16:22 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (6.37 KB, patch)
2020-08-10 17:50 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2020-08-10 12:19:46 PDT
<https://mail.yahoo.com/> serves the mobile site even in desktop browsing "mode"
Comment 1 Devin Rousso 2020-08-10 12:20:00 PDT
<rdar://problem/59824469>
Comment 2 Devin Rousso 2020-08-10 12:22:30 PDT
Created attachment 406317 [details]
Patch
Comment 3 Darin Adler 2020-08-10 12:29:09 PDT
Comment on attachment 406317 [details]
Patch

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

> Source/WebCore/page/Quirks.cpp:501
> +    auto& url = m_document->topDocument().url();
> +    auto host = url.host().toString();
> +    if (host.startsWithIgnoringASCIICase("mail.") && topPrivatelyControlledDomain(host).startsWith("yahoo."))
> +        return true;
> +
> +    return false;

Can do this more efficiently like so:

    auto host = m_document->topDocument().url().host();
    return startsWithLettersIgnoringASCIICase(host, "mail.") && topPrivatelyControlledDomain(host.toString()).startsWith("yahoo.");

Also, I think we should write an isYahooMail helper function so we can share this logic with Quirks::shouldAvoidPastingImagesAsWebContent. Also, that uses a data member to cache the result. Should we be doing that here too? Or sharing a single one?
Comment 4 Tim Horton 2020-08-10 12:34:52 PDT
Comment on attachment 406317 [details]
Patch

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

> Source/WebCore/ChangeLog:12
> +        <https://mail.yahoo.com/> serves the mobile site even in desktop browsing "mode".

There's a bit of missing context here: that the mobile site doesn't work well with mouse events in a particular case.

> Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:570
> +#if ENABLE(IOS_TOUCH_EVENTS)
> +    if (mouseEventPolicy == MouseEventPolicy::Default && document->quirks().shouldSynthesizeTouchEvents())
> +        mouseEventPolicy = MouseEventPolicy::SynthesizeTouchEvents;
> +#endif

Is there a reason we can't tuck this away in the DocumentLoader mouseEventPolicy() getter instead?
Comment 5 Devin Rousso 2020-08-10 14:08:10 PDT
Comment on attachment 406317 [details]
Patch

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

>> Source/WebCore/page/Quirks.cpp:501
>> +    return false;
> 
> Can do this more efficiently like so:
> 
>     auto host = m_document->topDocument().url().host();
>     return startsWithLettersIgnoringASCIICase(host, "mail.") && topPrivatelyControlledDomain(host.toString()).startsWith("yahoo.");
> 
> Also, I think we should write an isYahooMail helper function so we can share this logic with Quirks::shouldAvoidPastingImagesAsWebContent. Also, that uses a data member to cache the result. Should we be doing that here too? Or sharing a single one?

A shared function is a good idea I'll do that.

As far as saving this to a variable, I was thinking that this is only called during top-level/frame navigations so it wouldn't happen that often, but perhaps caching it is a good idea.

>> Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:570
>> +#endif
> 
> Is there a reason we can't tuck this away in the DocumentLoader mouseEventPolicy() getter instead?

I was trying to follow what `DocumentLoader::simulatedMouseEventsDispatchPolicy` does, but I think your idea is probably cleaner.  I'll change it.
Comment 6 Devin Rousso 2020-08-10 16:22:08 PDT
Created attachment 406342 [details]
Patch
Comment 7 Devin Rousso 2020-08-10 17:50:43 PDT
Created attachment 406351 [details]
Patch

fix win build
Comment 8 EWS 2020-08-10 18:48:14 PDT
Committed r265485: <https://trac.webkit.org/changeset/265485>

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