Diff
Modified: trunk/Source/WebCore/ChangeLog (261639 => 261640)
--- trunk/Source/WebCore/ChangeLog 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebCore/ChangeLog 2020-05-13 19:59:08 UTC (rev 261640)
@@ -1,3 +1,15 @@
+2020-05-13 Tim Horton <timothy_hor...@apple.com>
+
+ Add SPI for reverting to touch events for iPad trackpad interactions
+ https://bugs.webkit.org/show_bug.cgi?id=211824
+ <rdar://problem/61363084>
+
+ Reviewed by Megan Gardner.
+
+ * loader/DocumentLoader.h:
+ (WebCore::DocumentLoader::mouseEventPolicy const):
+ (WebCore::DocumentLoader::setMouseEventPolicy):
+
2020-05-13 Kenneth Russell <k...@chromium.org>
Bad flicker on three.js example
Modified: trunk/Source/WebCore/loader/DocumentLoader.h (261639 => 261640)
--- trunk/Source/WebCore/loader/DocumentLoader.h 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebCore/loader/DocumentLoader.h 2020-05-13 19:59:08 UTC (rev 261640)
@@ -138,6 +138,13 @@
Enable,
};
+enum class MouseEventPolicy : uint8_t {
+ Default,
+#if ENABLE(IOS_TOUCH_EVENTS)
+ SynthesizeTouchEvents,
+#endif
+};
+
DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER(DocumentLoader);
class DocumentLoader
: public RefCounted<DocumentLoader>
@@ -328,6 +335,9 @@
LegacyOverflowScrollingTouchPolicy legacyOverflowScrollingTouchPolicy() const { return m_legacyOverflowScrollingTouchPolicy; }
void setLegacyOverflowScrollingTouchPolicy(LegacyOverflowScrollingTouchPolicy policy) { m_legacyOverflowScrollingTouchPolicy = policy; }
+ MouseEventPolicy mouseEventPolicy() const { return m_mouseEventPolicy; }
+ void setMouseEventPolicy(MouseEventPolicy policy) { m_mouseEventPolicy = policy; }
+
void addSubresourceLoader(ResourceLoader*);
void removeSubresourceLoader(LoadCompletionType, ResourceLoader*);
void addPlugInStreamLoader(ResourceLoader&);
@@ -632,6 +642,7 @@
MediaSourcePolicy m_mediaSourcePolicy { MediaSourcePolicy::Default };
SimulatedMouseEventsDispatchPolicy m_simulatedMouseEventsDispatchPolicy { SimulatedMouseEventsDispatchPolicy::Default };
LegacyOverflowScrollingTouchPolicy m_legacyOverflowScrollingTouchPolicy { LegacyOverflowScrollingTouchPolicy::Default };
+ MouseEventPolicy m_mouseEventPolicy { MouseEventPolicy::Default };
#if ENABLE(SERVICE_WORKER)
Optional<ServiceWorkerRegistrationData> m_serviceWorkerRegistrationData;
@@ -731,4 +742,18 @@
m_resourcesClientKnowsAbout.add(url);
}
-}
+} // namespace WebCore
+
+namespace WTF {
+
+template<> struct EnumTraits<WebCore::MouseEventPolicy> {
+ using values = EnumValues<
+ WebCore::MouseEventPolicy,
+ WebCore::MouseEventPolicy::Default
+#if ENABLE(IOS_TOUCH_EVENTS)
+ , WebCore::MouseEventPolicy::SynthesizeTouchEvents
+#endif
+ >;
+};
+
+} // namespace WTF
Modified: trunk/Source/WebKit/ChangeLog (261639 => 261640)
--- trunk/Source/WebKit/ChangeLog 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebKit/ChangeLog 2020-05-13 19:59:08 UTC (rev 261640)
@@ -1,3 +1,67 @@
+2020-05-13 Tim Horton <timothy_hor...@apple.com>
+
+ Add SPI for reverting to touch events for iPad trackpad interactions
+ https://bugs.webkit.org/show_bug.cgi?id=211824
+ <rdar://problem/61363084>
+
+ Reviewed by Megan Gardner.
+
+ New Test: IOSMouseSupport.WebsiteMouseEventPolicies
+
+ Plumb a "mouse event policy" WKWebpagePreference, which has two values:
+
+ - Default, which means that WebKit decides whether or not indirect
+ pointing devices send mouse or touch events.
+
+ - SynthesizeTouchEvents, which ensures that WebKit will always send
+ touch events from indirect pointing devices.
+ This value is only available on platforms that implement touch events.
+
+ We use the WKWebpagePreferences mechanism in order to make it easy to
+ implement it as a "per-site" quirk, but unlike most WKWebpagePreferences,
+ it turns around and changes UI process state (the enablement of the
+ WKMouseGestureRecgonizer).
+
+ * Scripts/webkit/messages.py:
+ * 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:
+ * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
+ (WebKit::mouseEventPolicy):
+ (WebKit::coreMouseEventPolicy):
+ (-[WKWebpagePreferences _setMouseEventPolicy:]):
+ (-[WKWebpagePreferences _mouseEventPolicy]):
+ * UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h:
+ * UIProcess/PageClient.h:
+ (WebKit::PageClient::setMouseEventPolicy):
+ * UIProcess/ProvisionalPageProxy.cpp:
+ (WebKit::ProvisionalPageProxy::didCommitLoadForFrame):
+ * UIProcess/ProvisionalPageProxy.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::commitProvisionalPage):
+ (WebKit::WebPageProxy::didCommitLoadForFrame):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/ios/PageClientImplIOS.h:
+ * UIProcess/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::setMouseEventPolicy):
+ * UIProcess/ios/WKContentViewInteraction.h:
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView shouldUseMouseGestureRecognizer]):
+ (-[WKContentView setUpMouseGestureRecognizer]):
+ (-[WKContentView _configureMouseGestureRecognizer]):
+ (-[WKContentView _setMouseEventPolicy:]):
+ * UIProcess/ios/WKMouseGestureRecognizer.mm:
+ (-[WKMouseGestureRecognizer setEnabled:]):
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::dispatchDidCommitLoad):
+
2020-05-13 Wenson Hsieh <wenson_hs...@apple.com>
[iOS] "Copy" context menu action for attachment element does not work in Mail
Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (261639 => 261640)
--- trunk/Source/WebKit/Scripts/webkit/messages.py 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py 2020-05-13 19:59:08 UTC (rev 261640)
@@ -599,6 +599,7 @@
'WebCore::LegacyCDMSessionClient::MediaKeyErrorCode': ['<WebCore/LegacyCDMSession.h>'],
'WebCore::LockBackForwardList': ['<WebCore/FrameLoaderTypes.h>'],
'WebCore::MessagePortChannelProvider::HasActivity': ['<WebCore/MessagePortChannelProvider.h>'],
+ 'WebCore::MouseEventPolicy': ['<WebCore/DocumentLoader.h>'],
'WebCore::NetworkTransactionInformation': ['<WebCore/NetworkLoadInformation.h>'],
'WebCore::PasteboardCustomData': ['<WebCore/Pasteboard.h>'],
'WebCore::PasteboardImage': ['<WebCore/Pasteboard.h>'],
Modified: trunk/Source/WebKit/Shared/WebsitePoliciesData.cpp (261639 => 261640)
--- trunk/Source/WebKit/Shared/WebsitePoliciesData.cpp 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebKit/Shared/WebsitePoliciesData.cpp 2020-05-13 19:59:08 UTC (rev 261640)
@@ -29,7 +29,6 @@
#include "ArgumentCoders.h"
#include "WebProcess.h"
#include <WebCore/CustomHeaderFields.h>
-#include <WebCore/DocumentLoader.h>
#include <WebCore/Frame.h>
#include <WebCore/Page.h>
@@ -54,6 +53,7 @@
encoder << legacyOverflowScrollingTouchPolicy;
encoder << allowContentChangeObserverQuirk;
encoder << allowsContentJavaScript;
+ encoder << mouseEventPolicy;
}
Optional<WebsitePoliciesData> WebsitePoliciesData::decode(IPC::Decoder& decoder)
@@ -135,6 +135,11 @@
if (!allowsContentJavaScript)
return WTF::nullopt;
+ Optional<WebCore::MouseEventPolicy> mouseEventPolicy;
+ decoder >> mouseEventPolicy;
+ if (!mouseEventPolicy)
+ return WTF::nullopt;
+
return { {
WTFMove(*contentBlockersEnabled),
WTFMove(*allowedAutoplayQuirks),
@@ -153,6 +158,7 @@
WTFMove(*legacyOverflowScrollingTouchPolicy),
WTFMove(*allowContentChangeObserverQuirk),
WTFMove(*allowsContentJavaScript),
+ WTFMove(*mouseEventPolicy),
} };
}
@@ -263,6 +269,17 @@
break;
}
+ switch (websitePolicies.mouseEventPolicy) {
+ case WebCore::MouseEventPolicy::Default:
+ documentLoader.setMouseEventPolicy(WebCore::MouseEventPolicy::Default);
+ break;
+#if ENABLE(IOS_TOUCH_EVENTS)
+ case WebCore::MouseEventPolicy::SynthesizeTouchEvents:
+ documentLoader.setMouseEventPolicy(WebCore::MouseEventPolicy::SynthesizeTouchEvents);
+ break;
+#endif
+ }
+
documentLoader.setAllowContentChangeObserverQuirk(websitePolicies.allowContentChangeObserverQuirk);
auto* frame = documentLoader.frame();
Modified: trunk/Source/WebKit/Shared/WebsitePoliciesData.h (261639 => 261640)
--- trunk/Source/WebKit/Shared/WebsitePoliciesData.h 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebKit/Shared/WebsitePoliciesData.h 2020-05-13 19:59:08 UTC (rev 261640)
@@ -34,6 +34,7 @@
#include "WebsiteSimulatedMouseEventsDispatchPolicy.h"
#include <WebCore/CustomHeaderFields.h>
#include <WebCore/DeviceOrientationOrMotionPermissionState.h>
+#include <WebCore/DocumentLoader.h>
#include <WebCore/FrameLoaderTypes.h>
#include <wtf/OptionSet.h>
@@ -68,6 +69,7 @@
WebsiteLegacyOverflowScrollingTouchPolicy legacyOverflowScrollingTouchPolicy { WebsiteLegacyOverflowScrollingTouchPolicy::Default };
bool allowContentChangeObserverQuirk { false };
WebCore::AllowsContentJavaScript allowsContentJavaScript { WebCore::AllowsContentJavaScript::Yes };
+ WebCore::MouseEventPolicy mouseEventPolicy { WebCore::MouseEventPolicy::Default };
void encode(IPC::Encoder&) const;
static Optional<WebsitePoliciesData> decode(IPC::Decoder&);
Modified: trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.cpp (261639 => 261640)
--- trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.cpp 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.cpp 2020-05-13 19:59:08 UTC (rev 261640)
@@ -70,6 +70,7 @@
policies->setCustomHeaderFields(WTFMove(customHeaderFields));
policies->setAllowSiteSpecificQuirksToOverrideContentMode(m_allowSiteSpecificQuirksToOverrideContentMode);
policies->setApplicationNameForDesktopUserAgent(m_applicationNameForDesktopUserAgent);
+ policies->setMouseEventPolicy(m_mouseEventPolicy);
return policies;
}
@@ -114,7 +115,8 @@
m_simulatedMouseEventsDispatchPolicy,
m_legacyOverflowScrollingTouchPolicy,
m_allowContentChangeObserverQuirk,
- m_allowsContentJavaScript,
+ m_allowsContentJavaScript,
+ m_mouseEventPolicy
};
}
Modified: trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.h (261639 => 261640)
--- trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.h 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.h 2020-05-13 19:59:08 UTC (rev 261640)
@@ -37,6 +37,7 @@
#include "WebsiteSimulatedMouseEventsDispatchPolicy.h"
#include <WebCore/CustomHeaderFields.h>
#include <WebCore/DeviceOrientationOrMotionPermissionState.h>
+#include <WebCore/DocumentLoader.h>
#include <WebCore/FrameLoaderTypes.h>
#include <WebCore/HTTPHeaderField.h>
#include <wtf/OptionSet.h>
@@ -124,6 +125,9 @@
WebCore::AllowsContentJavaScript allowsContentJavaScript() const { return m_allowsContentJavaScript; }
void setAllowsContentJavaScript(WebCore::AllowsContentJavaScript allows) { m_allowsContentJavaScript = allows; }
+ WebCore::MouseEventPolicy mouseEventPolicy() const { return m_mouseEventPolicy; }
+ void setMouseEventPolicy(WebCore::MouseEventPolicy policy) { m_mouseEventPolicy = policy; }
+
private:
bool m_contentBlockersEnabled { true };
OptionSet<WebKit::WebsiteAutoplayQuirk> m_allowedAutoplayQuirks;
@@ -148,6 +152,7 @@
WTF::String m_applicationNameForDesktopUserAgent;
bool m_allowContentChangeObserverQuirk { false };
WebCore::AllowsContentJavaScript m_allowsContentJavaScript { WebCore::AllowsContentJavaScript::Yes };
+ WebCore::MouseEventPolicy m_mouseEventPolicy { WebCore::MouseEventPolicy::Default };
};
} // namespace API
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm (261639 => 261640)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm 2020-05-13 19:59:08 UTC (rev 261640)
@@ -33,12 +33,13 @@
#import "WebContentMode.h"
#import "_WKCustomHeaderFieldsInternal.h"
#import "_WKWebsitePoliciesInternal.h"
+#import <WebCore/DocumentLoader.h>
#import <wtf/RetainPtr.h>
+namespace WebKit {
+
#if PLATFORM(IOS_FAMILY)
-namespace WebKit {
-
WKContentMode contentMode(WebKit::WebContentMode contentMode)
{
switch (contentMode) {
@@ -67,10 +68,38 @@
return WebKit::WebContentMode::Recommended;
}
+#endif // PLATFORM(IOS_FAMILY)
+
+static _WKWebsiteMouseEventPolicy mouseEventPolicy(WebCore::MouseEventPolicy policy)
+{
+ switch (policy) {
+ case WebCore::MouseEventPolicy::Default:
+ return _WKWebsiteMouseEventPolicyDefault;
+#if ENABLE(IOS_TOUCH_EVENTS)
+ case WebCore::MouseEventPolicy::SynthesizeTouchEvents:
+ return _WKWebsiteMouseEventPolicySynthesizeTouchEvents;
+#endif
+ }
+ ASSERT_NOT_REACHED();
+ return _WKWebsiteMouseEventPolicyDefault;
+}
+
+static WebCore::MouseEventPolicy coreMouseEventPolicy(_WKWebsiteMouseEventPolicy policy)
+{
+ switch (policy) {
+ case _WKWebsiteMouseEventPolicyDefault:
+ return WebCore::MouseEventPolicy::Default;
+#if ENABLE(IOS_TOUCH_EVENTS)
+ case _WKWebsiteMouseEventPolicySynthesizeTouchEvents:
+ return WebCore::MouseEventPolicy::SynthesizeTouchEvents;
+#endif
+ }
+ ASSERT_NOT_REACHED();
+ return WebCore::MouseEventPolicy::Default;
+}
+
} // namespace WebKit
-#endif // PLATFORM(IOS_FAMILY)
-
@implementation WKWebpagePreferences
+ (instancetype)defaultPreferences
@@ -369,4 +398,14 @@
#endif // PLATFORM(IOS_FAMILY)
+- (void)_setMouseEventPolicy:(_WKWebsiteMouseEventPolicy)policy
+{
+ _websitePolicies->setMouseEventPolicy(WebKit::coreMouseEventPolicy(policy));
+}
+
+- (_WKWebsiteMouseEventPolicy)_mouseEventPolicy
+{
+ return WebKit::mouseEventPolicy(_websitePolicies->mouseEventPolicy());
+}
+
@end
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h (261639 => 261640)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h 2020-05-13 19:59:08 UTC (rev 261640)
@@ -52,6 +52,16 @@
_WKWebsiteDeviceOrientationAndMotionAccessPolicyDeny,
} WK_API_AVAILABLE(macos(10.14), ios(12.0));
+typedef NS_OPTIONS(NSUInteger, _WKWebsiteMouseEventPolicy) {
+ // Indirect pointing devices will generate either touch or mouse events based on WebKit's default policy.
+ _WKWebsiteMouseEventPolicyDefault,
+
+#if TARGET_OS_IPHONE
+ // Indirect pointing devices will always synthesize touch events and behave as if touch input is being used.
+ _WKWebsiteMouseEventPolicySynthesizeTouchEvents,
+#endif
+} WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
+
@class _WKCustomHeaderFields;
@class WKUserContentController;
@class WKWebsiteDataStore;
@@ -73,4 +83,6 @@
@property (nonatomic, copy, setter=_setApplicationNameForUserAgentWithModernCompatibility:) NSString *_applicationNameForUserAgentWithModernCompatibility;
+@property (nonatomic, setter=_setMouseEventPolicy:) _WKWebsiteMouseEventPolicy _mouseEventPolicy WK_API_AVAILABLE(mac(WK_MAC_TBA), ios(WK_IOS_TBA));
+
@end
Modified: trunk/Source/WebKit/UIProcess/PageClient.h (261639 => 261640)
--- trunk/Source/WebKit/UIProcess/PageClient.h 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebKit/UIProcess/PageClient.h 2020-05-13 19:59:08 UTC (rev 261640)
@@ -88,6 +88,7 @@
class SelectionData;
#endif
+enum class MouseEventPolicy : uint8_t;
enum class RouteSharingPolicy : uint8_t;
enum class ScrollbarStyle : uint8_t;
enum class TextIndicatorWindowLifetime : uint8_t;
@@ -469,6 +470,8 @@
virtual bool scrollingUpdatesDisabledForTesting() { return false; }
virtual bool hasSafeBrowsingWarning() const { return false; }
+
+ virtual void setMouseEventPolicy(WebCore::MouseEventPolicy) { }
#if PLATFORM(MAC)
virtual void didPerformImmediateActionHitTest(const WebHitTestResultData&, bool contentPreventsDefault, API::Object*) = 0;
Modified: trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp (261639 => 261640)
--- trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp 2020-05-13 19:59:08 UTC (rev 261640)
@@ -277,7 +277,7 @@
m_page.didFailProvisionalLoadForFrameShared(m_process.copyRef(), frameID, WTFMove(frameInfo), WTFMove(request), navigationID, provisionalURL, error, willContinueLoading, userData); // May delete |this|.
}
-void ProvisionalPageProxy::didCommitLoadForFrame(FrameIdentifier frameID, FrameInfoData&& frameInfo, ResourceRequest&& request, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo& certificateInfo, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData& userData)
+void ProvisionalPageProxy::didCommitLoadForFrame(FrameIdentifier frameID, FrameInfoData&& frameInfo, ResourceRequest&& request, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo& certificateInfo, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, WebCore::MouseEventPolicy mouseEventPolicy, const UserData& userData)
{
if (!validateInput(frameID, navigationID))
return;
@@ -287,7 +287,7 @@
m_process->removeMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_webPageID);
m_wasCommitted = true;
- m_page.commitProvisionalPage(frameID, WTFMove(frameInfo), WTFMove(request), navigationID, mimeType, frameHasCustomContentProvider, frameLoadType, certificateInfo, usedLegacyTLS, containsPluginDocument, forcedHasInsecureContent, userData); // Will delete |this|.
+ m_page.commitProvisionalPage(frameID, WTFMove(frameInfo), WTFMove(request), navigationID, mimeType, frameHasCustomContentProvider, frameLoadType, certificateInfo, usedLegacyTLS, containsPluginDocument, forcedHasInsecureContent, mouseEventPolicy, userData); // Will delete |this|.
}
void ProvisionalPageProxy::didNavigateWithNavigationData(const WebNavigationDataStore& store, FrameIdentifier frameID)
Modified: trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.h (261639 => 261640)
--- trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.h 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.h 2020-05-13 19:59:08 UTC (rev 261640)
@@ -123,7 +123,7 @@
void didPerformClientRedirect(const String& sourceURLString, const String& destinationURLString, WebCore::FrameIdentifier);
void didCreateMainFrame(WebCore::FrameIdentifier);
void didStartProvisionalLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, URL&&, URL&& unreachableURL, const UserData&);
- void didCommitLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData&);
+ void didCommitLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, WebCore::MouseEventPolicy, const UserData&);
void didFailProvisionalLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, WebCore::WillContinueLoading, const UserData&);
void startURLSchemeTask(URLSchemeTaskParameters&&);
void backForwardGoToItem(const WebCore::BackForwardItemIdentifier&, CompletionHandler<void(const WebBackForwardListCounts&)>&&);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (261639 => 261640)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2020-05-13 19:59:08 UTC (rev 261640)
@@ -3305,7 +3305,7 @@
sender->send(PolicyDecision { sender->identifier(), isNavigatingToAppBoundDomain(), action, navigation ? navigation->navigationID() : 0, downloadID, WTFMove(websitePoliciesData), WTFMove(sandboxExtensionHandle) });
}
-void WebPageProxy::commitProvisionalPage(FrameIdentifier frameID, FrameInfoData&& frameInfo, ResourceRequest&& request, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo& certificateInfo, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData& userData)
+void WebPageProxy::commitProvisionalPage(FrameIdentifier frameID, FrameInfoData&& frameInfo, ResourceRequest&& request, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo& certificateInfo, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, WebCore::MouseEventPolicy mouseEventPolicy, const UserData& userData)
{
ASSERT(m_provisionalPage);
RELEASE_LOG_IF_ALLOWED(Loading, "commitProvisionalPage: newPID = %i", m_provisionalPage->process().processIdentifier());
@@ -3339,7 +3339,7 @@
const auto oldWebPageID = m_webPageID;
swapToProvisionalPage(std::exchange(m_provisionalPage, nullptr));
- didCommitLoadForFrame(frameID, WTFMove(frameInfo), WTFMove(request), navigationID, mimeType, frameHasCustomContentProvider, frameLoadType, certificateInfo, usedLegacyTLS, containsPluginDocument, forcedHasInsecureContent, userData);
+ didCommitLoadForFrame(frameID, WTFMove(frameInfo), WTFMove(request), navigationID, mimeType, frameHasCustomContentProvider, frameLoadType, certificateInfo, usedLegacyTLS, containsPluginDocument, forcedHasInsecureContent, mouseEventPolicy, userData);
m_inspectorController->didCommitProvisionalPage(oldWebPageID, m_webPageID);
}
@@ -4652,7 +4652,7 @@
}
#endif
-void WebPageProxy::didCommitLoadForFrame(FrameIdentifier frameID, FrameInfoData&& frameInfo, ResourceRequest&& request, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t opaqueFrameLoadType, const WebCore::CertificateInfo& certificateInfo, bool usedLegacyTLS, bool containsPluginDocument, Optional<HasInsecureContent> hasInsecureContent, const UserData& userData)
+void WebPageProxy::didCommitLoadForFrame(FrameIdentifier frameID, FrameInfoData&& frameInfo, ResourceRequest&& request, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t opaqueFrameLoadType, const WebCore::CertificateInfo& certificateInfo, bool usedLegacyTLS, bool containsPluginDocument, Optional<HasInsecureContent> hasInsecureContent, WebCore::MouseEventPolicy mouseEventPolicy, const UserData& userData)
{
LOG(Loading, "(Loading) WebPageProxy %" PRIu64 " didCommitLoadForFrame in navigation %" PRIu64, m_identifier.toUInt64(), navigationID);
LOG(BackForward, "(Back/Forward) After load commit, back/forward list is now:%s", m_backForwardList->loggingString());
@@ -4749,6 +4749,9 @@
requestPointerUnlock();
#endif
+ if (frame->isMainFrame())
+ pageClient().setMouseEventPolicy(mouseEventPolicy);
+
m_pageLoadState.commitChanges();
if (m_loaderClient)
m_loaderClient->didCommitLoadForFrame(*this, *frame, navigation.get(), m_process->transformHandlesToObjects(userData.object()).get());
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (261639 => 261640)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2020-05-13 19:59:08 UTC (rev 261640)
@@ -229,6 +229,7 @@
enum class DOMPasteAccessResponse : uint8_t;
enum class LockBackForwardList : bool;
enum class HasInsecureContent : bool;
+enum class MouseEventPolicy : uint8_t;
enum class NotificationDirection : uint8_t;
enum class RouteSharingPolicy : uint8_t;
enum class ShouldSample : bool;
@@ -1640,7 +1641,7 @@
#endif
ProvisionalPageProxy* provisionalPageProxy() const { return m_provisionalPage.get(); }
- void commitProvisionalPage(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData&);
+ void commitProvisionalPage(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, WebCore::MouseEventPolicy, const UserData&);
// Logic shared between the WebPageProxy and the ProvisionalPageProxy.
void didStartProvisionalLoadForFrameShared(Ref<WebProcessProxy>&&, WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, URL&&, URL&& unreachableURL, const UserData&);
@@ -1822,7 +1823,7 @@
void didCancelClientRedirectForFrame(WebCore::FrameIdentifier);
void didChangeProvisionalURLForFrame(WebCore::FrameIdentifier, uint64_t navigationID, URL&&);
void didFailProvisionalLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, WebCore::WillContinueLoading, const UserData&);
- void didCommitLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData&);
+ void didCommitLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, WebCore::MouseEventPolicy, const UserData&);
void didFinishDocumentLoadForFrame(WebCore::FrameIdentifier, uint64_t navigationID, const UserData&);
void didFinishLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, const UserData&);
void didFailLoadForFrame(WebCore::FrameIdentifier, FrameInfoData&&, WebCore::ResourceRequest&&, uint64_t navigationID, const WebCore::ResourceError&, const UserData&);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (261639 => 261640)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2020-05-13 19:59:08 UTC (rev 261640)
@@ -125,7 +125,7 @@
DidCancelClientRedirectForFrame(WebCore::FrameIdentifier frameID)
DidChangeProvisionalURLForFrame(WebCore::FrameIdentifier frameID, uint64_t navigationID, URL url)
DidFailProvisionalLoadForFrame(WebCore::FrameIdentifier frameID, struct WebKit::FrameInfoData frameInfo, WebCore::ResourceRequest request, uint64_t navigationID, String provisionalURL, WebCore::ResourceError error, enum:bool WebCore::WillContinueLoading willContinueLoading, WebKit::UserData userData)
- DidCommitLoadForFrame(WebCore::FrameIdentifier frameID, struct WebKit::FrameInfoData frameInfo, WebCore::ResourceRequest request, uint64_t navigationID, String mimeType, bool hasCustomContentProvider, uint32_t loadType, WebCore::CertificateInfo certificateInfo, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, WebKit::UserData userData)
+ DidCommitLoadForFrame(WebCore::FrameIdentifier frameID, struct WebKit::FrameInfoData frameInfo, WebCore::ResourceRequest request, uint64_t navigationID, String mimeType, bool hasCustomContentProvider, uint32_t loadType, WebCore::CertificateInfo certificateInfo, bool usedLegacyTLS, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, enum:uint8_t WebCore::MouseEventPolicy mouseEventPolicy, WebKit::UserData userData)
DidFailLoadForFrame(WebCore::FrameIdentifier frameID, struct WebKit::FrameInfoData frameInfo, WebCore::ResourceRequest request, uint64_t navigationID, WebCore::ResourceError error, WebKit::UserData userData)
DidFinishDocumentLoadForFrame(WebCore::FrameIdentifier frameID, uint64_t navigationID, WebKit::UserData userData)
DidFinishLoadForFrame(WebCore::FrameIdentifier frameID, struct WebKit::FrameInfoData frameInfo, WebCore::ResourceRequest request, uint64_t navigationID, WebKit::UserData userData)
Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h (261639 => 261640)
--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h 2020-05-13 19:59:08 UTC (rev 261640)
@@ -254,6 +254,8 @@
void handleAutocorrectionContext(const WebAutocorrectionContext&) final;
+ void setMouseEventPolicy(WebCore::MouseEventPolicy) final;
+
#if HAVE(PENCILKIT)
RetainPtr<WKDrawingView> createDrawingView(WebCore::GraphicsLayer::EmbeddedViewID) override;
#endif
Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (261639 => 261640)
--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm 2020-05-13 19:59:08 UTC (rev 261640)
@@ -961,6 +961,11 @@
#endif // ENABLE(ATTACHMENT_ELEMENT)
+void PageClientImpl::setMouseEventPolicy(WebCore::MouseEventPolicy policy)
+{
+ [m_contentView _setMouseEventPolicy:policy];
+}
+
} // namespace WebKit
#endif // PLATFORM(IOS_FAMILY)
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (261639 => 261640)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h 2020-05-13 19:59:08 UTC (rev 261640)
@@ -81,6 +81,7 @@
struct PromisedAttachmentInfo;
struct ShareDataWithParsedURL;
enum class DOMPasteAccessResponse : uint8_t;
+enum class MouseEventPolicy : uint8_t;
enum class RouteSharingPolicy : uint8_t;
#if ENABLE(DRAG_SUPPORT)
@@ -243,6 +244,7 @@
#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
RetainPtr<WKMouseGestureRecognizer> _mouseGestureRecognizer;
+ WebCore::MouseEventPolicy _mouseEventPolicy;
#endif
#if HAVE(UI_CURSOR_INTERACTION)
@@ -603,6 +605,10 @@
- (void)_writePromisedAttachmentToPasteboard:(WebCore::PromisedAttachmentInfo&&)info;
#endif
+#if HAVE(UIKIT_WITH_MOUSE_SUPPORT)
+- (void)_setMouseEventPolicy:(WebCore::MouseEventPolicy)policy;
+#endif
+
@end
@interface WKContentView (WKTesting)
Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (261639 => 261640)
--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm 2020-05-13 19:59:08 UTC (rev 261640)
@@ -8459,6 +8459,15 @@
return YES;
}();
+ switch (_mouseEventPolicy) {
+ case WebCore::MouseEventPolicy::Default:
+ break;
+#if ENABLE(IOS_TOUCH_EVENTS)
+ case WebCore::MouseEventPolicy::SynthesizeTouchEvents:
+ return NO;
+#endif
+ }
+
return shouldUseMouseGestureRecognizer;
}
@@ -8466,7 +8475,7 @@
{
_mouseGestureRecognizer = adoptNS([[WKMouseGestureRecognizer alloc] initWithTarget:self action:@selector(mouseGestureRecognizerChanged:)]);
[_mouseGestureRecognizer setDelegate:self];
- [_mouseGestureRecognizer setEnabled:[self shouldUseMouseGestureRecognizer]];
+ [self _configureMouseGestureRecognizer];
[self addGestureRecognizer:_mouseGestureRecognizer.get()];
}
@@ -8485,6 +8494,17 @@
_page->handleMouseEvent(*event);
}
+- (void)_configureMouseGestureRecognizer
+{
+ [_mouseGestureRecognizer setEnabled:[self shouldUseMouseGestureRecognizer]];
+}
+
+- (void)_setMouseEventPolicy:(WebCore::MouseEventPolicy)policy
+{
+ _mouseEventPolicy = policy;
+ [self _configureMouseGestureRecognizer];
+}
+
#endif // HAVE(UIKIT_WITH_MOUSE_SUPPORT)
#if HAVE(UI_CURSOR_INTERACTION)
Modified: trunk/Source/WebKit/UIProcess/ios/WKMouseGestureRecognizer.mm (261639 => 261640)
--- trunk/Source/WebKit/UIProcess/ios/WKMouseGestureRecognizer.mm 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebKit/UIProcess/ios/WKMouseGestureRecognizer.mm 2020-05-13 19:59:08 UTC (rev 261640)
@@ -72,6 +72,20 @@
return self;
}
+- (void)setEnabled:(BOOL)enabled
+{
+ [super setEnabled:enabled];
+
+ if (!enabled) {
+ _currentHoverEvent = nil;
+ _currentTouch = nil;
+ _touching = NO;
+ _lastEvent = nil;
+ _lastLocation = WTF::nullopt;
+ _pressedButtonMask = WTF::nullopt;
+ }
+}
+
- (void)setView:(UIView *)view
{
if (view == self.view)
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (261639 => 261640)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2020-05-13 19:59:08 UTC (rev 261640)
@@ -558,7 +558,7 @@
usedLegacyTLS = usedLegacyTLSFromPageCache == UsedLegacyTLS::Yes;
// Notify the UIProcess.
- webPage->send(Messages::WebPageProxy::DidCommitLoadForFrame(m_frame->frameID(), m_frame->info(), documentLoader.request(), documentLoader.navigationID(), documentLoader.response().mimeType(), m_frameHasCustomContentProvider, static_cast<uint32_t>(m_frame->coreFrame()->loader().loadType()), valueOrCompute(documentLoader.response().certificateInfo(), [] { return CertificateInfo(); }), usedLegacyTLS, m_frame->coreFrame()->document()->isPluginDocument(), hasInsecureContent, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
+ webPage->send(Messages::WebPageProxy::DidCommitLoadForFrame(m_frame->frameID(), m_frame->info(), documentLoader.request(), documentLoader.navigationID(), documentLoader.response().mimeType(), m_frameHasCustomContentProvider, static_cast<uint32_t>(m_frame->coreFrame()->loader().loadType()), valueOrCompute(documentLoader.response().certificateInfo(), [] { return CertificateInfo(); }), usedLegacyTLS, m_frame->coreFrame()->document()->isPluginDocument(), hasInsecureContent, documentLoader.mouseEventPolicy(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
webPage->didCommitLoad(m_frame.ptr());
}
Modified: trunk/Tools/ChangeLog (261639 => 261640)
--- trunk/Tools/ChangeLog 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Tools/ChangeLog 2020-05-13 19:59:08 UTC (rev 261640)
@@ -1,3 +1,25 @@
+2020-05-13 Tim Horton <timothy_hor...@apple.com>
+
+ Add SPI for reverting to touch events for iPad trackpad interactions
+ https://bugs.webkit.org/show_bug.cgi?id=211824
+ <rdar://problem/61363084>
+
+ Reviewed by Megan Gardner.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm: Renamed from Tools/TestWebKitAPI/Tests/WebKitCocoa/MacCatalystMouseSupport.mm.
+ (-[WKTestingEvent locationInView:]):
+ (-[WKTestingEvent _setButtonMask:]):
+ (-[WKTestingEvent _buttonMask]):
+ (-[WKTestingTouch locationInView:]):
+ (-[WKTestingTouch setTapCount:]):
+ (-[WKTestingTouch tapCount]):
+ (mouseGesture):
+ (TEST):
+ Rename and enable MacCatalystMouseSupport tests for iOS.
+ Add a test that ensures that the next load after setting the
+ WKWebpagePreference causes the WKMouseGestureRecognizer to get disabled.
+
2020-05-13 Wenson Hsieh <wenson_hs...@apple.com>
[iOS] "Copy" context menu action for attachment element does not work in Mail
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (261639 => 261640)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2020-05-13 19:59:08 UTC (rev 261640)
@@ -131,7 +131,7 @@
2D00065F1C1F589A0088E6A7 /* WKPDFView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D00065D1C1F58940088E6A7 /* WKPDFView.mm */; };
2D01D06E23218FEE0039AA3A /* WKWebViewPrintFormatter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D01D06D23218FEE0039AA3A /* WKWebViewPrintFormatter.mm */; };
2D08E9372267D0F4002518DA /* ReparentWebViewTimeout.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D08E9362267D0F3002518DA /* ReparentWebViewTimeout.mm */; };
- 2D116E1323E0CB3A00208900 /* MacCatalystMouseSupport.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D116E1223E0CB3900208900 /* MacCatalystMouseSupport.mm */; };
+ 2D116E1323E0CB3A00208900 /* iOSMouseSupport.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D116E1223E0CB3900208900 /* iOSMouseSupport.mm */; };
2D1646E21D1862CD00015A1A /* DeferredViewInWindowStateChange.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D1646E11D1862CD00015A1A /* DeferredViewInWindowStateChange.mm */; };
2D2BEB2D22324E5F005544CA /* RequestTextInputContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D2BEB2C22324E5F005544CA /* RequestTextInputContext.mm */; };
2D2D13B3229F408B005068AF /* DeviceManagementRestrictions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D2D13B2229F408B005068AF /* DeviceManagementRestrictions.mm */; };
@@ -1735,7 +1735,7 @@
2D00065D1C1F58940088E6A7 /* WKPDFView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKPDFView.mm; sourceTree = "<group>"; };
2D01D06D23218FEE0039AA3A /* WKWebViewPrintFormatter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewPrintFormatter.mm; sourceTree = "<group>"; };
2D08E9362267D0F3002518DA /* ReparentWebViewTimeout.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ReparentWebViewTimeout.mm; sourceTree = "<group>"; };
- 2D116E1223E0CB3900208900 /* MacCatalystMouseSupport.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MacCatalystMouseSupport.mm; sourceTree = "<group>"; };
+ 2D116E1223E0CB3900208900 /* iOSMouseSupport.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = iOSMouseSupport.mm; sourceTree = "<group>"; };
2D1646E11D1862CD00015A1A /* DeferredViewInWindowStateChange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DeferredViewInWindowStateChange.mm; path = WebKit/DeferredViewInWindowStateChange.mm; sourceTree = "<group>"; };
2D1C04A51D76298B000A6816 /* TestNavigationDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestNavigationDelegate.h; path = cocoa/TestNavigationDelegate.h; sourceTree = "<group>"; };
2D1C04A61D76298B000A6816 /* TestNavigationDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = TestNavigationDelegate.mm; path = cocoa/TestNavigationDelegate.mm; sourceTree = "<group>"; };
@@ -1900,7 +1900,7 @@
4971B11F2453A87F0096994D /* missingTopFrameUniqueRedirectSameSiteStrictTableSchema.db */ = {isa = PBXFileReference; lastKnownFileType = file; name = missingTopFrameUniqueRedirectSameSiteStrictTableSchema.db; path = Tests/WebKitCocoa/missingTopFrameUniqueRedirectSameSiteStrictTableSchema.db; sourceTree = SOURCE_ROOT; };
4971B12C246239D30096994D /* basicITPDatabase.db */ = {isa = PBXFileReference; lastKnownFileType = file; path = basicITPDatabase.db; sourceTree = SOURCE_ROOT; };
4971B12D24623A3B0096994D /* basicITPDatabase.db-shm */ = {isa = PBXFileReference; lastKnownFileType = file; path = "basicITPDatabase.db-shm"; sourceTree = SOURCE_ROOT; };
- 4971B12E24623A3B0096994D /* basicITPDatabase.db-wal */ = {isa = PBXFileReference; lastKnownFileType = file; path = "basicITPDatabase.db-wal"; sourceTree = SOURCE_ROOT; };
+ 4971B12E24623A3B0096994D /* basicITPDatabase.db-wal */ = {isa = PBXFileReference; lastKnownFileType = text; path = "basicITPDatabase.db-wal"; sourceTree = SOURCE_ROOT; };
49AEEF682407276F00C87E4C /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
49AEEF6B2407358600C87E4C /* InAppBrowserPrivacy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InAppBrowserPrivacy.mm; sourceTree = "<group>"; };
49D7FBA7241FDDDA00AB67FA /* in-app-browser-privacy-local-file.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "in-app-browser-privacy-local-file.html"; sourceTree = "<group>"; };
@@ -3113,6 +3113,7 @@
0E404A8A2166DDF8008271BA /* InjectedBundleNodeHandleIsSelectElement.mm */,
79C5D430209D768300F1E7CA /* InjectedBundleNodeHandleIsTextField.mm */,
2DB0232E1E4E871800707123 /* InteractionDeadlockAfterCrash.mm */,
+ 2D116E1223E0CB3900208900 /* iOSMouseSupport.mm */,
5C69BDD41F82A7EB000F4F4B /* _javascript_DuringNavigation.mm */,
5C0160C021A132320077FA32 /* JITEnabled.mm */,
C25CCA051E51380B0026CB8A /* LineBreaking.mm */,
@@ -3126,7 +3127,6 @@
46C519D81D355A7300DAA51A /* LocalStorageNullEntries.mm */,
8C10AF96206467770018FD90 /* LocalStoragePersistence.mm */,
7A6A2C6F1DCCF87B00C0D085 /* LocalStorageQuirkTest.mm */,
- 2D116E1223E0CB3900208900 /* MacCatalystMouseSupport.mm */,
07CC7DFD2266330800E39181 /* MediaBufferingPolicy.mm */,
51BE9E652376089500B4E117 /* MediaType.mm */,
5165FE03201EE617009F7EC3 /* MessagePortProviders.mm */,
@@ -4988,6 +4988,7 @@
7A909A811D877480007E10F8 /* IntPoint.cpp in Sources */,
7A909A821D877480007E10F8 /* IntRect.cpp in Sources */,
7A909A831D877480007E10F8 /* IntSize.cpp in Sources */,
+ 2D116E1323E0CB3A00208900 /* iOSMouseSupport.mm in Sources */,
5C0BF8931DD599BD00B00328 /* IsNavigationActionTrusted.mm in Sources */,
CD5FF49F2162E943004BD86F /* ISOBox.cpp in Sources */,
5C69BDD51F82A7EF000F4F4B /* _javascript_DuringNavigation.mm in Sources */,
@@ -5021,7 +5022,6 @@
7A6A2C701DCCFA8C00C0D085 /* LocalStorageQuirkTest.mm in Sources */,
6BF4A683239ED4CD00E2F45B /* LoggedInStatus.cpp in Sources */,
076E507F1F4513D6006E9F5A /* Logging.cpp in Sources */,
- 2D116E1323E0CB3A00208900 /* MacCatalystMouseSupport.mm in Sources */,
CE1866491F72E8F100A0CAB6 /* MarkedText.cpp in Sources */,
07CC7DFE2266330900E39181 /* MediaBufferingPolicy.mm in Sources */,
CDA315981ED53651009F60D3 /* MediaPlaybackSleepAssertion.mm in Sources */,
Deleted: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/MacCatalystMouseSupport.mm (261639 => 261640)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/MacCatalystMouseSupport.mm 2020-05-13 19:57:05 UTC (rev 261639)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/MacCatalystMouseSupport.mm 2020-05-13 19:59:08 UTC (rev 261640)
@@ -1,186 +0,0 @@
-/*
- * Copyright (C) 2020 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.
- */
-
-#import "config.h"
-
-#if PLATFORM(MACCATALYST)
-
-#import "PlatformUtilities.h"
-#import "Test.h"
-#import "TestNavigationDelegate.h"
-#import "TestWKWebView.h"
-#import "UIKitSPI.h"
-#import <WebKit/WKWebViewConfigurationPrivate.h>
-#import <WebKit/WKWebViewPrivateForTesting.h>
-#import <WebKit/WebKit.h>
-#import <wtf/RetainPtr.h>
-
-@interface WKMouseGestureRecognizer : UIGestureRecognizer
-- (void)_hoverEntered:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
-- (void)_hoverExited:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
-- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
-- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
-@end
-
-@interface WKContentView ()
-- (void)_mouseGestureRecognizerChanged:(WKMouseGestureRecognizer *)gestureRecognizer;
-@end
-
-@interface WKTestingEvent : UIEvent
-@end
-
-@implementation WKTestingEvent {
- UIEventButtonMask _buttonMask;
-}
-
-- (CGPoint)locationInView:(UIView *)view
-{
- return CGPointMake(10, 10);
-}
-
-- (void)_setButtonMask:(UIEventButtonMask)buttonMask
-{
- _buttonMask = buttonMask;
-}
-
-- (UIEventButtonMask)_buttonMask
-{
- return _buttonMask;
-}
-
-@end
-
-@interface WKTestingTouch : UITouch
-@end
-
-@implementation WKTestingTouch {
- NSUInteger _tapCount;
-}
-
-- (CGPoint)locationInView:(UIView *)view
-{
- return CGPointMake(10, 10);
-}
-
-- (void)setTapCount:(NSUInteger)tapCount
-{
- _tapCount = tapCount;
-}
-
-- (NSUInteger)tapCount
-{
- return _tapCount;
-}
-
-@end
-
-static WKMouseGestureRecognizer *mouseGesture(UIView *view)
-{
- for (UIGestureRecognizer *recognizer in view.gestureRecognizers) {
- if ([recognizer isKindOfClass:NSClassFromString(@"WKMouseGestureRecognizer")])
- return (WKMouseGestureRecognizer *)recognizer;
- }
-
- return nil;
-}
-
-TEST(MacCatalystMouseSupport, DoNotChangeSelectionWithRightClick)
-{
- auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
- auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
- [webView synchronouslyLoadTestPageNamed:@"simple"];
- [webView objectByEvaluatingJavaScript:@"document.body.setAttribute('contenteditable','');"];
-
- auto contentView = [webView wkContentView];
- auto gesture = mouseGesture(contentView);
-
- RetainPtr<WKTestingTouch> touch = adoptNS([[WKTestingTouch alloc] init]);
- RetainPtr<NSSet> touchSet = [NSSet setWithObject:touch.get()];
-
- RetainPtr<WKTestingEvent> event = adoptNS([[WKTestingEvent alloc] init]);
-
- [gesture _hoverEntered:touchSet.get() withEvent:event.get()];
- [contentView _mouseGestureRecognizerChanged:gesture];
- [touch setTapCount:1];
- [event _setButtonMask:UIEventButtonMaskSecondary];
- [gesture touchesBegan:touchSet.get() withEvent:event.get()];
- [contentView _mouseGestureRecognizerChanged:gesture];
- [gesture touchesEnded:touchSet.get() withEvent:event.get()];
- [contentView _mouseGestureRecognizerChanged:gesture];
-
- __block bool done = false;
-
- [webView _doAfterProcessingAllPendingMouseEvents:^{
- NSNumber *result = [webView objectByEvaluatingJavaScript:@"window.getSelection().isCollapsed"];
- EXPECT_TRUE([result boolValue]);
- done = true;
- }];
-
- TestWebKitAPI::Util::run(&done);
-}
-
-TEST(MacCatalystMouseSupport, TrackButtonMaskFromTouchStart)
-{
- auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
- auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
- [webView synchronouslyLoadHTMLString:@"<script>"
- "window.didReleaseRightButton = false;"
- "document.documentElement.addEventListener('mouseup', function (e) {"
- " if (e.button == 2)"
- " window.didReleaseRightButton = true;"
- "});"
- "</script>"];
-
- auto contentView = [webView wkContentView];
- auto gesture = mouseGesture(contentView);
-
- RetainPtr<WKTestingTouch> touch = adoptNS([[WKTestingTouch alloc] init]);
- RetainPtr<NSSet> touchSet = [NSSet setWithObject:touch.get()];
-
- RetainPtr<WKTestingEvent> event = adoptNS([[WKTestingEvent alloc] init]);
-
- [gesture _hoverEntered:touchSet.get() withEvent:event.get()];
- [contentView _mouseGestureRecognizerChanged:gesture];
- [touch setTapCount:1];
- [event _setButtonMask:UIEventButtonMaskSecondary];
- [gesture touchesBegan:touchSet.get() withEvent:event.get()];
- [contentView _mouseGestureRecognizerChanged:gesture];
- [event _setButtonMask:0];
- [gesture touchesEnded:touchSet.get() withEvent:event.get()];
- [contentView _mouseGestureRecognizerChanged:gesture];
-
- __block bool done = false;
-
- [webView _doAfterProcessingAllPendingMouseEvents:^{
- NSNumber *result = [webView objectByEvaluatingJavaScript:@"window.didReleaseRightButton"];
- EXPECT_TRUE([result boolValue]);
- done = true;
- }];
-
- TestWebKitAPI::Util::run(&done);
-}
-
-
-#endif // PLATFORM(MACCATALYST)
Copied: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm (from rev 261639, trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/MacCatalystMouseSupport.mm) (0 => 261640)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/iOSMouseSupport.mm 2020-05-13 19:59:08 UTC (rev 261640)
@@ -0,0 +1,252 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+
+#import "config.h"
+
+#if PLATFORM(IOS) || PLATFORM(MACCATALYST)
+
+#import "PlatformUtilities.h"
+#import "Test.h"
+#import "TestNavigationDelegate.h"
+#import "TestWKWebView.h"
+#import "UIKitSPI.h"
+#import <WebKit/WKWebViewConfigurationPrivate.h>
+#import <WebKit/WKWebViewPrivateForTesting.h>
+#import <WebKit/WKWebpagePreferencesPrivate.h>
+#import <WebKit/WebKit.h>
+#import <wtf/RetainPtr.h>
+
+@interface WKMouseGestureRecognizer : UIGestureRecognizer
+- (void)_hoverEntered:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
+- (void)_hoverExited:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
+- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
+- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
+@end
+
+@interface WKContentView ()
+- (void)mouseGestureRecognizerChanged:(WKMouseGestureRecognizer *)gestureRecognizer;
+@end
+
+@interface WKTestingEvent : UIEvent
+@end
+
+@implementation WKTestingEvent {
+ UIEventButtonMask _buttonMask;
+}
+
+- (CGPoint)locationInView:(UIView *)view
+{
+ return CGPointMake(10, 10);
+}
+
+- (void)_setButtonMask:(UIEventButtonMask)buttonMask
+{
+ _buttonMask = buttonMask;
+}
+
+- (UIEventButtonMask)_buttonMask
+{
+ return _buttonMask;
+}
+
+@end
+
+@interface WKTestingTouch : UITouch
+@end
+
+@implementation WKTestingTouch {
+ NSUInteger _tapCount;
+}
+
+- (CGPoint)locationInView:(UIView *)view
+{
+ return CGPointMake(10, 10);
+}
+
+- (void)setTapCount:(NSUInteger)tapCount
+{
+ _tapCount = tapCount;
+}
+
+- (NSUInteger)tapCount
+{
+ return _tapCount;
+}
+
+@end
+
+static WKMouseGestureRecognizer *mouseGesture(UIView *view)
+{
+ for (UIGestureRecognizer *recognizer in view.gestureRecognizers) {
+ if ([recognizer isKindOfClass:NSClassFromString(@"WKMouseGestureRecognizer")])
+ return (WKMouseGestureRecognizer *)recognizer;
+ }
+
+ return nil;
+}
+
+TEST(iOSMouseSupport, DoNotChangeSelectionWithRightClick)
+{
+ auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
+ [webView synchronouslyLoadTestPageNamed:@"simple"];
+ [webView objectByEvaluatingJavaScript:@"document.body.setAttribute('contenteditable','');"];
+
+ auto contentView = [webView wkContentView];
+ auto gesture = mouseGesture(contentView);
+
+ RetainPtr<WKTestingTouch> touch = adoptNS([[WKTestingTouch alloc] init]);
+ RetainPtr<NSSet> touchSet = [NSSet setWithObject:touch.get()];
+
+ RetainPtr<WKTestingEvent> event = adoptNS([[WKTestingEvent alloc] init]);
+
+ [gesture _hoverEntered:touchSet.get() withEvent:event.get()];
+ [contentView mouseGestureRecognizerChanged:gesture];
+ [touch setTapCount:1];
+ [event _setButtonMask:UIEventButtonMaskSecondary];
+ [gesture touchesBegan:touchSet.get() withEvent:event.get()];
+ [contentView mouseGestureRecognizerChanged:gesture];
+ [gesture touchesEnded:touchSet.get() withEvent:event.get()];
+ [contentView mouseGestureRecognizerChanged:gesture];
+
+ __block bool done = false;
+
+ [webView _doAfterProcessingAllPendingMouseEvents:^{
+ NSNumber *result = [webView objectByEvaluatingJavaScript:@"window.getSelection().isCollapsed"];
+ EXPECT_TRUE([result boolValue]);
+ done = true;
+ }];
+
+ TestWebKitAPI::Util::run(&done);
+}
+
+TEST(iOSMouseSupport, TrackButtonMaskFromTouchStart)
+{
+ auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]);
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]);
+ [webView synchronouslyLoadHTMLString:@"<script>"
+ "window.didReleaseRightButton = false;"
+ "document.documentElement.addEventListener('mouseup', function (e) {"
+ " if (e.button == 2)"
+ " window.didReleaseRightButton = true;"
+ "});"
+ "</script>"];
+
+ auto contentView = [webView wkContentView];
+ auto gesture = mouseGesture(contentView);
+
+ RetainPtr<WKTestingTouch> touch = adoptNS([[WKTestingTouch alloc] init]);
+ RetainPtr<NSSet> touchSet = [NSSet setWithObject:touch.get()];
+
+ RetainPtr<WKTestingEvent> event = adoptNS([[WKTestingEvent alloc] init]);
+
+ [gesture _hoverEntered:touchSet.get() withEvent:event.get()];
+ [contentView mouseGestureRecognizerChanged:gesture];
+ [touch setTapCount:1];
+ [event _setButtonMask:UIEventButtonMaskSecondary];
+ [gesture touchesBegan:touchSet.get() withEvent:event.get()];
+ [contentView mouseGestureRecognizerChanged:gesture];
+ [event _setButtonMask:0];
+ [gesture touchesEnded:touchSet.get() withEvent:event.get()];
+ [contentView mouseGestureRecognizerChanged:gesture];
+
+ __block bool done = false;
+
+ [webView _doAfterProcessingAllPendingMouseEvents:^{
+ NSNumber *result = [webView objectByEvaluatingJavaScript:@"window.didReleaseRightButton"];
+ EXPECT_TRUE([result boolValue]);
+ done = true;
+ }];
+
+ TestWebKitAPI::Util::run(&done);
+}
+
+#if ENABLE(IOS_TOUCH_EVENTS)
+
+TEST(iOSMouseSupport, WebsiteMouseEventPolicies)
+{
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+
+ auto contentView = [webView wkContentView];
+ auto gesture = mouseGesture(contentView);
+
+ void (^tapAndWait)(void) = ^{
+ RetainPtr<WKTestingTouch> touch = adoptNS([[WKTestingTouch alloc] init]);
+ RetainPtr<NSSet> touchSet = [NSSet setWithObject:touch.get()];
+
+ RetainPtr<WKTestingEvent> event = adoptNS([[WKTestingEvent alloc] init]);
+
+ [gesture _hoverEntered:touchSet.get() withEvent:event.get()];
+ [contentView mouseGestureRecognizerChanged:gesture];
+ [touch setTapCount:1];
+ [event _setButtonMask:UIEventButtonMaskPrimary];
+ [gesture touchesBegan:touchSet.get() withEvent:event.get()];
+ [contentView mouseGestureRecognizerChanged:gesture];
+ [event _setButtonMask:0];
+ [gesture touchesEnded:touchSet.get() withEvent:event.get()];
+ [contentView mouseGestureRecognizerChanged:gesture];
+
+ __block bool done = false;
+
+ [webView _doAfterProcessingAllPendingMouseEvents:^{
+ done = true;
+ }];
+
+ TestWebKitAPI::Util::run(&done);
+ };
+
+ // By default, a mouse should generate mouse events.
+
+ [webView synchronouslyLoadHTMLString:@"<script>"
+ "window.lastPointerEventType = undefined;"
+ "document.documentElement.addEventListener('pointerdown', function (e) {"
+ " window.lastPointerEventType = e.pointerType;"
+ "});"
+ "</script>"];
+
+ tapAndWait();
+
+ NSString *result = [webView objectByEvaluatingJavaScript:@"window.lastPointerEventType"];
+ EXPECT_WK_STREQ("mouse", result);
+
+ EXPECT_TRUE([gesture isEnabled]);
+
+ // If loaded with _WKWebsiteMouseEventPolicySynthesizeTouchEvents, it should send touch events instead.
+
+ WKWebpagePreferences *preferences = [[[WKWebpagePreferences alloc] init] autorelease];
+ preferences._mouseEventPolicy = _WKWebsiteMouseEventPolicySynthesizeTouchEvents;
+
+ [webView synchronouslyLoadHTMLString:@"two" preferences:preferences];
+
+ // FIXME: Because we're directly calling mouseGestureRecognizerChanged: to emulate the gesture recognizer,
+ // we can't just tapAndWait() again and expect the fact that it's disabled to stop the mouse events.
+ // Instead, we'll just ensure that the gesture is disabled.
+
+ EXPECT_FALSE([gesture isEnabled]);
+}
+
+#endif // ENABLE(IOS_TOUCH_EVENTS)
+
+#endif // PLATFORM(IOS) || PLATFORM(MACCATALYST)