Title: [244218] trunk/Source
Revision
244218
Author
grao...@webkit.org
Date
2019-04-12 09:52:35 -0700 (Fri, 12 Apr 2019)

Log Message

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:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (244217 => 244218)


--- trunk/Source/WebCore/ChangeLog	2019-04-12 16:11:46 UTC (rev 244217)
+++ trunk/Source/WebCore/ChangeLog	2019-04-12 16:52:35 UTC (rev 244218)
@@ -1,3 +1,36 @@
+2019-04-12  Antoine Quint  <grao...@apple.com>
+
+        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.
+
+        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:
+
 2019-04-11  Simon Fraser  <simon.fra...@apple.com>
 
         [iOS WK2] Wrong scrolling behavior for nested absolute position elements inside overflow scroll

Modified: trunk/Source/WebCore/dom/EventNames.h (244217 => 244218)


--- trunk/Source/WebCore/dom/EventNames.h	2019-04-12 16:11:46 UTC (rev 244217)
+++ trunk/Source/WebCore/dom/EventNames.h	2019-04-12 16:52:35 UTC (rev 244218)
@@ -21,6 +21,8 @@
 
 #pragma once
 
+#include "Document.h"
+#include "Quirks.h"
 #include "ThreadGlobalData.h"
 #include <array>
 #include <functional>
@@ -364,7 +366,7 @@
     // We should choose one term and stick to it.
     bool isWheelEventType(const AtomicString& eventType) const;
     bool isGestureEventType(const AtomicString& eventType) const;
-    bool isTouchRelatedEventType(const AtomicString& eventType) const;
+    bool isTouchRelatedEventType(const Document&, const AtomicString& eventType) const;
     bool isTouchScrollBlockingEventType(const AtomicString& eventType) const;
 #if ENABLE(GAMEPAD)
     bool isGamepadEventType(const AtomicString& eventType) const;
@@ -399,14 +401,15 @@
         || eventType == touchmoveEvent;
 }
 
-inline bool EventNames::isTouchRelatedEventType(const AtomicString& eventType) const
+inline bool EventNames::isTouchRelatedEventType(const Document& document, const AtomicString& eventType) const
 {
 #if ENABLE(TOUCH_EVENTS)
-    if (RuntimeEnabledFeatures::sharedFeatures().mouseEventsSimulationEnabled()) {
+    if (document.quirks().shouldDispatchSimulatedMouseEvents() || RuntimeEnabledFeatures::sharedFeatures().mouseEventsSimulationEnabled()) {
         if (eventType == mousedownEvent || eventType == mousemoveEvent || eventType == mouseupEvent)
             return true;
     }
 #endif
+    UNUSED_PARAM(document);
     return eventType == touchstartEvent
         || eventType == touchmoveEvent
         || eventType == touchendEvent

Modified: trunk/Source/WebCore/dom/Node.cpp (244217 => 244218)


--- trunk/Source/WebCore/dom/Node.cpp	2019-04-12 16:11:46 UTC (rev 244217)
+++ trunk/Source/WebCore/dom/Node.cpp	2019-04-12 16:52:35 UTC (rev 244218)
@@ -2057,7 +2057,7 @@
 
         unsigned numTouchEventListeners = 0;
 #if ENABLE(TOUCH_EVENTS)
-        if (RuntimeEnabledFeatures::sharedFeatures().mouseEventsSimulationEnabled()) {
+        if (newDocument.quirks().shouldDispatchSimulatedMouseEvents() || RuntimeEnabledFeatures::sharedFeatures().mouseEventsSimulationEnabled()) {
             for (auto& name : eventNames().extendedTouchRelatedEventNames())
                 numTouchEventListeners += eventListeners(name).size();
         } else {
@@ -2111,7 +2111,7 @@
     targetNode->document().addListenerTypeIfNeeded(eventType);
     if (eventNames().isWheelEventType(eventType))
         targetNode->document().didAddWheelEventHandler(*targetNode);
-    else if (eventNames().isTouchRelatedEventType(eventType))
+    else if (eventNames().isTouchRelatedEventType(targetNode->document(), eventType))
         targetNode->document().didAddTouchEventHandler(*targetNode);
 
 #if PLATFORM(IOS_FAMILY)
@@ -2126,7 +2126,7 @@
         targetNode->document().domWindow()->addEventListener(eventType, WTFMove(listener), options);
 
 #if ENABLE(TOUCH_EVENTS)
-    if (eventNames().isTouchRelatedEventType(eventType))
+    if (eventNames().isTouchRelatedEventType(targetNode->document(), eventType))
         targetNode->document().addTouchEventListener(*targetNode);
 #endif
 #endif // PLATFORM(IOS_FAMILY)
@@ -2153,7 +2153,7 @@
     // listeners for each type, not just a bool - see https://bugs.webkit.org/show_bug.cgi?id=33861
     if (eventNames().isWheelEventType(eventType))
         targetNode->document().didRemoveWheelEventHandler(*targetNode);
-    else if (eventNames().isTouchRelatedEventType(eventType))
+    else if (eventNames().isTouchRelatedEventType(targetNode->document(), eventType))
         targetNode->document().didRemoveTouchEventHandler(*targetNode);
 
 #if PLATFORM(IOS_FAMILY)
@@ -2167,7 +2167,7 @@
         targetNode->document().domWindow()->removeEventListener(eventType, listener, options);
 
 #if ENABLE(TOUCH_EVENTS)
-    if (eventNames().isTouchRelatedEventType(eventType))
+    if (eventNames().isTouchRelatedEventType(targetNode->document(), eventType))
         targetNode->document().removeTouchEventListener(*targetNode);
 #endif
 #endif // PLATFORM(IOS_FAMILY)
@@ -2463,7 +2463,7 @@
             if (Frame* frame = document().frame())
                 frame->eventHandler().defaultWheelEventHandler(startNode, downcast<WheelEvent>(event));
 #if ENABLE(TOUCH_EVENTS) && PLATFORM(IOS_FAMILY)
-    } else if (is<TouchEvent>(event) && eventNames().isTouchRelatedEventType(eventType)) {
+    } else if (is<TouchEvent>(event) && eventNames().isTouchRelatedEventType(document(), eventType)) {
         RenderObject* renderer = this->renderer();
         while (renderer && (!is<RenderBox>(*renderer) || !downcast<RenderBox>(*renderer).canBeScrolledAndHasScrollableArea()))
             renderer = renderer->parent();

Modified: trunk/Source/WebCore/loader/DocumentLoader.h (244217 => 244218)


--- trunk/Source/WebCore/loader/DocumentLoader.h	2019-04-12 16:11:46 UTC (rev 244217)
+++ trunk/Source/WebCore/loader/DocumentLoader.h	2019-04-12 16:52:35 UTC (rev 244218)
@@ -124,6 +124,12 @@
     Enable
 };
 
+enum class SimulatedMouseEventsDispatchPolicy : uint8_t {
+    Default,
+    Allow,
+    Deny,
+};
+
 class DocumentLoader
     : public RefCounted<DocumentLoader>
     , public FrameDestructionObserver
@@ -301,6 +307,9 @@
     MediaSourcePolicy mediaSourcePolicy() const { return m_mediaSourcePolicy; }
     void setMediaSourcePolicy(MediaSourcePolicy policy) { m_mediaSourcePolicy = policy; }
 
+    SimulatedMouseEventsDispatchPolicy simulatedMouseEventsDispatchPolicy() const { return m_simulatedMouseEventsDispatchPolicy; }
+    void setSimulatedMouseEventsDispatchPolicy(SimulatedMouseEventsDispatchPolicy policy) { m_simulatedMouseEventsDispatchPolicy = policy; }
+
     void addSubresourceLoader(ResourceLoader*);
     void removeSubresourceLoader(LoadCompletionType, ResourceLoader*);
     void addPlugInStreamLoader(ResourceLoader&);
@@ -581,6 +590,7 @@
     PopUpPolicy m_popUpPolicy { PopUpPolicy::Default };
     MetaViewportPolicy m_metaViewportPolicy { MetaViewportPolicy::Default };
     MediaSourcePolicy m_mediaSourcePolicy { MediaSourcePolicy::Default };
+    SimulatedMouseEventsDispatchPolicy m_simulatedMouseEventsDispatchPolicy { SimulatedMouseEventsDispatchPolicy::Default };
 
 #if ENABLE(SERVICE_WORKER)
     Optional<ServiceWorkerRegistrationData> m_serviceWorkerRegistrationData;

Modified: trunk/Source/WebCore/page/DOMWindow.cpp (244217 => 244218)


--- trunk/Source/WebCore/page/DOMWindow.cpp	2019-04-12 16:11:46 UTC (rev 244217)
+++ trunk/Source/WebCore/page/DOMWindow.cpp	2019-04-12 16:52:35 UTC (rev 244218)
@@ -1782,11 +1782,12 @@
     if (!EventTarget::addEventListener(eventType, WTFMove(listener), options))
         return false;
 
-    if (Document* document = this->document()) {
+    auto* document = this->document();
+    if (document) {
         document->addListenerTypeIfNeeded(eventType);
         if (eventNames().isWheelEventType(eventType))
             document->didAddWheelEventHandler(*document);
-        else if (eventNames().isTouchRelatedEventType(eventType))
+        else if (eventNames().isTouchRelatedEventType(*document, eventType))
             document->didAddTouchEventHandler(*document);
         else if (eventType == eventNames().storageEvent)
             didAddStorageEventListener(*this);
@@ -1801,7 +1802,7 @@
         incrementScrollEventListenersCount();
 #endif
 #if ENABLE(IOS_TOUCH_EVENTS)
-    else if (eventNames().isTouchRelatedEventType(eventType))
+    else if (document && eventNames().isTouchRelatedEventType(*document, eventType))
         ++m_touchAndGestureEventListenerCount;
 #endif
 #if ENABLE(IOS_GESTURE_EVENTS)
@@ -2000,10 +2001,11 @@
     if (!EventTarget::removeEventListener(eventType, listener, options.capture))
         return false;
 
-    if (Document* document = this->document()) {
+    auto* document = this->document();
+    if (document) {
         if (eventNames().isWheelEventType(eventType))
             document->didRemoveWheelEventHandler(*document);
-        else if (eventNames().isTouchRelatedEventType(eventType))
+        else if (eventNames().isTouchRelatedEventType(*document, eventType))
             document->didRemoveTouchEventHandler(*document);
     }
 
@@ -2016,7 +2018,7 @@
         decrementScrollEventListenersCount();
 #endif
 #if ENABLE(IOS_TOUCH_EVENTS)
-    else if (eventNames().isTouchRelatedEventType(eventType)) {
+    else if (document && eventNames().isTouchRelatedEventType(*document, eventType)) {
         ASSERT(m_touchAndGestureEventListenerCount > 0);
         --m_touchAndGestureEventListenerCount;
     }

Modified: trunk/Source/WebCore/page/Quirks.cpp (244217 => 244218)


--- trunk/Source/WebCore/page/Quirks.cpp	2019-04-12 16:11:46 UTC (rev 244217)
+++ trunk/Source/WebCore/page/Quirks.cpp	2019-04-12 16:52:35 UTC (rev 244218)
@@ -195,8 +195,36 @@
     return false;
 }
 
-bool Quirks::shouldDispatchSimulateMouseEvents() const
+bool Quirks::shouldDispatchSimulatedMouseEvents() const
 {
+#if PLATFORM(IOS_FAMILY)
+    if (!needsQuirks())
+        return false;
+
+    auto* loader = m_document->loader();
+    if (!loader || loader->simulatedMouseEventsDispatchPolicy() != SimulatedMouseEventsDispatchPolicy::Allow)
+        return false;
+
+    auto& url = ""
+    auto host = url.host();
+
+    if (equalLettersIgnoringASCIICase(host, "amazon.com") || host.endsWithIgnoringASCIICase(".amazon.com"))
+        return true;
+    if (equalLettersIgnoringASCIICase(host, "wix.com") || host.endsWithIgnoringASCIICase(".wix.com"))
+        return true;
+    if (equalLettersIgnoringASCIICase(host, "desmos.com") || host.endsWithIgnoringASCIICase(".desmos.com"))
+        return true;
+    if (equalLettersIgnoringASCIICase(host, "figma.com") || host.endsWithIgnoringASCIICase(".figma.com"))
+        return true;
+    if (equalLettersIgnoringASCIICase(host, "trello.com") || host.endsWithIgnoringASCIICase(".trello.com"))
+        return true;
+    if (equalLettersIgnoringASCIICase(host, "airtable.com") || host.endsWithIgnoringASCIICase(".airtable.com"))
+        return true;
+    if (equalLettersIgnoringASCIICase(host, "maps.google.com"))
+        return true;
+    if (equalLettersIgnoringASCIICase(host, "trailers.apple.com"))
+        return true;
+#endif
     return false;
 }
 

Modified: trunk/Source/WebCore/page/Quirks.h (244217 => 244218)


--- trunk/Source/WebCore/page/Quirks.h	2019-04-12 16:11:46 UTC (rev 244217)
+++ trunk/Source/WebCore/page/Quirks.h	2019-04-12 16:52:35 UTC (rev 244218)
@@ -45,7 +45,7 @@
     bool shouldAutoplayForArbitraryUserGesture() const;
     bool hasBrokenEncryptedMediaAPISupportQuirk() const;
     bool hasWebSQLSupportQuirk() const;
-    bool shouldDispatchSimulateMouseEvents() const;
+    bool shouldDispatchSimulatedMouseEvents() const;
 
     WEBCORE_EXPORT bool isTouchBarUpdateSupressedForHiddenContentEditable() const;
     WEBCORE_EXPORT bool isNeverRichlyEditableForTouchBar() const;

Modified: trunk/Source/WebKit/ChangeLog (244217 => 244218)


--- trunk/Source/WebKit/ChangeLog	2019-04-12 16:11:46 UTC (rev 244217)
+++ trunk/Source/WebKit/ChangeLog	2019-04-12 16:52:35 UTC (rev 244218)
@@ -1,3 +1,25 @@
+2019-04-12  Antoine Quint  <grao...@apple.com>
+
+        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.
+
+        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:
+
 2019-04-12  Chris Dumez  <cdu...@apple.com>
 
         [iOS Sim Debug] ASSERTION FAILED: m_downloads.isEmpty() Layout Test http/tests/websocket/tests/hybi/network-process-crash-error.html is a flaky crash

Modified: trunk/Source/WebKit/Shared/WebsitePoliciesData.cpp (244217 => 244218)


--- trunk/Source/WebKit/Shared/WebsitePoliciesData.cpp	2019-04-12 16:11:46 UTC (rev 244217)
+++ trunk/Source/WebKit/Shared/WebsitePoliciesData.cpp	2019-04-12 16:52:35 UTC (rev 244218)
@@ -48,6 +48,7 @@
     encoder << customNavigatorPlatform;
     encoder << metaViewportPolicy;
     encoder << mediaSourcePolicy;
+    encoder << simulatedMouseEventsDispatchPolicy;
 }
 
 Optional<WebsitePoliciesData> WebsitePoliciesData::decode(IPC::Decoder& decoder)
@@ -112,6 +113,11 @@
     if (!mediaSourcePolicy)
         return WTF::nullopt;
     
+    Optional<WebsiteSimulatedMouseEventsDispatchPolicy> simulatedMouseEventsDispatchPolicy;
+    decoder >> simulatedMouseEventsDispatchPolicy;
+    if (!simulatedMouseEventsDispatchPolicy)
+        return WTF::nullopt;
+
     return { {
         WTFMove(*contentBlockersEnabled),
         WTFMove(*allowedAutoplayQuirks),
@@ -125,6 +131,7 @@
         WTFMove(*customNavigatorPlatform),
         WTFMove(*metaViewportPolicy),
         WTFMove(*mediaSourcePolicy),
+        WTFMove(*simulatedMouseEventsDispatchPolicy),
     } };
 }
 
@@ -208,6 +215,25 @@
         break;
     }
 
+    switch (websitePolicies.simulatedMouseEventsDispatchPolicy) {
+    case WebsiteSimulatedMouseEventsDispatchPolicy::Default:
+        documentLoader.setSimulatedMouseEventsDispatchPolicy(WebCore::SimulatedMouseEventsDispatchPolicy::Default);
+        break;
+    case WebsiteSimulatedMouseEventsDispatchPolicy::Allow:
+        documentLoader.setSimulatedMouseEventsDispatchPolicy(WebCore::SimulatedMouseEventsDispatchPolicy::Allow);
+        break;
+    case WebsiteSimulatedMouseEventsDispatchPolicy::Deny:
+        documentLoader.setSimulatedMouseEventsDispatchPolicy(WebCore::SimulatedMouseEventsDispatchPolicy::Deny);
+        break;
+    }
+
+    if (websitePolicies.websiteDataStoreParameters) {
+        if (auto* frame = documentLoader.frame()) {
+            if (auto* page = frame->page())
+                page->setSessionID(websitePolicies.websiteDataStoreParameters->networkSessionParameters.sessionID);
+        }
+    }
+
     auto* frame = documentLoader.frame();
     if (!frame)
         return;

Modified: trunk/Source/WebKit/Shared/WebsitePoliciesData.h (244217 => 244218)


--- trunk/Source/WebKit/Shared/WebsitePoliciesData.h	2019-04-12 16:11:46 UTC (rev 244217)
+++ trunk/Source/WebKit/Shared/WebsitePoliciesData.h	2019-04-12 16:52:35 UTC (rev 244218)
@@ -31,6 +31,7 @@
 #include "WebsiteMediaSourcePolicy.h"
 #include "WebsiteMetaViewportPolicy.h"
 #include "WebsitePopUpPolicy.h"
+#include "WebsiteSimulatedMouseEventsDispatchPolicy.h"
 #include <WebCore/HTTPHeaderField.h>
 #include <wtf/OptionSet.h>
 
@@ -60,6 +61,7 @@
     String customNavigatorPlatform;
     WebsiteMetaViewportPolicy metaViewportPolicy { WebsiteMetaViewportPolicy::Default };
     WebsiteMediaSourcePolicy mediaSourcePolicy { WebsiteMediaSourcePolicy::Default };
+    WebsiteSimulatedMouseEventsDispatchPolicy simulatedMouseEventsDispatchPolicy { WebsiteSimulatedMouseEventsDispatchPolicy::Default };
 
     void encode(IPC::Encoder&) const;
     static Optional<WebsitePoliciesData> decode(IPC::Decoder&);

Copied: trunk/Source/WebKit/Shared/WebsiteSimulatedMouseEventsDispatchPolicy.h (from rev 244217, trunk/Source/WebCore/page/Quirks.h) (0 => 244218)


--- trunk/Source/WebKit/Shared/WebsiteSimulatedMouseEventsDispatchPolicy.h	                        (rev 0)
+++ trunk/Source/WebKit/Shared/WebsiteSimulatedMouseEventsDispatchPolicy.h	2019-04-12 16:52:35 UTC (rev 244218)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <wtf/Forward.h>
+
+namespace WebKit {
+    
+enum class WebsiteSimulatedMouseEventsDispatchPolicy : uint8_t {
+    Default,
+    Allow,
+    Deny,
+};
+
+}
+
+namespace WTF {
+
+template<> struct EnumTraits<WebKit::WebsiteSimulatedMouseEventsDispatchPolicy> {
+    using values = EnumValues<
+    WebKit::WebsiteSimulatedMouseEventsDispatchPolicy,
+    WebKit::WebsiteSimulatedMouseEventsDispatchPolicy::Default,
+    WebKit::WebsiteSimulatedMouseEventsDispatchPolicy::Allow,
+    WebKit::WebsiteSimulatedMouseEventsDispatchPolicy::Deny
+    >;
+};
+
+} // namespace WTF

Modified: trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.cpp (244217 => 244218)


--- trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.cpp	2019-04-12 16:11:46 UTC (rev 244217)
+++ trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.cpp	2019-04-12 16:52:35 UTC (rev 244218)
@@ -56,6 +56,7 @@
     policies->setCustomNavigatorPlatform(m_customNavigatorPlatform);
     policies->setPreferredCompatibilityMode(m_preferredCompatibilityMode);
     policies->setMetaViewportPolicy(m_metaViewportPolicy);
+    policies->setSimulatedMouseEventsDispatchPolicy(m_simulatedMouseEventsDispatchPolicy);
     Vector<WebCore::HTTPHeaderField> customHeaderFields;
     customHeaderFields.reserveInitialCapacity(m_customHeaderFields.size());
     for (auto& field : m_customHeaderFields)
@@ -87,7 +88,8 @@
         m_customJavaScriptUserAgentAsSiteSpecificQuirks,
         m_customNavigatorPlatform,
         m_metaViewportPolicy,
-        m_mediaSourcePolicy
+        m_mediaSourcePolicy,
+        m_simulatedMouseEventsDispatchPolicy,
     };
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.h (244217 => 244218)


--- trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.h	2019-04-12 16:11:46 UTC (rev 244217)
+++ trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.h	2019-04-12 16:52:35 UTC (rev 244218)
@@ -32,6 +32,7 @@
 #include "WebsiteMediaSourcePolicy.h"
 #include "WebsiteMetaViewportPolicy.h"
 #include "WebsitePopUpPolicy.h"
+#include "WebsiteSimulatedMouseEventsDispatchPolicy.h"
 #include <WebCore/HTTPHeaderField.h>
 #include <wtf/OptionSet.h>
 #include <wtf/Vector.h>
@@ -94,6 +95,9 @@
     WebKit::WebsiteMediaSourcePolicy mediaSourcePolicy() const { return m_mediaSourcePolicy; }
     void setMediaSourcePolicy(WebKit::WebsiteMediaSourcePolicy policy) { m_mediaSourcePolicy = policy; }
 
+    WebKit::WebsiteSimulatedMouseEventsDispatchPolicy simulatedMouseEventsDispatchPolicy() const { return m_simulatedMouseEventsDispatchPolicy; }
+    void setSimulatedMouseEventsDispatchPolicy(WebKit::WebsiteSimulatedMouseEventsDispatchPolicy policy) { m_simulatedMouseEventsDispatchPolicy = policy; }
+
 private:
     WebsitePolicies(bool contentBlockersEnabled, OptionSet<WebKit::WebsiteAutoplayQuirk>, WebKit::WebsiteAutoplayPolicy, Vector<WebCore::HTTPHeaderField>&&, WebKit::WebsitePopUpPolicy, RefPtr<WebsiteDataStore>&&);
 
@@ -110,6 +114,7 @@
     WebKit::WebCompatibilityMode m_preferredCompatibilityMode { WebKit::WebCompatibilityMode::Default };
     WebKit::WebsiteMetaViewportPolicy m_metaViewportPolicy { WebKit::WebsiteMetaViewportPolicy::Default };
     WebKit::WebsiteMediaSourcePolicy m_mediaSourcePolicy { WebKit::WebsiteMediaSourcePolicy::Default };
+    WebKit::WebsiteSimulatedMouseEventsDispatchPolicy m_simulatedMouseEventsDispatchPolicy { WebKit::WebsiteSimulatedMouseEventsDispatchPolicy::Default };
 };
 
 } // namespace API

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (244217 => 244218)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2019-04-12 16:11:46 UTC (rev 244217)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2019-04-12 16:52:35 UTC (rev 244218)
@@ -1111,6 +1111,7 @@
 		6BE969CB1E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BE969C91E54D4CF008B7483 /* ResourceLoadStatisticsClassifierCocoa.h */; };
 		6BE969CD1E54E054008B7483 /* ResourceLoadStatisticsClassifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 6BE969CC1E54E054008B7483 /* ResourceLoadStatisticsClassifier.h */; };
 		6EE849C81368D9390038D481 /* WKInspectorPrivateMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EE849C61368D92D0038D481 /* WKInspectorPrivateMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		71FB810B2260627E00323677 /* WebsiteSimulatedMouseEventsDispatchPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 71FB810A2260627A00323677 /* WebsiteSimulatedMouseEventsDispatchPolicy.h */; };
 		728E86F11795188C0087879E /* WebColorPickerMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 728E86EF1795188C0087879E /* WebColorPickerMac.h */; };
 		75A8D2C8187CCFAB00C39C9E /* WKWebsiteDataStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 75A8D2C4187CCF9F00C39C9E /* WKWebsiteDataStore.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		75A8D2D6187D1C0E00C39C9E /* WKWebsiteDataStoreInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 75A8D2D4187D1C0100C39C9E /* WKWebsiteDataStoreInternal.h */; };
@@ -3573,6 +3574,7 @@
 		6BE969CC1E54E054008B7483 /* ResourceLoadStatisticsClassifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadStatisticsClassifier.h; sourceTree = "<group>"; };
 		6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = com.apple.WebProcess.sb.in; path = WebProcess/com.apple.WebProcess.sb.in; sourceTree = "<group>"; };
 		6EE849C61368D92D0038D481 /* WKInspectorPrivateMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKInspectorPrivateMac.h; path = mac/WKInspectorPrivateMac.h; sourceTree = "<group>"; };
+		71FB810A2260627A00323677 /* WebsiteSimulatedMouseEventsDispatchPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsiteSimulatedMouseEventsDispatchPolicy.h; sourceTree = "<group>"; };
 		728E86EF1795188C0087879E /* WebColorPickerMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebColorPickerMac.h; sourceTree = "<group>"; };
 		728E86F01795188C0087879E /* WebColorPickerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebColorPickerMac.mm; sourceTree = "<group>"; };
 		75A8D2C4187CCF9F00C39C9E /* WKWebsiteDataStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebsiteDataStore.h; sourceTree = "<group>"; };
@@ -5242,6 +5244,7 @@
 				5C3AEA8E1FE1F1DF002318D3 /* WebsitePoliciesData.cpp */,
 				5C13024A1FE341A7000D9B31 /* WebsitePoliciesData.h */,
 				0EDE85022004E74900030560 /* WebsitePopUpPolicy.h */,
+				71FB810A2260627A00323677 /* WebsiteSimulatedMouseEventsDispatchPolicy.h */,
 				8360349D1ACB34D600626549 /* WebSQLiteDatabaseTracker.cpp */,
 				8360349E1ACB34D600626549 /* WebSQLiteDatabaseTracker.h */,
 				C0337DD7127A51B6008FF4F4 /* WebTouchEvent.cpp */,
@@ -9715,6 +9718,7 @@
 				F4CB09E5225D5A0900891487 /* WebsiteMediaSourcePolicy.h in Headers */,
 				F430E9422247335F005FE053 /* WebsiteMetaViewportPolicy.h in Headers */,
 				0EDE85032004E75D00030560 /* WebsitePopUpPolicy.h in Headers */,
+				71FB810B2260627E00323677 /* WebsiteSimulatedMouseEventsDispatchPolicy.h in Headers */,
 				C149380922347104000CD707 /* WebSpeechSynthesisClient.h in Headers */,
 				836034A01ACB34D600626549 /* WebSQLiteDatabaseTracker.h in Headers */,
 				1A52C0F81A38CDC70016160A /* WebStorageNamespaceProvider.h in Headers */,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to