Diff
Modified: trunk/Source/WebKit/ChangeLog (243796 => 243797)
--- trunk/Source/WebKit/ChangeLog 2019-04-03 13:00:16 UTC (rev 243796)
+++ trunk/Source/WebKit/ChangeLog 2019-04-03 15:02:07 UTC (rev 243797)
@@ -1,3 +1,24 @@
+2019-04-03 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Add plumbing for a compatibility mode preference in WebKit
+ https://bugs.webkit.org/show_bug.cgi?id=196005
+
+ Reviewed by Tim Horton.
+
+ Add plumbing between the Cocoa API object (WKWebpagePreferences) and the inner C++ API object
+ (API::WebsitePolicies) for compatibility mode.
+
+ * Shared/WebCompatibilityMode.h: Added.
+ * UIProcess/API/APIWebsitePolicies.h:
+ * UIProcess/API/Cocoa/WKWebpagePreferences.mm:
+ * UIProcess/Cocoa/NavigationState.mm:
+ (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::adjustPoliciesForCompatibilityMode):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/ios/WebPageProxyIOS.mm:
+ * WebKit.xcodeproj/project.pbxproj:
+
2019-04-03 Carlos Garcia Campos <cgar...@igalia.com>
[CoordinatedGraphics] Hidden pages are not suspended after a web view resize
Added: trunk/Source/WebKit/Shared/WebCompatibilityMode.h (0 => 243797)
--- trunk/Source/WebKit/Shared/WebCompatibilityMode.h (rev 0)
+++ trunk/Source/WebKit/Shared/WebCompatibilityMode.h 2019-04-03 15:02:07 UTC (rev 243797)
@@ -0,0 +1,38 @@
+/*
+ * 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 WebCompatibilityMode {
+ Default,
+ Legacy,
+ Modern,
+};
+
+}
Modified: trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.h (243796 => 243797)
--- trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.h 2019-04-03 13:00:16 UTC (rev 243796)
+++ trunk/Source/WebKit/UIProcess/API/APIWebsitePolicies.h 2019-04-03 15:02:07 UTC (rev 243797)
@@ -26,6 +26,7 @@
#pragma once
#include "APIObject.h"
+#include "WebCompatibilityMode.h"
#include "WebsiteAutoplayPolicy.h"
#include "WebsiteAutoplayQuirk.h"
#include "WebsitePopUpPolicy.h"
@@ -80,6 +81,9 @@
void setCustomNavigatorPlatform(const WTF::String& customNavigatorPlatform) { m_customNavigatorPlatform = customNavigatorPlatform; }
const WTF::String& customNavigatorPlatform() const { return m_customNavigatorPlatform; }
+ WebKit::WebCompatibilityMode preferredCompatibilityMode() const { return m_preferredCompatibilityMode; }
+ void setPreferredCompatibilityMode(WebKit::WebCompatibilityMode mode) { m_preferredCompatibilityMode = mode; }
+
private:
WebsitePolicies(bool contentBlockersEnabled, OptionSet<WebKit::WebsiteAutoplayQuirk>, WebKit::WebsiteAutoplayPolicy, Vector<WebCore::HTTPHeaderField>&&, WebKit::WebsitePopUpPolicy, RefPtr<WebsiteDataStore>&&);
@@ -93,6 +97,7 @@
WTF::String m_customUserAgent;
WTF::String m_customJavaScriptUserAgentAsSiteSpecificQuirks;
WTF::String m_customNavigatorPlatform;
+ WebKit::WebCompatibilityMode m_preferredCompatibilityMode { WebKit::WebCompatibilityMode::Default };
};
} // namespace API
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm (243796 => 243797)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm 2019-04-03 13:00:16 UTC (rev 243796)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm 2019-04-03 15:02:07 UTC (rev 243797)
@@ -28,6 +28,7 @@
#import "WKWebpagePreferencesInternal.h"
#import "WKWebsiteDataStoreInternal.h"
+#import "WebCompatibilityMode.h"
#import "_WKWebsitePoliciesInternal.h"
#import <wtf/RetainPtr.h>
@@ -252,4 +253,8 @@
return *_websitePolicies;
}
+#if USE(APPLE_INTERNAL_SDK)
+#import <WebKitAdditions/WKWebpagePreferencesAdditions.mm>
+#endif
+
@end
Modified: trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm (243796 => 243797)
--- trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2019-04-03 13:00:16 UTC (rev 243796)
+++ trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2019-04-03 15:02:07 UTC (rev 243797)
@@ -522,6 +522,9 @@
return;
}
+ if (defaultWebsitePolicies)
+ webPage->adjustPoliciesForCompatibilityMode(navigationAction, *defaultWebsitePolicies);
+
if (!navigationAction->targetFrame()) {
listener->use(defaultWebsitePolicies.get());
return;
@@ -591,6 +594,8 @@
[NSException raise:NSInvalidArgumentException format:@"WKWebpagePreferences._customUserAgent must be nil for subframe navigations."];
if (!apiWebsitePolicies->customNavigatorPlatform().isNull() && subframeNavigation)
[NSException raise:NSInvalidArgumentException format:@"WKWebpagePreferences._customNavigatorPlatform must be nil for subframe navigations."];
+
+ webPageProxy->adjustPoliciesForCompatibilityMode(navigationAction, *apiWebsitePolicies);
}
switch (actionPolicy) {
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (243796 => 243797)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-04-03 13:00:16 UTC (rev 243796)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2019-04-03 15:02:07 UTC (rev 243797)
@@ -8902,6 +8902,14 @@
}
#endif // ENABLE(SPEECH_SYNTHESIS)
+#if !PLATFORM(IOS_FAMILY) || !USE(APPLE_INTERNAL_SDK)
+
+void WebPageProxy::adjustPoliciesForCompatibilityMode(const API::NavigationAction&, API::WebsitePolicies&)
+{
+}
+
+#endif // !PLATFORM(IOS_FAMILY) || !USE(APPLE_INTERNAL_SDK)
+
void WebPageProxy::addObserver(WebViewDidMoveToWindowObserver& observer)
{
auto result = m_webViewDidMoveToWindowObservers.add(&observer, makeWeakPtr(observer));
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (243796 => 243797)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-04-03 13:00:16 UTC (rev 243796)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2019-04-03 15:02:07 UTC (rev 243797)
@@ -1506,6 +1506,7 @@
#endif
void configureLoggingChannel(const String&, WTFLogChannelState, WTFLogLevel);
+ void adjustPoliciesForCompatibilityMode(const API::NavigationAction&, API::WebsitePolicies&);
void addObserver(WebViewDidMoveToWindowObserver&);
void removeObserver(WebViewDidMoveToWindowObserver&);
Modified: trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (243796 => 243797)
--- trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2019-04-03 13:00:16 UTC (rev 243796)
+++ trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm 2019-04-03 15:02:07 UTC (rev 243797)
@@ -28,7 +28,9 @@
#if PLATFORM(IOS_FAMILY)
+#import "APINavigationAction.h"
#import "APIUIClient.h"
+#import "APIWebsitePolicies.h"
#import "Connection.h"
#import "DataReference.h"
#import "DocumentEditingContext.h"
@@ -1241,6 +1243,10 @@
#endif
+#if USE(APPLE_INTERNAL_SDK)
+#import <WebKitAdditions/WebPageProxyIOSAdditions.mm>
+#endif
+
} // namespace WebKit
#endif // PLATFORM(IOS_FAMILY)
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (243796 => 243797)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2019-04-03 13:00:16 UTC (rev 243796)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2019-04-03 15:02:07 UTC (rev 243797)
@@ -1636,6 +1636,7 @@
ECA680D81E690E2500731D20 /* WebProcessCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = ECA680D71E690DF800731D20 /* WebProcessCocoa.h */; settings = {ATTRIBUTES = (Private, ); }; };
ED82A7F2128C6FAF004477B3 /* WKBundlePageOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A22F0FF1289FCD90085E74F /* WKBundlePageOverlay.h */; settings = {ATTRIBUTES = (Private, ); }; };
F409BA181E6E64BC009DA28E /* WKDragDestinationAction.h in Headers */ = {isa = PBXBuildFile; fileRef = F409BA171E6E64B3009DA28E /* WKDragDestinationAction.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ F430E94422473DFF005FE053 /* WebCompatibilityMode.h in Headers */ = {isa = PBXBuildFile; fileRef = F430E94322473DB8005FE053 /* WebCompatibilityMode.h */; };
F438CD1C2241421400DE6DDA /* WKWebpagePreferences.h in Headers */ = {isa = PBXBuildFile; fileRef = F438CD1B224140A600DE6DDA /* WKWebpagePreferences.h */; settings = {ATTRIBUTES = (Public, ); }; };
F438CD1F22414D4000DE6DDA /* WKWebpagePreferencesInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = F438CD1E22414D4000DE6DDA /* WKWebpagePreferencesInternal.h */; };
F438CD212241F69500DE6DDA /* WKWebpagePreferencesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = F438CD202241F69500DE6DDA /* WKWebpagePreferencesPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -4571,6 +4572,7 @@
F409BA171E6E64B3009DA28E /* WKDragDestinationAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKDragDestinationAction.h; sourceTree = "<group>"; };
F40D1B68220BDC0F00B49A01 /* WebAutocorrectionContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WebAutocorrectionContext.h; path = ios/WebAutocorrectionContext.h; sourceTree = "<group>"; };
F41056612130699A0092281D /* APIAttachmentCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = APIAttachmentCocoa.mm; sourceTree = "<group>"; };
+ F430E94322473DB8005FE053 /* WebCompatibilityMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebCompatibilityMode.h; sourceTree = "<group>"; };
F438CD1B224140A600DE6DDA /* WKWebpagePreferences.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WKWebpagePreferences.h; sourceTree = "<group>"; };
F438CD1D22414AD600DE6DDA /* WKWebpagePreferences.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebpagePreferences.mm; sourceTree = "<group>"; };
F438CD1E22414D4000DE6DDA /* WKWebpagePreferencesInternal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WKWebpagePreferencesInternal.h; sourceTree = "<group>"; };
@@ -5163,6 +5165,7 @@
518D2CAB12D5153B003BB93B /* WebBackForwardListItem.cpp */,
518D2CAC12D5153B003BB93B /* WebBackForwardListItem.h */,
BCF50726124329AA005955AE /* WebCertificateInfo.h */,
+ F430E94322473DB8005FE053 /* WebCompatibilityMode.h */,
7C4ABECE1AA8E9F00088AA37 /* WebCompiledContentRuleList.cpp */,
7C4ABECF1AA8E9F00088AA37 /* WebCompiledContentRuleList.h */,
7C4ABED21AA8FCB80088AA37 /* WebCompiledContentRuleListData.cpp */,
@@ -9527,6 +9530,7 @@
3F87B9BE158940190090FF62 /* WebColorChooser.h in Headers */,
3F87B9C0158940D80090FF62 /* WebColorPicker.h in Headers */,
728E86F11795188C0087879E /* WebColorPickerMac.h in Headers */,
+ F430E94422473DFF005FE053 /* WebCompatibilityMode.h in Headers */,
7C4ABED11AA8E9F00088AA37 /* WebCompiledContentRuleList.h in Headers */,
7C4ABED51AA8FCB80088AA37 /* WebCompiledContentRuleListData.h in Headers */,
BC4A6290147312BE006C681A /* WebConnection.h in Headers */,
Modified: trunk/Tools/ChangeLog (243796 => 243797)
--- trunk/Tools/ChangeLog 2019-04-03 13:00:16 UTC (rev 243796)
+++ trunk/Tools/ChangeLog 2019-04-03 15:02:07 UTC (rev 243797)
@@ -1,3 +1,15 @@
+2019-04-03 Wenson Hsieh <wenson_hs...@apple.com>
+
+ Add plumbing for a compatibility mode preference in WebKit
+ https://bugs.webkit.org/show_bug.cgi?id=196005
+
+ Reviewed by Tim Horton.
+
+ Add new API tests.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/ios/PreferredCompatibilityMode.mm: Added.
+
2019-04-03 Claudio Saavedra <csaave...@igalia.com>
[WPE][GTK] Update libsrtp dependency package for Debian
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (243796 => 243797)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2019-04-03 13:00:16 UTC (rev 243796)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2019-04-03 15:02:07 UTC (rev 243797)
@@ -913,6 +913,7 @@
F4811E5921940BDE00A5E0FD /* WKWebViewEditActions.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4811E5821940B4400A5E0FD /* WKWebViewEditActions.mm */; };
F4856CA31E649EA8009D7EE7 /* attachment-element.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4856CA21E6498A8009D7EE7 /* attachment-element.html */; };
F486B1D01F67952300F34BDD /* DataTransfer-setDragImage.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F486B1CF1F6794FF00F34BDD /* DataTransfer-setDragImage.html */; };
+ F48D6C10224B377000E3E2FB /* PreferredCompatibilityMode.mm in Sources */ = {isa = PBXBuildFile; fileRef = F48D6C0F224B377000E3E2FB /* PreferredCompatibilityMode.mm */; };
F4A32EC41F05F3850047C544 /* dragstart-change-selection-offscreen.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4A32EC31F05F3780047C544 /* dragstart-change-selection-offscreen.html */; };
F4A32ECB1F0643370047C544 /* contenteditable-in-iframe.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4A32ECA1F0642F40047C544 /* contenteditable-in-iframe.html */; };
F4A9202F1FEE34E900F59590 /* apple-data-url.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4A9202E1FEE34C800F59590 /* apple-data-url.html */; };
@@ -2288,6 +2289,7 @@
F4811E5821940B4400A5E0FD /* WKWebViewEditActions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewEditActions.mm; sourceTree = "<group>"; };
F4856CA21E6498A8009D7EE7 /* attachment-element.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "attachment-element.html"; sourceTree = "<group>"; };
F486B1CF1F6794FF00F34BDD /* DataTransfer-setDragImage.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "DataTransfer-setDragImage.html"; sourceTree = "<group>"; };
+ F48D6C0F224B377000E3E2FB /* PreferredCompatibilityMode.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PreferredCompatibilityMode.mm; sourceTree = "<group>"; };
F493247C1F44DF8D006F4336 /* UIKitSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UIKitSPI.h; sourceTree = "<group>"; };
F4A32EC31F05F3780047C544 /* dragstart-change-selection-offscreen.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "dragstart-change-selection-offscreen.html"; sourceTree = "<group>"; };
F4A32ECA1F0642F40047C544 /* contenteditable-in-iframe.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "contenteditable-in-iframe.html"; sourceTree = "<group>"; };
@@ -2719,6 +2721,7 @@
F4CDAB3322489FE10057A2D9 /* IPadUserInterfaceSwizzler.h */,
2E7765CC16C4D80A00BA2BB1 /* mainIOS.mm */,
2D61EC3021B0B75C00A7D1CB /* PencilKitTestSPI.h */,
+ F48D6C0F224B377000E3E2FB /* PreferredCompatibilityMode.mm */,
F4517B652054C49500C26721 /* TestWKWebViewController.h */,
F4517B662054C49500C26721 /* TestWKWebViewController.mm */,
F493247C1F44DF8D006F4336 /* UIKitSPI.h */,
@@ -4246,6 +4249,7 @@
83BAEE8D1EF4625500DDE894 /* PluginLoadClientPolicies.mm in Sources */,
7CCE7F261A411AF600447C4C /* Preferences.mm in Sources */,
CD227E44211A4D5D00D285AF /* PreferredAudioBufferSize.mm in Sources */,
+ F48D6C10224B377000E3E2FB /* PreferredCompatibilityMode.mm in Sources */,
7C1AF7951E8DCBAB002645B9 /* PrepareForMoveToWindow.mm in Sources */,
7CCE7F0B1A411AE600447C4C /* PreventEmptyUserAgent.cpp in Sources */,
7CCE7F2C1A411B1000447C4C /* PreventImageLoadWithAutoResizing.mm in Sources */,
Added: trunk/Tools/TestWebKitAPI/ios/PreferredCompatibilityMode.mm (0 => 243797)
--- trunk/Tools/TestWebKitAPI/ios/PreferredCompatibilityMode.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/ios/PreferredCompatibilityMode.mm 2019-04-03 15:02:07 UTC (rev 243797)
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+#import "config.h"
+
+#if USE(APPLE_INTERNAL_SDK)
+#import <WebKitAdditions/PreferredCompatibilityModeAdditions.mm>
+#endif