- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
// https://github.com/WebKit/WebKit/blob/31b77296cf6d85c40313812d9f65a003cf41f440/Source/WebCore/page/Quirks.cpp#L330
bool Quirks::isGoogleMaps() const
{
auto& url = m_document->topDocument().url();
return topPrivatelyControlledDomain(url.host().toString()).startsWith("google.") && url.path().startsWithIgnoringASCIICase("/maps/");
}
bool Quirks::shouldDispatchSimulatedMouseEvents() const
{
if (RuntimeEnabledFeatures::sharedFeatures().mouseEventsSimulationEnabled())
return true;
if (!needsQuirks())
return false;
auto doShouldDispatchChecks = [this] () -> bool {
auto* loader = m_document->loader();
if (!loader || loader->simulatedMouseEventsDispatchPolicy() != SimulatedMouseEventsDispatchPolicy::Allow)
return false;
if (isAmazon())
return true;
if (isGoogleMaps())
return true;
auto& url = m_document->topDocument().url();
auto host = url.host().convertToASCIILowercase();
if (host == "wix.com" || host.endsWith(".wix.com")) {
// Disable simulated mouse dispatching for template selection.
return !url.path().startsWithIgnoringASCIICase("/website/templates/");
}
if ((host == "desmos.com" || host.endsWith(".desmos.com")) && url.path().startsWithIgnoringASCIICase("/calculator/"))
return true;
if (host == "figma.com" || host.endsWith(".figma.com"))
return true;
if (host == "trello.com" || host.endsWith(".trello.com"))
return true;
if (host == "airtable.com" || host.endsWith(".airtable.com"))
return true;
if (host == "msn.com" || host.endsWith(".msn.com"))
return true;
if (host == "flipkart.com" || host.endsWith(".flipkart.com"))
return true;
if (host == "iqiyi.com" || host.endsWith(".iqiyi.com"))
return true;
if (host == "trailers.apple.com")
return true;
if (host == "soundcloud.com")
return true;
if (host == "naver.com")
return true;
if (host == "nba.com" || host.endsWith(".nba.com"))
return true;
if (host.endsWith(".naver.com")) {
// Disable the quirk for tv.naver.com subdomain to be able to simulate hover on videos.
if (host == "tv.naver.com")
return false;
// Disable the quirk for mail.naver.com subdomain to be able to tap on mail subjects.
if (host == "mail.naver.com")
return false;
// Disable the quirk on the mobile site.
// FIXME: Maybe this quirk should be disabled for "m." subdomains on all sites? These are generally mobile sites that don't need mouse events.
if (host == "m.naver.com")
return false;
return true;
}
return false;
};
if (!m_shouldDispatchSimulatedMouseEventsQuirk)
m_shouldDispatchSimulatedMouseEventsQuirk = doShouldDispatchChecks();
return *m_shouldDispatchSimulatedMouseEventsQuirk;
}