[Web Animations] Expose Web Animations CSS integration as an experimental feature
[WebKit-https.git] / Source / WebCore / testing / InternalSettings.cpp
index 2f7a432..24e4aae 100644 (file)
 #include "InternalSettings.h"
 
 #include "CaptionUserPreferences.h"
+#include "DeprecatedGlobalSettings.h"
 #include "Document.h"
 #include "FontCache.h"
+#include "Frame.h"
 #include "FrameView.h"
 #include "LocaleToScriptMapping.h"
-#include "MainFrame.h"
 #include "Page.h"
 #include "PageGroup.h"
 #include "RenderTheme.h"
@@ -59,7 +60,7 @@ InternalSettings::Backup::Backup(Settings& settings)
 #endif
     , m_originalMediaTypeOverride(settings.mediaTypeOverride())
     , m_originalCanvasUsesAcceleratedDrawing(settings.canvasUsesAcceleratedDrawing())
-    , m_originalMockScrollbarsEnabled(settings.mockScrollbarsEnabled())
+    , m_originalMockScrollbarsEnabled(DeprecatedGlobalSettings::mockScrollbarsEnabled())
     , m_imagesEnabled(settings.areImagesEnabled())
     , m_preferMIMETypeForImages(settings.preferMIMETypeForImages())
     , m_minimumDOMTimerInterval(settings.minimumDOMTimerInterval())
@@ -92,6 +93,9 @@ InternalSettings::Backup::Backup(Settings& settings)
     , m_inlineMediaPlaybackRequiresPlaysInlineAttribute(settings.inlineMediaPlaybackRequiresPlaysInlineAttribute())
     , m_deferredCSSParserEnabled(settings.deferredCSSParserEnabled())
     , m_inputEventsEnabled(settings.inputEventsEnabled())
+#if ENABLE(ACCESSIBILITY_EVENTS)
+    , m_accessibilityEventsEnabled(settings.accessibilityEventsEnabled())
+#endif
     , m_userInterfaceDirectionPolicy(settings.userInterfaceDirectionPolicy())
     , m_systemLayoutDirection(settings.systemLayoutDirection())
     , m_pdfImageCachingPolicy(settings.pdfImageCachingPolicy())
@@ -103,7 +107,6 @@ InternalSettings::Backup::Backup(Settings& settings)
 #if ENABLE(INDEXED_DATABASE_IN_WORKERS)
     , m_indexedDBWorkersEnabled(RuntimeEnabledFeatures::sharedFeatures().indexedDBWorkersEnabled())
 #endif
-    , m_cssGridLayoutEnabled(RuntimeEnabledFeatures::sharedFeatures().isCSSGridLayoutEnabled())
 #if ENABLE(WEBGL2)
     , m_webGL2Enabled(RuntimeEnabledFeatures::sharedFeatures().webGL2Enabled())
 #endif
@@ -111,11 +114,15 @@ InternalSettings::Backup::Backup(Settings& settings)
     , m_webGPUEnabled(RuntimeEnabledFeatures::sharedFeatures().webGPUEnabled())
 #endif
     , m_webVREnabled(RuntimeEnabledFeatures::sharedFeatures().webVREnabled())
+#if ENABLE(MEDIA_STREAM)
+    , m_setScreenCaptureEnabled(RuntimeEnabledFeatures::sharedFeatures().screenCaptureEnabled())
+#endif
     , m_shouldMockBoldSystemFontForAccessibility(RenderTheme::singleton().shouldMockBoldSystemFontForAccessibility())
 #if USE(AUDIO_SESSION)
-    , m_shouldManageAudioSessionCategory(Settings::shouldManageAudioSessionCategory())
+    , m_shouldManageAudioSessionCategory(DeprecatedGlobalSettings::shouldManageAudioSessionCategory())
 #endif
-    , m_customPasteboardDataEnabled(Settings::customPasteboardDataEnabled())
+    , m_customPasteboardDataEnabled(RuntimeEnabledFeatures::sharedFeatures().customPasteboardDataEnabled())
+    , m_promptForStorageAccessAPIEnabled(RuntimeEnabledFeatures::sharedFeatures().storageAccessPromptsEnabled())
 {
 }
 
@@ -193,15 +200,17 @@ void InternalSettings::Backup::restoreTo(Settings& settings)
     settings.setForcedDisplayIsMonochromeAccessibilityValue(m_forcedDisplayIsMonochromeAccessibilityValue);
     settings.setForcedPrefersReducedMotionAccessibilityValue(m_forcedPrefersReducedMotionAccessibilityValue);
     settings.setFontLoadTimingOverride(m_fontLoadTimingOverride);
-    Settings::setAllowsAnySSLCertificate(false);
+    DeprecatedGlobalSettings::setAllowsAnySSLCertificate(false);
     RenderTheme::singleton().setShouldMockBoldSystemFontForAccessibility(m_shouldMockBoldSystemFontForAccessibility);
     FontCache::singleton().setShouldMockBoldSystemFontForAccessibility(m_shouldMockBoldSystemFontForAccessibility);
     settings.setFrameFlattening(m_frameFlattening);
+#if ENABLE(ACCESSIBILITY_EVENTS)
+    settings.setAccessibilityEventsEnabled(m_accessibilityEventsEnabled);
+#endif
 
 #if ENABLE(INDEXED_DATABASE_IN_WORKERS)
     RuntimeEnabledFeatures::sharedFeatures().setIndexedDBWorkersEnabled(m_indexedDBWorkersEnabled);
 #endif
-    RuntimeEnabledFeatures::sharedFeatures().setCSSGridLayoutEnabled(m_cssGridLayoutEnabled);
 #if ENABLE(WEBGL2)
     RuntimeEnabledFeatures::sharedFeatures().setWebGL2Enabled(m_webGL2Enabled);
 #endif
@@ -209,11 +218,16 @@ void InternalSettings::Backup::restoreTo(Settings& settings)
     RuntimeEnabledFeatures::sharedFeatures().setWebGPUEnabled(m_webGPUEnabled);
 #endif
     RuntimeEnabledFeatures::sharedFeatures().setWebVREnabled(m_webVREnabled);
+#if ENABLE(MEDIA_STREAM)
+    RuntimeEnabledFeatures::sharedFeatures().setScreenCaptureEnabled(m_setScreenCaptureEnabled);
+#endif
+    RuntimeEnabledFeatures::sharedFeatures().setCustomPasteboardDataEnabled(m_customPasteboardDataEnabled);
 
 #if USE(AUDIO_SESSION)
-    Settings::setShouldManageAudioSessionCategory(m_shouldManageAudioSessionCategory);
+    DeprecatedGlobalSettings::setShouldManageAudioSessionCategory(m_shouldManageAudioSessionCategory);
 #endif
-    Settings::setCustomPasteboardDataEnabled(m_customPasteboardDataEnabled);
+
+    RuntimeEnabledFeatures::sharedFeatures().setStorageAccessPromptsEnabled(m_promptForStorageAccessAPIEnabled);
 }
 
 class InternalSettingsWrapper : public Supplement<Page> {
@@ -445,7 +459,7 @@ ExceptionOr<void> InternalSettings::setMediaCaptureRequiresSecureConnection(bool
     if (!m_page)
         return Exception { InvalidAccessError };
 #if ENABLE(MEDIA_STREAM)
-    settings().setMediaCaptureRequiresSecureConnection(requires);
+    DeprecatedGlobalSettings::setMediaCaptureRequiresSecureConnection(requires);
 #else
     UNUSED_PARAM(requires);
 #endif
@@ -733,11 +747,6 @@ void InternalSettings::setIndexedDBWorkersEnabled(bool enabled)
 #endif
 }
 
-void InternalSettings::setCSSGridLayoutEnabled(bool enabled)
-{
-    RuntimeEnabledFeatures::sharedFeatures().setCSSGridLayoutEnabled(enabled);
-}
-
 void InternalSettings::setWebGL2Enabled(bool enabled)
 {
 #if ENABLE(WEBGL2)
@@ -761,6 +770,20 @@ void InternalSettings::setWebVREnabled(bool enabled)
     RuntimeEnabledFeatures::sharedFeatures().setWebVREnabled(enabled);
 }
 
+void InternalSettings::setScreenCaptureEnabled(bool enabled)
+{
+#if ENABLE(MEDIA_STREAM)
+    RuntimeEnabledFeatures::sharedFeatures().setScreenCaptureEnabled(enabled);
+#else
+    UNUSED_PARAM(enabled);
+#endif
+}
+
+void InternalSettings::setStorageAccessPromptsEnabled(bool enabled)
+{
+    RuntimeEnabledFeatures::sharedFeatures().setStorageAccessPromptsEnabled(enabled);
+}
+    
 ExceptionOr<String> InternalSettings::userInterfaceDirectionPolicy()
 {
     if (!m_page)
@@ -829,7 +852,7 @@ ExceptionOr<void> InternalSettings::setFrameFlattening(FrameFlatteningValue fram
 
 void InternalSettings::setAllowsAnySSLCertificate(bool allowsAnyCertificate)
 {
-    Settings::setAllowsAnySSLCertificate(allowsAnyCertificate);
+    DeprecatedGlobalSettings::setAllowsAnySSLCertificate(allowsAnyCertificate);
 #if USE(SOUP)
     SoupNetworkSession::setShouldIgnoreTLSErrors(allowsAnyCertificate);
 #endif
@@ -853,7 +876,7 @@ ExceptionOr<void> InternalSettings::setDeferredCSSParserEnabled(bool enabled)
 ExceptionOr<void> InternalSettings::setShouldManageAudioSessionCategory(bool should)
 {
 #if USE(AUDIO_SESSION)
-    Settings::setShouldManageAudioSessionCategory(should);
+    DeprecatedGlobalSettings::setShouldManageAudioSessionCategory(should);
     return { };
 #else
     UNUSED_PARAM(should);
@@ -863,7 +886,19 @@ ExceptionOr<void> InternalSettings::setShouldManageAudioSessionCategory(bool sho
 
 ExceptionOr<void> InternalSettings::setCustomPasteboardDataEnabled(bool enabled)
 {
-    Settings::setCustomPasteboardDataEnabled(enabled);
+    RuntimeEnabledFeatures::sharedFeatures().setCustomPasteboardDataEnabled(enabled);
+    return { };
+}
+
+ExceptionOr<void> InternalSettings::setAccessibilityEventsEnabled(bool enabled)
+{
+    if (!m_page)
+        return Exception { InvalidAccessError };
+#if ENABLE(ACCESSIBILITY_EVENTS)
+    settings().setAccessibilityEventsEnabled(enabled);
+#else
+    UNUSED_PARAM(enabled);
+#endif
     return { };
 }
 
@@ -927,6 +962,11 @@ void InternalSettings::setForcedPrefersReducedMotionAccessibilityValue(InternalS
     settings().setForcedPrefersReducedMotionAccessibilityValue(internalSettingsToSettingsValue(value));
 }
 
+bool InternalSettings::webAnimationsCSSIntegrationEnabled()
+{
+    return RuntimeEnabledFeatures::sharedFeatures().webAnimationsCSSIntegrationEnabled();
+}
+
 // If you add to this class, make sure that you update the Backup class for test reproducability!
 
 }