Title: [269760] trunk
Revision
269760
Author
wei...@apple.com
Date
2020-11-12 16:20:43 -0800 (Thu, 12 Nov 2020)

Log Message

Move more WebKitLegacy specific settings usage to WebPreferences.yaml
https://bugs.webkit.org/show_bug.cgi?id=218852

Reviewed by Tim Horton.

Source/WebCore:

This batch focuses on settings with defaults based on SDK/host app conditions.

* page/Settings.yaml:

Source/WebKitLegacy/mac:

This batch focuses on settings with defaults based on SDK/host app conditions.

* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
* WebView/WebPreferencesDefaultValues.h:
* WebView/WebPreferencesDefaultValues.mm:
(WebKit::defaultAllowContentSecurityPolicySourceStarToMatchAnyProtocol):
(WebKit::defaultLoadDeferringEnabled):
(WebKit::defaultWindowFocusRestricted):
(WebKit::defaultUsePreHTML5ParserQuirks):
(WebKit::defaultNeedsAdobeFrameReloadingQuirk):
(WebKit::defaultTreatsAnyTextCSSLinkAsStylesheet):
(WebKit::defaultNeedsFrameNameFallbackToIdQuirk):
(WebKit::defaultNeedsKeyboardEventDisambiguationQuirks):
(WebKit::defaultEnforceCSSMIMETypeInNoQuirksMode):
(WebKit::defaultNeedsIsLoadingInAPISenseQuirk):
(WebKit::defaultUseLegacyBackgroundSizeShorthandBehavior):
(WebKit::defaultAllowDisplayOfInsecureContent):
(WebKit::defaultAllowRunningOfInsecureContent):
(WebKit::defaultShouldConvertInvalidURLsToBlank):
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(needsSelfRetainWhileLoadingQuirk):
(-[WebView _preferencesChanged:]):
(-[WebView dealloc]):
(-[WebView setFrameLoadDelegate:]):
(shouldEnableLoadDeferring): Deleted.
(shouldRestrictWindowFocus): Deleted.
(shouldUseLegacyBackgroundSizeShorthandBehavior): Deleted.
(shouldAllowDisplayAndRunningOfInsecureContent): Deleted.
(shouldAllowContentSecurityPolicySourceStarToMatchAnyProtocol): Deleted.
(shouldConvertInvalidURLsToBlank): Deleted.
(-[WebView _needsAdobeFrameReloadingQuirk]): Deleted.
(-[WebView _needsLinkElementTextCSSQuirk]): Deleted.
(-[WebView _needsFrameNameFallbackToIdQuirk]): Deleted.
(-[WebView _needsIsLoadingInAPISenseQuirk]): Deleted.
(-[WebView _needsKeyboardEventDisambiguationQuirks]): Deleted.
(-[WebView _needsPreHTML5ParserQuirks]): Deleted.

Source/WTF:

This batch focuses on settings with defaults based on SDK/host app conditions.

* Scripts/Preferences/WebPreferences.yaml:

Tools:

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues):
Remove unnecessary call of [WebPreferences setUsePreHTML5ParserQuirks:NO] as this is the default.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (269759 => 269760)


--- trunk/Source/WTF/ChangeLog	2020-11-12 23:59:47 UTC (rev 269759)
+++ trunk/Source/WTF/ChangeLog	2020-11-13 00:20:43 UTC (rev 269760)
@@ -1,3 +1,14 @@
+2020-11-12  Sam Weinig  <wei...@apple.com>
+
+        Move more WebKitLegacy specific settings usage to WebPreferences.yaml
+        https://bugs.webkit.org/show_bug.cgi?id=218852
+
+        Reviewed by Tim Horton.
+
+        This batch focuses on settings with defaults based on SDK/host app conditions.
+
+        * Scripts/Preferences/WebPreferences.yaml:
+
 2020-11-12  Devin Rousso  <drou...@apple.com>
 
         Web Inspector: ensure that `JSON::ArrayOf<T>` doesn't allow `addItem` to be called with a type other than `T`

Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferences.yaml (269759 => 269760)


--- trunk/Source/WTF/Scripts/Preferences/WebPreferences.yaml	2020-11-12 23:59:47 UTC (rev 269759)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferences.yaml	2020-11-13 00:20:43 UTC (rev 269760)
@@ -77,6 +77,17 @@
     WebCore:
       default: false
 
+AllowContentSecurityPolicySourceStarToMatchAnyProtocol:
+  type: bool
+  defaultValue:
+    WebKitLegacy:
+      PLATFORM(IOS_FAMILY): WebKit::defaultAllowContentSecurityPolicySourceStarToMatchAnyProtocol()
+      default: false
+    WebKit:
+      default: false
+    WebCore:
+      default: false
+
 AllowCrossOriginSubresourcesToAskForCredentials:
   type: bool
   defaultValue:
@@ -87,6 +98,16 @@
     WebCore:
       default: false
 
+AllowDisplayOfInsecureContent:
+  type: bool
+  defaultValue:
+    WebKitLegacy:
+      default: WebKit::defaultAllowDisplayOfInsecureContent()
+    WebKit:
+      default: false
+    WebCore:
+      default: false
+
 AllowFileAccessFromFileURLs:
   type: bool
   defaultValue:
@@ -121,6 +142,16 @@
     WebCore:
       default: false
 
+AllowRunningOfInsecureContent:
+  type: bool
+  defaultValue:
+    WebKitLegacy:
+      default: WebKit::defaultAllowRunningOfInsecureContent()
+    WebKit:
+      default: false
+    WebCore:
+      default: false
+
 AllowSettingAnyXHRHeaderFromFileURLs:
   type: bool
   defaultValue:
@@ -681,6 +712,17 @@
     WebCore:
       default: false
 
+EnforceCSSMIMETypeInNoQuirksMode:
+  type: bool
+  defaultValue:
+    WebKitLegacy:
+      PLATFORM(MAC): WebKit::defaultEnforceCSSMIMETypeInNoQuirksMode()
+      default: true
+    WebKit:
+      default: true
+    WebCore:
+      default: true
+
 EnumeratingAllNetworkInterfacesEnabled:
   type: bool
   webcoreBinding: none
@@ -1182,6 +1224,17 @@
     WebCore:
       default: true
 
+LoadDeferringEnabled:
+  type: bool
+  defaultValue:
+    WebKitLegacy:
+      PLATFORM(MAC): WebKit::defaultLoadDeferringEnabled()
+      default: true
+    WebKit:
+      default: true
+    WebCore:
+      default: true
+
 # This only suppresses the network load of the image URL. A cached image will still be rendered if requested.
 LoadsImagesAutomatically:
   type: bool
@@ -1461,6 +1514,58 @@
       "PLATFORM(COCOA)": true
       default: false
 
+NeedsAdobeFrameReloadingQuirk:
+  comment: 'FIXME: This quirk is needed because of Radar 4674537 and 5211271. We need
+    to phase it out once Adobe can fix the bug from their end.'
+  type: bool
+  webcoreGetter: needsAcrobatFrameReloadingQuirk
+  defaultValue:
+    WebKitLegacy:
+      PLATFORM(MAC): WebKit::defaultNeedsAdobeFrameReloadingQuirk()
+      default: false
+    WebKit:
+      default: false
+    WebCore:
+      default: false
+
+NeedsFrameNameFallbackToIdQuirk:
+  type: bool
+  defaultValue:
+    WebKitLegacy:
+      PLATFORM(MAC): WebKit::defaultNeedsFrameNameFallbackToIdQuirk()
+      default: false
+    WebKit:
+      default: false
+    WebCore:
+      default: false
+
+NeedsIsLoadingInAPISenseQuirk:
+  comment: Some apps needs isLoadingInAPISense to account for active subresource loaders.
+  type: bool
+  defaultValue:
+    WebKitLegacy:
+      PLATFORM(MAC): WebKit::defaultNeedsIsLoadingInAPISenseQuirk()
+      default: false
+    WebKit:
+      default: false
+    WebCore:
+      default: false
+
+NeedsKeyboardEventDisambiguationQuirks:
+  comment: This is a quirk we are pro-actively applying to old applications. It changes
+    keyboard event dispatching, making keyIdentifier available on keypress events,
+    making charCode available on keydown/keyup events, and getting keypress dispatched
+    in more cases.
+  type: bool
+  defaultValue:
+    WebKitLegacy:
+      PLATFORM(MAC): WebKit::defaultNeedsKeyboardEventDisambiguationQuirks()
+      default: false
+    WebKit:
+      default: false
+    WebCore:
+      default: false
+
 NeedsSiteSpecificQuirks:
   type: bool
   webKitLegacyPreferenceKey: WebKitUseSiteSpecificSpoofing
@@ -1819,6 +1924,16 @@
     WebCore:
       default: true
 
+ShouldConvertInvalidURLsToBlank:
+  type: bool
+  defaultValue:
+    WebKitLegacy:
+      default: WebKit::defaultShouldConvertInvalidURLsToBlank()
+    WebKit:
+      default: true
+    WebCore:
+      default: true
+
 ShouldConvertPositionStyleOnCopy:
   type: bool
   defaultValue:
@@ -2182,6 +2297,17 @@
     WebKit:
       default: true
 
+TreatsAnyTextCSSLinkAsStylesheet:
+  type: bool
+  defaultValue:
+    WebKitLegacy:
+      PLATFORM(MAC): WebKit::defaultTreatsAnyTextCSSLinkAsStylesheet()
+      default: false
+    WebKit:
+      default: false
+    WebCore:
+      default: false
+
 UseGiantTiles:
   type: bool
   defaultValue:
@@ -2192,6 +2318,16 @@
     WebCore:
       default: false
 
+UseLegacyBackgroundSizeShorthandBehavior:
+  type: bool
+  defaultValue:
+    WebKitLegacy:
+      default: WebKit::defaultUseLegacyBackgroundSizeShorthandBehavior()
+    WebKit:
+      default: false
+    WebCore:
+      default: false
+
 UseLegacyTextAlignPositionedElementBehavior:
   type: bool
   defaultValue:
@@ -2202,6 +2338,17 @@
     WebCore:
       default: false
 
+UsePreHTML5ParserQuirks:
+  type: bool
+  defaultValue:
+    WebKitLegacy:
+      PLATFORM(MAC): WebKit::defaultUsePreHTML5ParserQuirks()
+      default: false
+    WebKit:
+      default: false
+    WebCore:
+      default: false
+
 # FIXME: There is no custom binding implemented for WebKitLegacy.
 UserInterfaceDirectionPolicy:
   type: uint32_t
@@ -2347,6 +2494,19 @@
     WebCore:
       default: false
 
+WindowFocusRestricted:
+  comment: When enabled, window.blur() does not change focus, and window.focus() only
+    changes focus when invoked from the context that created the window.
+  type: bool
+  defaultValue:
+    WebKitLegacy:
+      PLATFORM(MAC): WebKit::defaultWindowFocusRestricted()
+      default: true
+    WebKit:
+      default: true
+    WebCore:
+      default: true
+
 XSSAuditorEnabled:
   type: bool
   defaultValue:

Modified: trunk/Source/WebCore/ChangeLog (269759 => 269760)


--- trunk/Source/WebCore/ChangeLog	2020-11-12 23:59:47 UTC (rev 269759)
+++ trunk/Source/WebCore/ChangeLog	2020-11-13 00:20:43 UTC (rev 269760)
@@ -1,3 +1,14 @@
+2020-11-12  Sam Weinig  <wei...@apple.com>
+
+        Move more WebKitLegacy specific settings usage to WebPreferences.yaml
+        https://bugs.webkit.org/show_bug.cgi?id=218852
+
+        Reviewed by Tim Horton.
+
+        This batch focuses on settings with defaults based on SDK/host app conditions.
+
+        * page/Settings.yaml:
+
 2020-11-12  Said Abou-Hallawa  <s...@apple.com>
 
         [GPU Process] GraphicsContext::drawPattern() should take a NativeImage argument

Modified: trunk/Source/WebCore/page/Settings.yaml (269759 => 269760)


--- trunk/Source/WebCore/page/Settings.yaml	2020-11-12 23:59:47 UTC (rev 269759)
+++ trunk/Source/WebCore/page/Settings.yaml	2020-11-13 00:20:43 UTC (rev 269760)
@@ -35,24 +35,6 @@
     WebCore:
       default: false
 
-AllowContentSecurityPolicySourceStarToMatchAnyProtocol:
-  type: bool
-  defaultValue:
-    WebCore:
-      default: false
-
-AllowDisplayOfInsecureContent:
-  type: bool
-  defaultValue:
-    WebCore:
-      default: false
-
-AllowRunningOfInsecureContent:
-  type: bool
-  defaultValue:
-    WebCore:
-      default: false
-
 AnimatedImageDebugCanvasDrawingEnabled:
   type: bool
   defaultValue:
@@ -174,12 +156,6 @@
       OS(UNIX): EditingUnixBehavior
       default: EditingMacBehavior
 
-EnforceCSSMIMETypeInNoQuirksMode:
-  type: bool
-  defaultValue:
-    WebCore:
-      default: true
-
 FixedBackgroundsPaintRelativeToDocument:
   type: bool
   defaultValue:
@@ -355,12 +331,6 @@
     WebCore:
       default: false
 
-LoadDeferringEnabled:
-  type: bool
-  defaultValue:
-    WebCore:
-      default: true
-
 LocalStorageDatabasePath:
   type: String
   defaultValue:
@@ -430,16 +400,6 @@
     WebCore:
       default: 257*256
 
-NeedsAdobeFrameReloadingQuirk:
-  comment: >-
-    FIXME: This quirk is needed because of Radar 4674537 and 5211271. We need to phase it
-    out once Adobe can fix the bug from their end.
-  type: bool
-  webcoreGetter: needsAcrobatFrameReloadingQuirk
-  defaultValue:
-    WebCore:
-      default: false
-
 NeedsDeferKeyDownAndKeyPressTimersUntilNextEditingCommandQuirk:
   comment: >-
     This is an iOS-specific quirk. Unlike Mac, keyboard operations are asynchronous and hence a DOM update as
@@ -453,30 +413,6 @@
     WebCore:
       default: false
 
-NeedsFrameNameFallbackToIdQuirk:
-  type: bool
-  defaultValue:
-    WebCore:
-      default: false
-
-NeedsIsLoadingInAPISenseQuirk:
-  comment: >-
-    Some apps needs isLoadingInAPISense to account for active subresource loaders.
-  type: bool
-  defaultValue:
-    WebCore:
-      default: false
-
-NeedsKeyboardEventDisambiguationQuirks:
-  comment: >-
-    This is a quirk we are pro-actively applying to old applications. It changes keyboard event dispatching,
-    making keyIdentifier available on keypress events, making charCode available on keydown/keyup events,
-    and getting keypress dispatched in more cases.
-  type: bool
-  defaultValue:
-    WebCore:
-      default: false
-
 ParserScriptingFlagPolicy:
   type: uint32_t
   refinedType: ParserScriptingFlagPolicy
@@ -552,12 +488,6 @@
     WebCore:
       default: StorageMap::noQuota
 
-ShouldConvertInvalidURLsToBlank:
-  type: bool
-  defaultValue:
-    WebCore:
-      default: true
-
 ShouldDispatchSyntheticMouseEventsWhenModifyingSelection:
   type: bool
   defaultValue:
@@ -647,12 +577,6 @@
     WebCore:
       default: false
 
-TreatsAnyTextCSSLinkAsStylesheet:
-  type: bool
-  defaultValue:
-    WebCore:
-      default: false
-
 UnhandledPromiseRejectionToConsoleEnabled:
   type: bool
   defaultValue:
@@ -678,18 +602,6 @@
     WebCore:
       default: false
 
-UseLegacyBackgroundSizeShorthandBehavior:
-  type: bool
-  defaultValue:
-    WebCore:
-      default: false
-
-UsePreHTML5ParserQuirks:
-  type: bool
-  defaultValue:
-    WebCore:
-      default: false
-
 UserInterfaceDirectionPolicy:
   type: uint32_t
   refinedType: UserInterfaceDirectionPolicy
@@ -742,16 +654,6 @@
     WebCore:
       default: false
 
-WindowFocusRestricted:
-  comment: >-
-    When enabled, window.blur() does not change focus, and
-    window.focus() only changes focus when invoked from the context that
-    created the window.
-  type: bool
-  defaultValue:
-    WebCore:
-      default: true
-
 YouTubeFlashPluginReplacementEnabled:
   type: bool
   defaultValue:

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (269759 => 269760)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2020-11-12 23:59:47 UTC (rev 269759)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2020-11-13 00:20:43 UTC (rev 269760)
@@ -1,3 +1,49 @@
+2020-11-12  Sam Weinig  <wei...@apple.com>
+
+        Move more WebKitLegacy specific settings usage to WebPreferences.yaml
+        https://bugs.webkit.org/show_bug.cgi?id=218852
+
+        Reviewed by Tim Horton.
+
+        This batch focuses on settings with defaults based on SDK/host app conditions.
+
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        * WebView/WebPreferencesDefaultValues.h:
+        * WebView/WebPreferencesDefaultValues.mm:
+        (WebKit::defaultAllowContentSecurityPolicySourceStarToMatchAnyProtocol):
+        (WebKit::defaultLoadDeferringEnabled):
+        (WebKit::defaultWindowFocusRestricted):
+        (WebKit::defaultUsePreHTML5ParserQuirks):
+        (WebKit::defaultNeedsAdobeFrameReloadingQuirk):
+        (WebKit::defaultTreatsAnyTextCSSLinkAsStylesheet):
+        (WebKit::defaultNeedsFrameNameFallbackToIdQuirk):
+        (WebKit::defaultNeedsKeyboardEventDisambiguationQuirks):
+        (WebKit::defaultEnforceCSSMIMETypeInNoQuirksMode):
+        (WebKit::defaultNeedsIsLoadingInAPISenseQuirk):
+        (WebKit::defaultUseLegacyBackgroundSizeShorthandBehavior):
+        (WebKit::defaultAllowDisplayOfInsecureContent):
+        (WebKit::defaultAllowRunningOfInsecureContent):
+        (WebKit::defaultShouldConvertInvalidURLsToBlank):
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]):
+        (needsSelfRetainWhileLoadingQuirk):
+        (-[WebView _preferencesChanged:]):
+        (-[WebView dealloc]):
+        (-[WebView setFrameLoadDelegate:]):
+        (shouldEnableLoadDeferring): Deleted.
+        (shouldRestrictWindowFocus): Deleted.
+        (shouldUseLegacyBackgroundSizeShorthandBehavior): Deleted.
+        (shouldAllowDisplayAndRunningOfInsecureContent): Deleted.
+        (shouldAllowContentSecurityPolicySourceStarToMatchAnyProtocol): Deleted.
+        (shouldConvertInvalidURLsToBlank): Deleted.
+        (-[WebView _needsAdobeFrameReloadingQuirk]): Deleted.
+        (-[WebView _needsLinkElementTextCSSQuirk]): Deleted.
+        (-[WebView _needsFrameNameFallbackToIdQuirk]): Deleted.
+        (-[WebView _needsIsLoadingInAPISenseQuirk]): Deleted.
+        (-[WebView _needsKeyboardEventDisambiguationQuirks]): Deleted.
+        (-[WebView _needsPreHTML5ParserQuirks]): Deleted.
+
 2020-11-12  Zalan Bujtas  <za...@apple.com>
 
         Show legacy line layout visual coverage instead of "simple line" layout.

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm (269759 => 269760)


--- trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm	2020-11-12 23:59:47 UTC (rev 269759)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm	2020-11-13 00:20:43 UTC (rev 269760)
@@ -400,7 +400,6 @@
         @NO, WebKitPrivateBrowsingEnabledPreferenceKey,
         @(cacheModelForMainBundle([[NSBundle mainBundle] bundleIdentifier])), WebKitCacheModelPreferenceKey,
         @YES, WebKitZoomsTextOnlyPreferenceKey,
-        @NO, WebKitUsePreHTML5ParserQuirksKey,
         [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota,
 
         // FIXME: Are these relevent to WebKitLegacy? If not, we should remove them.

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.h (269759 => 269760)


--- trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.h	2020-11-12 23:59:47 UTC (rev 269759)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.h	2020-11-13 00:20:43 UTC (rev 269760)
@@ -60,9 +60,26 @@
 bool defaultPassiveTouchListenersAsDefaultOnDocument();
 bool defaultRequiresUserGestureToLoadVideo();
 bool defaultWebSQLEnabled();
+bool defaultAllowContentSecurityPolicySourceStarToMatchAnyProtocol();
 #endif
 
+#if PLATFORM(MAC)
+bool defaultLoadDeferringEnabled();
+bool defaultWindowFocusRestricted();
+bool defaultUsePreHTML5ParserQuirks();
+bool defaultNeedsAdobeFrameReloadingQuirk();
+bool defaultTreatsAnyTextCSSLinkAsStylesheet();
+bool defaultNeedsFrameNameFallbackToIdQuirk();
+bool defaultNeedsKeyboardEventDisambiguationQuirks();
+bool defaultEnforceCSSMIMETypeInNoQuirksMode();
+bool defaultNeedsIsLoadingInAPISenseQuirk();
+#endif
+
 bool defaultAttachmentElementEnabled();
 bool defaultShouldRestrictBaseURLSchemes();
+bool defaultUseLegacyBackgroundSizeShorthandBehavior();
+bool defaultAllowDisplayOfInsecureContent();
+bool defaultAllowRunningOfInsecureContent();
+bool defaultShouldConvertInvalidURLsToBlank();
 
 } // namespace WebKit

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.mm (269759 => 269760)


--- trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.mm	2020-11-12 23:59:47 UTC (rev 269759)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.mm	2020-11-13 00:20:43 UTC (rev 269760)
@@ -25,10 +25,12 @@
 
 #import "WebPreferencesDefaultValues.h"
 
+#import "WebKitVersionChecks.h"
 #import <Foundation/NSBundle.h>
 #import <WebCore/RuntimeApplicationChecks.h>
 #import <WebCore/VersionChecks.h>
 #import <mach-o/dyld.h>
+#import <pal/spi/cf/CFUtilitiesSPI.h>
 #import <pal/spi/cocoa/FeatureFlagsSPI.h>
 #import <wtf/cocoa/RuntimeApplicationChecksCocoa.h>
 #import <wtf/spi/darwin/dyldSPI.h>
@@ -74,6 +76,7 @@
 #endif // ENABLE(WEBGPU)
 
 #if HAVE(INCREMENTAL_PDF_APIS)
+
 bool defaultIncrementalPDFEnabled()
 {
 #if HAVE(SYSTEM_FEATURE_FLAGS)
@@ -82,6 +85,7 @@
 
     return false;
 }
+
 #endif
 
 #if ENABLE(WEBXR)
@@ -144,8 +148,92 @@
     return webSQLEnabled;
 }
 
+bool defaultAllowContentSecurityPolicySourceStarToMatchAnyProtocol()
+{
+    static bool shouldAllowContentSecurityPolicySourceStarToMatchAnyProtocol = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_CONTENT_SECURITY_POLICY_SOURCE_STAR_PROTOCOL_RESTRICTION);
+    return shouldAllowContentSecurityPolicySourceStarToMatchAnyProtocol;
+}
+
 #endif // PLATFORM(IOS_FAMILY)
 
+#if PLATFORM(MAC)
+
+bool defaultLoadDeferringEnabled()
+{
+    return !WebCore::MacApplication::isAdobeInstaller();
+}
+
+bool defaultWindowFocusRestricted()
+{
+    return !WebCore::MacApplication::isHRBlock();
+}
+
+bool defaultUsePreHTML5ParserQuirks()
+{
+    // AOL Instant Messenger and Microsoft My Day contain markup incompatible
+    // with the new HTML5 parser. If these applications were linked against a
+    // version of WebKit prior to the introduction of the HTML5 parser, enable
+    // parser quirks to maintain compatibility. For details, see
+    // <https://bugs.webkit.org/show_bug.cgi?id=46134> and
+    // <https://bugs.webkit.org/show_bug.cgi?id=46334>.
+    static bool isApplicationNeedingParserQuirks = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_HTML5_PARSER)
+        && (WebCore::MacApplication::isAOLInstantMessenger() || WebCore::MacApplication::isMicrosoftMyDay());
+
+    // Mail.app must continue to display HTML email that contains quirky markup.
+    static bool isAppleMail = WebCore::MacApplication::isAppleMail();
+
+    return isApplicationNeedingParserQuirks || isAppleMail;
+}
+
+bool defaultNeedsAdobeFrameReloadingQuirk()
+{
+    static bool needsQuirk = _CFAppVersionCheckLessThan(CFSTR("com.adobe.Acrobat"), -1, 9.0)
+        || _CFAppVersionCheckLessThan(CFSTR("com.adobe.Acrobat.Pro"), -1, 9.0)
+        || _CFAppVersionCheckLessThan(CFSTR("com.adobe.Reader"), -1, 9.0)
+        || _CFAppVersionCheckLessThan(CFSTR("com.adobe.distiller"), -1, 9.0)
+        || _CFAppVersionCheckLessThan(CFSTR("com.adobe.Contribute"), -1, 4.2)
+        || _CFAppVersionCheckLessThan(CFSTR("com.adobe.dreamweaver-9.0"), -1, 9.1)
+        || _CFAppVersionCheckLessThan(CFSTR("com.macromedia.fireworks"), -1, 9.1)
+        || _CFAppVersionCheckLessThan(CFSTR("com.adobe.InCopy"), -1, 5.1)
+        || _CFAppVersionCheckLessThan(CFSTR("com.adobe.InDesign"), -1, 5.1)
+        || _CFAppVersionCheckLessThan(CFSTR("com.adobe.Soundbooth"), -1, 2);
+
+    return needsQuirk;
+}
+
+bool defaultTreatsAnyTextCSSLinkAsStylesheet()
+{
+    static bool needsQuirk = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_LINK_ELEMENT_TEXT_CSS_QUIRK)
+        && _CFAppVersionCheckLessThan(CFSTR("com.e-frontier.shade10"), -1, 10.6);
+    return needsQuirk;
+}
+
+bool defaultNeedsFrameNameFallbackToIdQuirk()
+{
+    static bool needsQuirk = _CFAppVersionCheckLessThan(CFSTR("info.colloquy"), -1, 2.5);
+    return needsQuirk;
+}
+
+bool defaultNeedsKeyboardEventDisambiguationQuirks()
+{
+    static bool needsQuirks = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_IE_COMPATIBLE_KEYBOARD_EVENT_DISPATCH) && !WebCore::MacApplication::isSafari();
+    return needsQuirks;
+}
+
+bool defaultEnforceCSSMIMETypeInNoQuirksMode()
+{
+    static bool needsQuirk = !_CFAppVersionCheckLessThan(CFSTR("com.apple.iWeb"), -1, 2.1);
+    return needsQuirk;
+}
+
+bool defaultNeedsIsLoadingInAPISenseQuirk()
+{
+    static bool needsQuirk = _CFAppVersionCheckLessThan(CFSTR("com.apple.iAdProducer"), -1, 2.1);
+    return needsQuirk;
+}
+
+#endif // PLATFORM(MAC)
+
 bool defaultAttachmentElementEnabled()
 {
 #if PLATFORM(IOS_FAMILY)
@@ -161,4 +249,37 @@
     return shouldRestrictBaseURLSchemes;
 }
 
+bool defaultUseLegacyBackgroundSizeShorthandBehavior()
+{
+#if PLATFORM(IOS_FAMILY)
+    static bool shouldUseLegacyBackgroundSizeShorthandBehavior = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_LEGACY_BACKGROUNDSIZE_SHORTHAND_BEHAVIOR);
+#else
+    static bool shouldUseLegacyBackgroundSizeShorthandBehavior = WebCore::MacApplication::isVersions()
+        && !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_LEGACY_BACKGROUNDSIZE_SHORTHAND_BEHAVIOR);
+#endif
+    return shouldUseLegacyBackgroundSizeShorthandBehavior;
+}
+
+bool defaultAllowDisplayOfInsecureContent()
+{
+    static bool shouldAllowDisplayOfInsecureContent = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_INSECURE_CONTENT_BLOCKING);
+    return shouldAllowDisplayOfInsecureContent;
+}
+
+bool defaultAllowRunningOfInsecureContent()
+{
+    static bool shouldAllowRunningOfInsecureContent = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_INSECURE_CONTENT_BLOCKING);
+    return shouldAllowRunningOfInsecureContent;
+}
+
+bool defaultShouldConvertInvalidURLsToBlank()
+{
+#if PLATFORM(IOS_FAMILY)
+    static bool shouldConvertInvalidURLsToBlank = dyld_get_program_sdk_version() >= DYLD_IOS_VERSION_10_0;
+#else
+    static bool shouldConvertInvalidURLsToBlank = dyld_get_program_sdk_version() >= DYLD_MACOSX_VERSION_10_12;
+#endif
+    return shouldConvertInvalidURLsToBlank;
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (269759 => 269760)


--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2020-11-12 23:59:47 UTC (rev 269759)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2020-11-13 00:20:43 UTC (rev 269760)
@@ -1319,24 +1319,6 @@
     WebCore::reportException(globalObject, toJS(globalObject, exception));
 }
 
-static bool shouldEnableLoadDeferring()
-{
-#if PLATFORM(IOS_FAMILY)
-    return true;
-#else
-    return !WebCore::MacApplication::isAdobeInstaller();
-#endif
-}
-
-static bool shouldRestrictWindowFocus()
-{
-#if PLATFORM(IOS_FAMILY)
-    return true;
-#else
-    return !WebCore::MacApplication::isHRBlock();
-#endif
-}
-
 - (void)_dispatchPendingLoadRequests
 {
     webResourceLoadScheduler().servePendingRequests();
@@ -1423,46 +1405,6 @@
 static bool didOneTimeInitialization = false;
 #endif
 
-static bool shouldUseLegacyBackgroundSizeShorthandBehavior()
-{
-#if PLATFORM(IOS_FAMILY)
-    static bool shouldUseLegacyBackgroundSizeShorthandBehavior = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_LEGACY_BACKGROUNDSIZE_SHORTHAND_BEHAVIOR);
-#else
-    static bool shouldUseLegacyBackgroundSizeShorthandBehavior = WebCore::MacApplication::isVersions()
-        && !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_LEGACY_BACKGROUNDSIZE_SHORTHAND_BEHAVIOR);
-#endif
-    return shouldUseLegacyBackgroundSizeShorthandBehavior;
-}
-
-static bool shouldAllowDisplayAndRunningOfInsecureContent()
-{
-    static bool shouldAllowDisplayAndRunningOfInsecureContent = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_INSECURE_CONTENT_BLOCKING);
-    return shouldAllowDisplayAndRunningOfInsecureContent;
-}
-
-static bool shouldAllowContentSecurityPolicySourceStarToMatchAnyProtocol()
-{
-#if PLATFORM(IOS_FAMILY)
-    static bool shouldAllowContentSecurityPolicySourceStarToMatchAnyProtocol = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_CONTENT_SECURITY_POLICY_SOURCE_STAR_PROTOCOL_RESTRICTION);
-    return shouldAllowContentSecurityPolicySourceStarToMatchAnyProtocol;
-#else
-    return false;
-#endif
-}
-
-static bool shouldConvertInvalidURLsToBlank()
-{
-#if PLATFORM(IOS_FAMILY)
-    static bool shouldConvertInvalidURLsToBlank = dyld_get_program_sdk_version() >= DYLD_IOS_VERSION_10_0;
-#elif PLATFORM(MAC)
-    static bool shouldConvertInvalidURLsToBlank = dyld_get_program_sdk_version() >= DYLD_MACOSX_VERSION_10_12;
-#else
-    static bool shouldConvertInvalidURLsToBlank = true;
-#endif
-
-    return shouldConvertInvalidURLsToBlank;
-}
-
 #if ENABLE(GAMEPAD)
 static void WebKitInitializeGamepadProviderIfNecessary()
 {
@@ -1632,7 +1574,6 @@
 
     _private->page->setCanStartMedia([self window]);
     _private->page->settings().setLocalStorageDatabasePath([[self preferences] _localStorageDatabasePath]);
-    _private->page->settings().setUseLegacyBackgroundSizeShorthandBehavior(shouldUseLegacyBackgroundSizeShorthandBehavior());
 
 #if !PLATFORM(IOS_FAMILY)
     if (needsOutlookQuirksScript()) {
@@ -2902,49 +2843,7 @@
 }
 #endif
 
-#if !PLATFORM(IOS_FAMILY)
-- (BOOL)_needsAdobeFrameReloadingQuirk
-{
-    static BOOL needsQuirk = _CFAppVersionCheckLessThan(CFSTR("com.adobe.Acrobat"), -1, 9.0)
-        || _CFAppVersionCheckLessThan(CFSTR("com.adobe.Acrobat.Pro"), -1, 9.0)
-        || _CFAppVersionCheckLessThan(CFSTR("com.adobe.Reader"), -1, 9.0)
-        || _CFAppVersionCheckLessThan(CFSTR("com.adobe.distiller"), -1, 9.0)
-        || _CFAppVersionCheckLessThan(CFSTR("com.adobe.Contribute"), -1, 4.2)
-        || _CFAppVersionCheckLessThan(CFSTR("com.adobe.dreamweaver-9.0"), -1, 9.1)
-        || _CFAppVersionCheckLessThan(CFSTR("com.macromedia.fireworks"), -1, 9.1)
-        || _CFAppVersionCheckLessThan(CFSTR("com.adobe.InCopy"), -1, 5.1)
-        || _CFAppVersionCheckLessThan(CFSTR("com.adobe.InDesign"), -1, 5.1)
-        || _CFAppVersionCheckLessThan(CFSTR("com.adobe.Soundbooth"), -1, 2);
-
-    return needsQuirk;
-}
-
-- (BOOL)_needsLinkElementTextCSSQuirk
-{
-    static BOOL needsQuirk = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_LINK_ELEMENT_TEXT_CSS_QUIRK)
-        && _CFAppVersionCheckLessThan(CFSTR("com.e-frontier.shade10"), -1, 10.6);
-    return needsQuirk;
-}
-
-- (BOOL)_needsFrameNameFallbackToIdQuirk
-{
-    static BOOL needsQuirk = _CFAppVersionCheckLessThan(CFSTR("info.colloquy"), -1, 2.5);
-    return needsQuirk;
-}
-
-- (BOOL)_needsIsLoadingInAPISenseQuirk
-{
-    static BOOL needsQuirk = _CFAppVersionCheckLessThan(CFSTR("com.apple.iAdProducer"), -1, 2.1);
-
-    return needsQuirk;
-}
-
-- (BOOL)_needsKeyboardEventDisambiguationQuirks
-{
-    static BOOL needsQuirks = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_IE_COMPATIBLE_KEYBOARD_EVENT_DISPATCH) && !WebCore::MacApplication::isSafari();
-    return needsQuirks;
-}
-
+#if PLATFORM(MAC)
 - (BOOL)_needsFrameLoadDelegateRetainQuirk
 {
     static BOOL needsQuirk = _CFAppVersionCheckLessThan(CFSTR("com.equinux.iSale5"), -1, 5.6);
@@ -2956,28 +2855,7 @@
     static bool needsQuirk = WebCore::MacApplication::isAperture();
     return needsQuirk;
 }
-#endif // !PLATFORM(IOS_FAMILY)
-
-- (BOOL)_needsPreHTML5ParserQuirks
-{
-#if !PLATFORM(IOS_FAMILY)
-    // AOL Instant Messenger and Microsoft My Day contain markup incompatible
-    // with the new HTML5 parser. If these applications were linked against a
-    // version of WebKit prior to the introduction of the HTML5 parser, enable
-    // parser quirks to maintain compatibility. For details, see
-    // <https://bugs.webkit.org/show_bug.cgi?id=46134> and
-    // <https://bugs.webkit.org/show_bug.cgi?id=46334>.
-    static bool isApplicationNeedingParserQuirks = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_HTML5_PARSER)
-        && (WebCore::MacApplication::isAOLInstantMessenger() || WebCore::MacApplication::isMicrosoftMyDay());
-
-    // Mail.app must continue to display HTML email that contains quirky markup.
-    static bool isAppleMail = WebCore::MacApplication::isAppleMail();
-
-    return isApplicationNeedingParserQuirks || isAppleMail || [[self preferences] usePreHTML5ParserQuirks];
-#else
-    return [[self preferences] usePreHTML5ParserQuirks];
 #endif
-}
 
 - (void)_preferencesChangedNotification:(NSNotification *)notification
 {
@@ -3041,10 +2919,11 @@
 
     auto& settings = _private->page->settings();
     
-    // FIXME: This should switch to using WebPreferences for storage and adopt autogeneration.
+    // FIXME: These should switch to using WebPreferences for storage and adopt autogeneration.
     settings.setInteractiveFormValidationEnabled([self interactiveFormValidationEnabled]);
+    settings.setValidationMessageTimerMagnification([self validationMessageTimerMagnification]);
 
-    // FIXME: We should make autogeneration smart enough to deal with core/kit conversions of enums.
+    // FIXME: Autogeneration should be smart enough to deal with core/kit conversions and validation of non-primitive types like enums, URLs and Seconds.
     settings.setStorageBlockingPolicy(core([preferences storageBlockingPolicy]));
     settings.setEditableLinkBehavior(core([preferences editableLinkBehavior]));
     settings.setJavaScriptRuntimeFlags(JSC::RuntimeFlags([preferences _javascript_RuntimeFlags]));
@@ -3062,15 +2941,6 @@
     _private->page->setSessionID([preferences privateBrowsingEnabled] ? PAL::SessionID::legacyPrivateSessionID() : PAL::SessionID::defaultSessionID());
     _private->group->storageNamespaceProvider().setSessionIDForTesting([preferences privateBrowsingEnabled] ? PAL::SessionID::legacyPrivateSessionID() : PAL::SessionID::defaultSessionID());
 
-    settings.setLoadDeferringEnabled(shouldEnableLoadDeferring());
-    settings.setWindowFocusRestricted(shouldRestrictWindowFocus());
-    settings.setUsePreHTML5ParserQuirks([self _needsPreHTML5ParserQuirks]);
-    settings.setValidationMessageTimerMagnification([self validationMessageTimerMagnification]);
-    settings.setAllowDisplayOfInsecureContent(shouldAllowDisplayAndRunningOfInsecureContent());
-    settings.setAllowRunningOfInsecureContent(shouldAllowDisplayAndRunningOfInsecureContent());
-    settings.setAllowContentSecurityPolicySourceStarToMatchAnyProtocol(shouldAllowContentSecurityPolicySourceStarToMatchAnyProtocol());
-    settings.setShouldConvertInvalidURLsToBlank(shouldConvertInvalidURLsToBlank());
-
 #if PLATFORM(MAC)
     // This parses the user stylesheet synchronously so anything that may affect it should be done first.
     if ([preferences userStyleSheetEnabled]) {
@@ -3078,13 +2948,6 @@
         settings.setUserStyleSheetLocation([NSURL URLWithString:(location ? location : @"")]);
     } else
         settings.setUserStyleSheetLocation([NSURL URLWithString:@""]);
-
-    settings.setNeedsAdobeFrameReloadingQuirk([self _needsAdobeFrameReloadingQuirk]);
-    settings.setTreatsAnyTextCSSLinkAsStylesheet([self _needsLinkElementTextCSSQuirk]);
-    settings.setNeedsFrameNameFallbackToIdQuirk([self _needsFrameNameFallbackToIdQuirk]);
-    settings.setNeedsKeyboardEventDisambiguationQuirks([self _needsKeyboardEventDisambiguationQuirks]);
-    settings.setEnforceCSSMIMETypeInNoQuirksMode(!_CFAppVersionCheckLessThan(CFSTR("com.apple.iWeb"), -1, 2.1));
-    settings.setNeedsIsLoadingInAPISenseQuirk([self _needsIsLoadingInAPISenseQuirk]);
 #endif
 
 #if PLATFORM(IOS_FAMILY)
@@ -5689,7 +5552,7 @@
         if ([[self class] shouldIncludeInWebKitStatistics])
             --WebViewCount;
 
-#if !PLATFORM(IOS_FAMILY)
+#if PLATFORM(MAC)
         if ([self _needsFrameLoadDelegateRetainQuirk])
             [_private->frameLoadDelegate release];
 #endif
@@ -6094,7 +5957,7 @@
     // unconvered a latent bug in at least one WebKit app where the delegate wasn't properly retained by the app and
     // was dealloc'ed before being cleared.
     // This is an effort to keep such apps working for now.
-#if !PLATFORM(IOS_FAMILY)
+#if PLATFORM(MAC)
     if ([self _needsFrameLoadDelegateRetainQuirk]) {
         [delegate retain];
         [_private->frameLoadDelegate release];

Modified: trunk/Tools/ChangeLog (269759 => 269760)


--- trunk/Tools/ChangeLog	2020-11-12 23:59:47 UTC (rev 269759)
+++ trunk/Tools/ChangeLog	2020-11-13 00:20:43 UTC (rev 269760)
@@ -1,3 +1,14 @@
+2020-11-12  Sam Weinig  <wei...@apple.com>
+
+        Move more WebKitLegacy specific settings usage to WebPreferences.yaml
+        https://bugs.webkit.org/show_bug.cgi?id=218852
+
+        Reviewed by Tim Horton.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetWebPreferencesToConsistentValues):
+        Remove unnecessary call of [WebPreferences setUsePreHTML5ParserQuirks:NO] as this is the default.
+
 2020-11-12  Devin Rousso  <drou...@apple.com>
 
         Web Inspector: ensure that `JSON::ArrayOf<T>` doesn't allow `addItem` to be called with a type other than `T`

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (269759 => 269760)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2020-11-12 23:59:47 UTC (rev 269759)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2020-11-13 00:20:43 UTC (rev 269760)
@@ -885,7 +885,6 @@
     [preferences setSourceBufferChangeTypeEnabled:YES];
     [preferences setStandardFontFamily:@"Times"];
     [preferences setSubpixelAntialiasedLayerTextEnabled:NO];
-    [preferences setUsePreHTML5ParserQuirks:NO];
     [preferences setVideoPlaybackRequiresUserGesture:NO];
     [preferences setWebAudioEnabled:YES];
     [preferences setWebSQLEnabled:YES];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to