Opt some websites into the simulated mouse events dispatch quirk when in modern compa...
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Apr 2019 16:52:35 +0000 (16:52 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Apr 2019 16:52:35 +0000 (16:52 +0000)
commit3f8331c94216842f7e3cbca2de4a7d0d31523bf1
treef835c322f83bacf6d2f6d126572e451b100f8cff
parentc1293c158f37c2ddaa63eb4a93c0c8371639fc51
Opt some websites into the simulated mouse events dispatch quirk when in modern compatibility mode
https://bugs.webkit.org/show_bug.cgi?id=196830
<rdar://problem/49124313>

Reviewed by Wenson Hsieh.

Source/WebCore:

We add a new policy to determine whether simulated mouse events dispatch are allowed and use it to determine whether the
simulated mouse events dispatch quirk can be used for a given website. We then check the domain name for the current page's
document to see if it matches some known websites that require this quirk.

We needed to add some calls into Quirks::shouldDispatchSimulateMouseEvents() where we used to only consult the RuntimeEnabledFeature
flag to ensure we correctly created touch regions for simulated mouse events.

* dom/EventNames.h:
(WebCore::EventNames::isTouchRelatedEventType const):
* dom/Node.cpp:
(WebCore::Node::moveNodeToNewDocument):
(WebCore::tryAddEventListener):
(WebCore::tryRemoveEventListener):
(WebCore::Node::defaultEventHandler):
* loader/DocumentLoader.h:
(WebCore::DocumentLoader::simulatedMouseEventsDispatchPolicy const):
(WebCore::DocumentLoader::setSimulatedMouseEventsDispatchPolicy):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::addEventListener):
(WebCore::DOMWindow::removeEventListener):
* page/Quirks.cpp:
(WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
(WebCore::Quirks::shouldDispatchSimulateMouseEvents const): Deleted.
* page/Quirks.h:

Source/WebKit:

We add a new policy to determine whether simulated mouse events dispatch are allowed.

* Shared/WebsitePoliciesData.cpp:
(WebKit::WebsitePoliciesData::encode const):
(WebKit::WebsitePoliciesData::decode):
(WebKit::WebsitePoliciesData::applyToDocumentLoader):
* Shared/WebsitePoliciesData.h:
* Shared/WebsiteSimulatedMouseEventsDispatchPolicy.h: Added.
* UIProcess/API/APIWebsitePolicies.cpp:
(API::WebsitePolicies::copy const):
(API::WebsitePolicies::data):
* UIProcess/API/APIWebsitePolicies.h:
* WebKit.xcodeproj/project.pbxproj:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244218 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/EventNames.h
Source/WebCore/dom/Node.cpp
Source/WebCore/loader/DocumentLoader.h
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/Quirks.cpp
Source/WebCore/page/Quirks.h
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebsitePoliciesData.cpp
Source/WebKit/Shared/WebsitePoliciesData.h
Source/WebKit/Shared/WebsiteSimulatedMouseEventsDispatchPolicy.h [new file with mode: 0644]
Source/WebKit/UIProcess/API/APIWebsitePolicies.cpp
Source/WebKit/UIProcess/API/APIWebsitePolicies.h
Source/WebKit/WebKit.xcodeproj/project.pbxproj