Add a website policy to disable the legacy -webkit-overflow-scrolling:touch behavior
https://bugs.webkit.org/show_bug.cgi?id=197943
<rdar://problem/49078202>

Reviewed by Brent Fulgham.

Source/WebCore:

Tests: fast/scrolling/ipad/overflow-scrolling-touch-enabled-stacking-modern-compatibility-mode.html
       platform/ipad/fast/css/webkit-overflow-scrolling-parsing-modern-compatibility-mode.html

* css/parser/CSSParserContext.cpp:
(WebCore::CSSParserContext::CSSParserContext):
* loader/DocumentLoader.h:
(WebCore::DocumentLoader::legacyOverflowScrollingTouchPolicy const):
(WebCore::DocumentLoader::setLegacyOverflowScrollingTouchPolicy):

Source/WebKit:

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

LayoutTests:

* fast/scrolling/ipad/overflow-scrolling-touch-enabled-stacking-modern-compatibility-mode-expected.html: Added.
* fast/scrolling/ipad/overflow-scrolling-touch-enabled-stacking-modern-compatibility-mode.html: Added.
* platform/ipad/fast/css/webkit-overflow-scrolling-parsing-modern-compatibility-mode-expected.txt: Added.
* platform/ipad/fast/css/webkit-overflow-scrolling-parsing-modern-compatibility-mode.html: Added.
* platform/ios/TestExpectations: Skip the new tests since they depend on code in WebKitAdditions.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@245483 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 3f60e38..c1d7ed1 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2019-05-17  Antoine Quint  <graouts@apple.com>
+
+        Add a website policy to disable the legacy -webkit-overflow-scrolling:touch behavior
+        https://bugs.webkit.org/show_bug.cgi?id=197943
+        <rdar://problem/49078202>
+
+        Reviewed by Brent Fulgham.
+
+        * fast/scrolling/ipad/overflow-scrolling-touch-enabled-stacking-modern-compatibility-mode-expected.html: Added.
+        * fast/scrolling/ipad/overflow-scrolling-touch-enabled-stacking-modern-compatibility-mode.html: Added.
+        * platform/ipad/fast/css/webkit-overflow-scrolling-parsing-modern-compatibility-mode-expected.txt: Added.
+        * platform/ipad/fast/css/webkit-overflow-scrolling-parsing-modern-compatibility-mode.html: Added.
+        * platform/ios/TestExpectations: Skip the new tests since they depend on code in WebKitAdditions.
+
 2019-05-17  Rob Buis  <rbuis@igalia.com>
 
         Implement imagesrcset and imagesizes attributes on link rel=preload
diff --git a/LayoutTests/fast/scrolling/ipad/overflow-scrolling-touch-enabled-stacking-modern-compatibility-mode-expected.html b/LayoutTests/fast/scrolling/ipad/overflow-scrolling-touch-enabled-stacking-modern-compatibility-mode-expected.html
new file mode 100644
index 0000000..256b1d4
--- /dev/null
+++ b/LayoutTests/fast/scrolling/ipad/overflow-scrolling-touch-enabled-stacking-modern-compatibility-mode-expected.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ shouldUseModernCompatibilityMode=true internal:AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+    <style>
+        .box {
+            position: absolute;
+            height: 200px;
+            width: 200px;
+            background-color: blue;
+        }
+        
+        .scroller {
+            margin: 60px;
+            overflow: scroll;
+            border: 1px solid black;
+            width: 220px;
+            height: 220px;
+        }
+        
+        .scrolled-contents {
+            height: 1000px;
+        }
+        
+        .outside {
+            z-index: 1;
+            top: 20px;
+            left: 20px;
+            background-color: green;
+        }
+        
+        .back {
+            z-index: 0;
+        }
+        
+        .front {
+            z-index: 2;
+            top: 120px;
+            left: 120px;
+            background-color: orange;
+        }
+    </style>
+</head>
+<body>
+    <div class="outside box"></div>
+    <div class="scroller">
+        <div class="scrolled-contents">
+            <div class="back box"></div>
+            <div class="front box"></div>
+        </div>
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/fast/scrolling/ipad/overflow-scrolling-touch-enabled-stacking-modern-compatibility-mode.html b/LayoutTests/fast/scrolling/ipad/overflow-scrolling-touch-enabled-stacking-modern-compatibility-mode.html
new file mode 100644
index 0000000..619b7e4
--- /dev/null
+++ b/LayoutTests/fast/scrolling/ipad/overflow-scrolling-touch-enabled-stacking-modern-compatibility-mode.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ shouldUseModernCompatibilityMode=true internal:AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+    <style>
+        .box {
+            position: absolute;
+            height: 200px;
+            width: 200px;
+            background-color: blue;
+        }
+        
+        .scroller {
+            margin: 60px;
+            overflow: scroll;
+            border: 1px solid black;
+            width: 220px;
+            height: 220px;
+            -webkit-overflow-scrolling: touch;
+        }
+        
+        .scrolled-contents {
+            height: 1000px;
+        }
+        
+        .outside {
+            z-index: 1;
+            top: 20px;
+            left: 20px;
+            background-color: green;
+        }
+        
+        .back {
+            z-index: 0;
+        }
+        
+        .front {
+            z-index: 2;
+            top: 120px;
+            left: 120px;
+            background-color: orange;
+        }
+    </style>
+</head>
+<body>
+    <div class="outside box"></div>
+    <div class="scroller">
+        <div class="scrolled-contents">
+            <div class="back box"></div>
+            <div class="front box"></div>
+        </div>
+    </div>
+</body>
+</html>
diff --git a/LayoutTests/platform/ios/TestExpectations b/LayoutTests/platform/ios/TestExpectations
index bc80d12..b5bf208 100644
--- a/LayoutTests/platform/ios/TestExpectations
+++ b/LayoutTests/platform/ios/TestExpectations
@@ -3265,6 +3265,10 @@
 # FIXME: Unskip the following test once we have the fix for <rdar://problem/50596032>.
 fast/events/ios/submit-form-target-blank-using-return-key.html
 
+# These tests depend on the implementation of "modern compatibility mode" in WebKitAdditions.
+platform/ipad/fast/css/webkit-overflow-scrolling-parsing-modern-compatibility-mode.html [ Skip ]
+fast/scrolling/ipad/overflow-scrolling-touch-enabled-stacking-modern-compatibility-mode.html [ Skip ]
+
 webkit.org/b/197778 [ Debug ] webgl/2.0.0/conformance2/attribs/gl-vertexattribipointer.html [ Slow ]
 
 # Was unskipped, but now has missing results in iOS . Skipping on iOS only.
diff --git a/LayoutTests/platform/ipad/fast/css/webkit-overflow-scrolling-parsing-modern-compatibility-mode-expected.txt b/LayoutTests/platform/ipad/fast/css/webkit-overflow-scrolling-parsing-modern-compatibility-mode-expected.txt
new file mode 100644
index 0000000..fc8636f
--- /dev/null
+++ b/LayoutTests/platform/ipad/fast/css/webkit-overflow-scrolling-parsing-modern-compatibility-mode-expected.txt
@@ -0,0 +1,12 @@
+This tests checks parsing of the '-webkit-overflow-scrolling' property.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS test("-webkit-overflow-scrolling: auto", "-webkit-overflow-scrolling") is ""
+PASS test("-webkit-overflow-scrolling: banana", "-webkit-overflow-scrolling") is ""
+PASS test("-webkit-overflow-scrolling: touch", "-webkit-overflow-scrolling") is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/ipad/fast/css/webkit-overflow-scrolling-parsing-modern-compatibility-mode.html b/LayoutTests/platform/ipad/fast/css/webkit-overflow-scrolling-parsing-modern-compatibility-mode.html
new file mode 100644
index 0000000..dfca2a1
--- /dev/null
+++ b/LayoutTests/platform/ipad/fast/css/webkit-overflow-scrolling-parsing-modern-compatibility-mode.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ shouldUseModernCompatibilityMode=true ] -->
+<html>
+<head>
+<script src="../../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("This tests checks parsing of the '-webkit-overflow-scrolling' property.");
+
+function test(declaration, property)
+{
+    var div = document.createElement("div");
+    div.setAttribute("style", declaration);
+    document.body.appendChild(div);
+    
+    var result = div.style.getPropertyValue(property);
+    document.body.removeChild(div);
+    return result;
+}
+
+shouldBe('test("-webkit-overflow-scrolling: auto", "-webkit-overflow-scrolling")', '""');
+shouldBe('test("-webkit-overflow-scrolling: banana", "-webkit-overflow-scrolling")', '""');
+shouldBe('test("-webkit-overflow-scrolling: touch", "-webkit-overflow-scrolling")', '""');
+
+var successfullyParsed = true;
+</script>
+<script src="../../../../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 8e56b4c..c27503d 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2019-05-17  Antoine Quint  <graouts@apple.com>
+
+        Add a website policy to disable the legacy -webkit-overflow-scrolling:touch behavior
+        https://bugs.webkit.org/show_bug.cgi?id=197943
+        <rdar://problem/49078202>
+
+        Reviewed by Brent Fulgham.
+
+        Tests: fast/scrolling/ipad/overflow-scrolling-touch-enabled-stacking-modern-compatibility-mode.html
+               platform/ipad/fast/css/webkit-overflow-scrolling-parsing-modern-compatibility-mode.html
+
+        * css/parser/CSSParserContext.cpp:
+        (WebCore::CSSParserContext::CSSParserContext):
+        * loader/DocumentLoader.h:
+        (WebCore::DocumentLoader::legacyOverflowScrollingTouchPolicy const):
+        (WebCore::DocumentLoader::setLegacyOverflowScrollingTouchPolicy):
+
 2019-05-17  Alex Christensen  <achristensen@webkit.org>
 
         Add SPI to set a list of hosts to which to send custom header fields cross-origin
diff --git a/Source/WebCore/css/parser/CSSParserContext.cpp b/Source/WebCore/css/parser/CSSParserContext.cpp
index 29f231c4..7537188 100644
--- a/Source/WebCore/css/parser/CSSParserContext.cpp
+++ b/Source/WebCore/css/parser/CSSParserContext.cpp
@@ -27,6 +27,7 @@
 #include "CSSParserContext.h"
 
 #include "Document.h"
+#include "DocumentLoader.h"
 #include "Page.h"
 #include "RuntimeEnabledFeatures.h"
 #include "Settings.h"
@@ -60,6 +61,12 @@
 #endif
 #if ENABLE(OVERFLOW_SCROLLING_TOUCH)
     legacyOverflowScrollingTouchEnabled = document.settings().legacyOverflowScrollingTouchEnabled();
+    // The legacy -webkit-overflow-scrolling: touch behavior may have been disabled through the website policy,
+    // in that case we want to disable the legacy behavior regardless of what the setting says.
+    if (auto* loader = document.loader()) {
+        if (loader->legacyOverflowScrollingTouchPolicy() == LegacyOverflowScrollingTouchPolicy::Disable)
+            legacyOverflowScrollingTouchEnabled = false;
+    }
 #endif
     springTimingFunctionEnabled = document.settings().springTimingFunctionEnabled();
     constantPropertiesEnabled = document.settings().constantPropertiesEnabled();
diff --git a/Source/WebCore/loader/DocumentLoader.h b/Source/WebCore/loader/DocumentLoader.h
index 22cf1ce..59acb7e 100644
--- a/Source/WebCore/loader/DocumentLoader.h
+++ b/Source/WebCore/loader/DocumentLoader.h
@@ -131,6 +131,12 @@
     Deny,
 };
 
+enum class LegacyOverflowScrollingTouchPolicy : uint8_t {
+    Default,
+    Disable,
+    Enable,
+};
+
 class DocumentLoader
     : public RefCounted<DocumentLoader>
     , public FrameDestructionObserver
@@ -313,6 +319,9 @@
     SimulatedMouseEventsDispatchPolicy simulatedMouseEventsDispatchPolicy() const { return m_simulatedMouseEventsDispatchPolicy; }
     void setSimulatedMouseEventsDispatchPolicy(SimulatedMouseEventsDispatchPolicy policy) { m_simulatedMouseEventsDispatchPolicy = policy; }
 
+    LegacyOverflowScrollingTouchPolicy legacyOverflowScrollingTouchPolicy() const { return m_legacyOverflowScrollingTouchPolicy; }
+    void setLegacyOverflowScrollingTouchPolicy(LegacyOverflowScrollingTouchPolicy policy) { m_legacyOverflowScrollingTouchPolicy = policy; }
+
     void addSubresourceLoader(ResourceLoader*);
     void removeSubresourceLoader(LoadCompletionType, ResourceLoader*);
     void addPlugInStreamLoader(ResourceLoader&);
@@ -596,6 +605,7 @@
     MetaViewportPolicy m_metaViewportPolicy { MetaViewportPolicy::Default };
     MediaSourcePolicy m_mediaSourcePolicy { MediaSourcePolicy::Default };
     SimulatedMouseEventsDispatchPolicy m_simulatedMouseEventsDispatchPolicy { SimulatedMouseEventsDispatchPolicy::Default };
+    LegacyOverflowScrollingTouchPolicy m_legacyOverflowScrollingTouchPolicy { LegacyOverflowScrollingTouchPolicy::Default };
 
 #if ENABLE(SERVICE_WORKER)
     Optional<ServiceWorkerRegistrationData> m_serviceWorkerRegistrationData;
diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog
index 3b7642c..3fd28e9 100644
--- a/Source/WebKit/ChangeLog
+++ b/Source/WebKit/ChangeLog
@@ -1,3 +1,23 @@
+2019-05-17  Antoine Quint  <graouts@apple.com>
+
+        Add a website policy to disable the legacy -webkit-overflow-scrolling:touch behavior
+        https://bugs.webkit.org/show_bug.cgi?id=197943
+        <rdar://problem/49078202>
+
+        Reviewed by Brent Fulgham.
+
+        * Shared/WebsiteLegacyOverflowScrollingTouchPolicy.h: Added.
+        * Shared/WebsitePoliciesData.cpp:
+        (WebKit::WebsitePoliciesData::encode const):
+        (WebKit::WebsitePoliciesData::decode):
+        (WebKit::WebsitePoliciesData::applyToDocumentLoader):
+        * Shared/WebsitePoliciesData.h:
+        * UIProcess/API/APIWebsitePolicies.cpp:
+        (API::WebsitePolicies::copy const):
+        (API::WebsitePolicies::data):
+        * UIProcess/API/APIWebsitePolicies.h:
+        * WebKit.xcodeproj/project.pbxproj:
+
 2019-05-17  Alex Christensen  <achristensen@webkit.org>
 
         Add SPI to set a list of hosts to which to send custom header fields cross-origin
diff --git a/Source/WebKit/Shared/WebsiteLegacyOverflowScrollingTouchPolicy.h b/Source/WebKit/Shared/WebsiteLegacyOverflowScrollingTouchPolicy.h
new file mode 100644
index 0000000..e0d26dd
--- /dev/null
+++ b/Source/WebKit/Shared/WebsiteLegacyOverflowScrollingTouchPolicy.h
@@ -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 WebsiteLegacyOverflowScrollingTouchPolicy : uint8_t {
+    Default,
+    Disable,
+    Enable
+};
+
+}
+
+namespace WTF {
+
+template<> struct EnumTraits<WebKit::WebsiteLegacyOverflowScrollingTouchPolicy> {
+    using values = EnumValues<
+    WebKit::WebsiteLegacyOverflowScrollingTouchPolicy,
+    WebKit::WebsiteLegacyOverflowScrollingTouchPolicy::Default,
+    WebKit::WebsiteLegacyOverflowScrollingTouchPolicy::Disable,
+    WebKit::WebsiteLegacyOverflowScrollingTouchPolicy::Enable
+    >;
+};
+
+} // namespace WTF
diff --git a/Source/WebKit/Shared/WebsitePoliciesData.cpp b/Source/WebKit/Shared/WebsitePoliciesData.cpp
index f53776a..464b894 100644
--- a/Source/WebKit/Shared/WebsitePoliciesData.cpp
+++ b/Source/WebKit/Shared/WebsitePoliciesData.cpp
@@ -52,6 +52,7 @@
     encoder << metaViewportPolicy;
     encoder << mediaSourcePolicy;
     encoder << simulatedMouseEventsDispatchPolicy;
+    encoder << legacyOverflowScrollingTouchPolicy;
 }
 
 Optional<WebsitePoliciesData> WebsitePoliciesData::decode(IPC::Decoder& decoder)
@@ -123,6 +124,11 @@
     if (!simulatedMouseEventsDispatchPolicy)
         return WTF::nullopt;
 
+    Optional<WebsiteLegacyOverflowScrollingTouchPolicy> legacyOverflowScrollingTouchPolicy;
+    decoder >> legacyOverflowScrollingTouchPolicy;
+    if (!legacyOverflowScrollingTouchPolicy)
+        return WTF::nullopt;
+
     return { {
         WTFMove(*contentBlockersEnabled),
         WTFMove(*allowedAutoplayQuirks),
@@ -139,6 +145,7 @@
         WTFMove(*metaViewportPolicy),
         WTFMove(*mediaSourcePolicy),
         WTFMove(*simulatedMouseEventsDispatchPolicy),
+        WTFMove(*legacyOverflowScrollingTouchPolicy),
     } };
 }
 
@@ -237,6 +244,18 @@
         break;
     }
 
+    switch (websitePolicies.legacyOverflowScrollingTouchPolicy) {
+    case WebsiteLegacyOverflowScrollingTouchPolicy::Default:
+        documentLoader.setLegacyOverflowScrollingTouchPolicy(WebCore::LegacyOverflowScrollingTouchPolicy::Default);
+        break;
+    case WebsiteLegacyOverflowScrollingTouchPolicy::Disable:
+        documentLoader.setLegacyOverflowScrollingTouchPolicy(WebCore::LegacyOverflowScrollingTouchPolicy::Disable);
+        break;
+    case WebsiteLegacyOverflowScrollingTouchPolicy::Enable:
+        documentLoader.setLegacyOverflowScrollingTouchPolicy(WebCore::LegacyOverflowScrollingTouchPolicy::Enable);
+        break;
+    }
+
     if (websitePolicies.websiteDataStoreParameters) {
         if (auto* frame = documentLoader.frame()) {
             if (auto* page = frame->page())
diff --git a/Source/WebKit/Shared/WebsitePoliciesData.h b/Source/WebKit/Shared/WebsitePoliciesData.h
index 040bf06..98fc991 100644
--- a/Source/WebKit/Shared/WebsitePoliciesData.h
+++ b/Source/WebKit/Shared/WebsitePoliciesData.h
@@ -28,6 +28,7 @@
 #include "WebsiteAutoplayPolicy.h"
 #include "WebsiteAutoplayQuirk.h"
 #include "WebsiteDataStoreParameters.h"
+#include "WebsiteLegacyOverflowScrollingTouchPolicy.h"
 #include "WebsiteMediaSourcePolicy.h"
 #include "WebsiteMetaViewportPolicy.h"
 #include "WebsitePopUpPolicy.h"
@@ -65,6 +66,7 @@
     WebsiteMetaViewportPolicy metaViewportPolicy { WebsiteMetaViewportPolicy::Default };
     WebsiteMediaSourcePolicy mediaSourcePolicy { WebsiteMediaSourcePolicy::Default };
     WebsiteSimulatedMouseEventsDispatchPolicy simulatedMouseEventsDispatchPolicy { WebsiteSimulatedMouseEventsDispatchPolicy::Default };
+    WebsiteLegacyOverflowScrollingTouchPolicy legacyOverflowScrollingTouchPolicy { WebsiteLegacyOverflowScrollingTouchPolicy::Default };
 
     void encode(IPC::Encoder&) const;
     static Optional<WebsitePoliciesData> decode(IPC::Decoder&);
diff --git a/Source/WebKit/UIProcess/API/APIWebsitePolicies.cpp b/Source/WebKit/UIProcess/API/APIWebsitePolicies.cpp
index 5cfeb08..4437dd5 100644
--- a/Source/WebKit/UIProcess/API/APIWebsitePolicies.cpp
+++ b/Source/WebKit/UIProcess/API/APIWebsitePolicies.cpp
@@ -61,6 +61,7 @@
     policies->setMetaViewportPolicy(m_metaViewportPolicy);
     policies->setMediaSourcePolicy(m_mediaSourcePolicy);
     policies->setSimulatedMouseEventsDispatchPolicy(m_simulatedMouseEventsDispatchPolicy);
+    policies->setLegacyOverflowScrollingTouchPolicy(m_legacyOverflowScrollingTouchPolicy);
     
     Vector<WebCore::HTTPHeaderField> legacyCustomHeaderFields;
     legacyCustomHeaderFields.reserveInitialCapacity(m_legacyCustomHeaderFields.size());
@@ -113,6 +114,7 @@
         m_metaViewportPolicy,
         m_mediaSourcePolicy,
         m_simulatedMouseEventsDispatchPolicy,
+        m_legacyOverflowScrollingTouchPolicy,
     };
 }
 
diff --git a/Source/WebKit/UIProcess/API/APIWebsitePolicies.h b/Source/WebKit/UIProcess/API/APIWebsitePolicies.h
index 50ff7ae..b79fab0 100644
--- a/Source/WebKit/UIProcess/API/APIWebsitePolicies.h
+++ b/Source/WebKit/UIProcess/API/APIWebsitePolicies.h
@@ -29,6 +29,7 @@
 #include "WebCompatibilityMode.h"
 #include "WebsiteAutoplayPolicy.h"
 #include "WebsiteAutoplayQuirk.h"
+#include "WebsiteLegacyOverflowScrollingTouchPolicy.h"
 #include "WebsiteMediaSourcePolicy.h"
 #include "WebsiteMetaViewportPolicy.h"
 #include "WebsitePopUpPolicy.h"
@@ -104,6 +105,9 @@
     WebKit::WebsiteSimulatedMouseEventsDispatchPolicy simulatedMouseEventsDispatchPolicy() const { return m_simulatedMouseEventsDispatchPolicy; }
     void setSimulatedMouseEventsDispatchPolicy(WebKit::WebsiteSimulatedMouseEventsDispatchPolicy policy) { m_simulatedMouseEventsDispatchPolicy = policy; }
 
+    WebKit::WebsiteLegacyOverflowScrollingTouchPolicy legacyOverflowScrollingTouchPolicy() const { return m_legacyOverflowScrollingTouchPolicy; }
+    void setLegacyOverflowScrollingTouchPolicy(WebKit::WebsiteLegacyOverflowScrollingTouchPolicy policy) { m_legacyOverflowScrollingTouchPolicy = policy; }
+
     bool allowSiteSpecificQuirksToOverrideCompatibilityMode() const { return m_allowSiteSpecificQuirksToOverrideCompatibilityMode; }
     void setAllowSiteSpecificQuirksToOverrideCompatibilityMode(bool value) { m_allowSiteSpecificQuirksToOverrideCompatibilityMode = value; }
 
@@ -130,6 +134,7 @@
     WebKit::WebsiteMetaViewportPolicy m_metaViewportPolicy { WebKit::WebsiteMetaViewportPolicy::Default };
     WebKit::WebsiteMediaSourcePolicy m_mediaSourcePolicy { WebKit::WebsiteMediaSourcePolicy::Default };
     WebKit::WebsiteSimulatedMouseEventsDispatchPolicy m_simulatedMouseEventsDispatchPolicy { WebKit::WebsiteSimulatedMouseEventsDispatchPolicy::Default };
+    WebKit::WebsiteLegacyOverflowScrollingTouchPolicy m_legacyOverflowScrollingTouchPolicy { WebKit::WebsiteLegacyOverflowScrollingTouchPolicy::Default };
     bool m_allowSiteSpecificQuirksToOverrideCompatibilityMode { false };
     WTF::String m_applicationNameForUserAgentWithModernCompatibility;
 };
diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj
index 17ecd2e..1a7ca32 100644
--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj
+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj
@@ -1117,6 +1117,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, ); }; };
+		711725A9228D564300018514 /* WebsiteLegacyOverflowScrollingTouchPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 711725A8228D563A00018514 /* WebsiteLegacyOverflowScrollingTouchPolicy.h */; };
 		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, ); }; };
@@ -3606,6 +3607,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>"; };
+		711725A8228D563A00018514 /* WebsiteLegacyOverflowScrollingTouchPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsiteLegacyOverflowScrollingTouchPolicy.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>"; };
@@ -5278,6 +5280,7 @@
 				5C8DD3811FE455CA00F2A556 /* WebsiteAutoplayQuirk.h */,
 				511F7D3F1EB1BCEE00E47B83 /* WebsiteDataStoreParameters.cpp */,
 				511F7D401EB1BCEE00E47B83 /* WebsiteDataStoreParameters.h */,
+				711725A8228D563A00018514 /* WebsiteLegacyOverflowScrollingTouchPolicy.h */,
 				F4CB09E4225D5A0300891487 /* WebsiteMediaSourcePolicy.h */,
 				F430E941224732A9005FE053 /* WebsiteMetaViewportPolicy.h */,
 				5C3AEA8E1FE1F1DF002318D3 /* WebsitePoliciesData.cpp */,
@@ -9772,6 +9775,7 @@
 				1A4832D11A9BDC2F008B4DFE /* WebsiteDataRecord.h in Headers */,
 				1A53C2AA1A325730004E8C70 /* WebsiteDataStore.h in Headers */,
 				511F7D411EB1BCF500E47B83 /* WebsiteDataStoreParameters.h in Headers */,
+				711725A9228D564300018514 /* WebsiteLegacyOverflowScrollingTouchPolicy.h in Headers */,
 				F4CB09E5225D5A0900891487 /* WebsiteMediaSourcePolicy.h in Headers */,
 				F430E9422247335F005FE053 /* WebsiteMetaViewportPolicy.h in Headers */,
 				0EDE85032004E75D00030560 /* WebsitePopUpPolicy.h in Headers */,