Add runtime and compile time flags for enabling Web Animations API and model.
[WebKit-https.git] / Source / WebCore / bindings / generic / RuntimeEnabledFeatures.cpp
index dd47184..6666331 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2013 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
 #include "config.h"
 #include "RuntimeEnabledFeatures.h"
 
-#include "AbstractDatabase.h"
+#include "DatabaseManager.h"
 #include "MediaPlayer.h"
-#include "SharedWorkerRepository.h"
 #include "WebSocket.h"
-
-#if ENABLE(FILE_SYSTEM)
-#include "AsyncFileSystem.h"
-#endif
+#include <wtf/NeverDestroyed.h>
 
 namespace WebCore {
 
-bool RuntimeEnabledFeatures::isLocalStorageEnabled = true;
-bool RuntimeEnabledFeatures::isSessionStorageEnabled = true;
-bool RuntimeEnabledFeatures::isWebkitNotificationsEnabled = false;
-bool RuntimeEnabledFeatures::isApplicationCacheEnabled = true;
-bool RuntimeEnabledFeatures::isDataTransferItemsEnabled = true;
-bool RuntimeEnabledFeatures::isGeolocationEnabled = true;
-bool RuntimeEnabledFeatures::isIndexedDBEnabled = false;
-bool RuntimeEnabledFeatures::isWebAudioEnabled = false;
-bool RuntimeEnabledFeatures::isPushStateEnabled = false;
-bool RuntimeEnabledFeatures::isTouchEnabled = true;
-bool RuntimeEnabledFeatures::isDeviceMotionEnabled = true;
-bool RuntimeEnabledFeatures::isDeviceOrientationEnabled = true;
-bool RuntimeEnabledFeatures::isSpeechInputEnabled = true;
-
+RuntimeEnabledFeatures::RuntimeEnabledFeatures()
+    : m_isLocalStorageEnabled(true)
+    , m_isSessionStorageEnabled(true)
+    , m_isWebkitNotificationsEnabled(false)
+    , m_isApplicationCacheEnabled(true)
+    , m_isDataTransferItemsEnabled(true)
+    , m_isGeolocationEnabled(true)
+    , m_isIndexedDBEnabled(false)
+    , m_isTouchEnabled(true)
+    , m_isDeviceMotionEnabled(true)
+    , m_isDeviceOrientationEnabled(true)
+    , m_isCSSShapesEnabled(true)
+    , m_isCSSRegionsEnabled(false)
+    , m_isCSSCompositingEnabled(false)
+    , m_isLangAttributeAwareFormControlUIEnabled(false)
+#if PLATFORM(IOS)
+    , m_isPluginReplacementEnabled(true)
+#else
+    , m_isPluginReplacementEnabled(false)
+#endif
 #if ENABLE(MEDIA_STREAM)
-bool RuntimeEnabledFeatures::isMediaStreamEnabled = true;
+    , m_isMediaStreamEnabled(true)
+    , m_isPeerConnectionEnabled(true)
 #endif
-
-#if ENABLE(XHR_RESPONSE_BLOB)
-bool RuntimeEnabledFeatures::isXHRResponseBlobEnabled = false;
+#if ENABLE(LEGACY_CSS_VENDOR_PREFIXES)
+    , m_isLegacyCSSVendorPrefixesEnabled(false)
 #endif
+#if ENABLE(JAVASCRIPT_I18N_API)
+    , m_isJavaScriptI18NAPIEnabled(false)
+#endif
+#if ENABLE(VIDEO_TRACK)
+    , m_isVideoTrackEnabled(true)
+#endif
+#if ENABLE(INPUT_TYPE_DATE)
+    , m_isInputTypeDateEnabled(true)
+#endif
+#if ENABLE(INPUT_TYPE_DATETIME_INCOMPLETE)
+    , m_isInputTypeDateTimeEnabled(false)
+#endif
+#if ENABLE(INPUT_TYPE_DATETIMELOCAL)
+    , m_isInputTypeDateTimeLocalEnabled(true)
+#endif
+#if ENABLE(INPUT_TYPE_MONTH)
+    , m_isInputTypeMonthEnabled(true)
+#endif
+#if ENABLE(INPUT_TYPE_TIME)
+    , m_isInputTypeTimeEnabled(true)
+#endif
+#if ENABLE(INPUT_TYPE_WEEK)
+    , m_isInputTypeWeekEnabled(true)
+#endif
+#if ENABLE(CSP_NEXT)
+    , m_areExperimentalContentSecurityPolicyFeaturesEnabled(false)
+#endif
+#if ENABLE(FONT_LOAD_EVENTS)
+    , m_isFontLoadEventsEnabled(true)
+#endif
+#if ENABLE(GAMEPAD)
+    , m_areGamepadsEnabled(false)
+#endif
+#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
+    , m_areAnimationTriggersEnabled(false)
+#endif
+#if ENABLE(WEB_ANIMATIONS)
+    , m_areWebAnimationsEnabled(false)
+#endif
+{
+}
 
-#if ENABLE(FILE_SYSTEM)
-bool RuntimeEnabledFeatures::isFileSystemEnabled = false;
-
-bool RuntimeEnabledFeatures::fileSystemEnabled()
+RuntimeEnabledFeatures& RuntimeEnabledFeatures::sharedFeatures()
 {
-    return isFileSystemEnabled && AsyncFileSystem::isAvailable();
+    static NeverDestroyed<RuntimeEnabledFeatures> runtimeEnabledFeatures;
+
+    return runtimeEnabledFeatures;
 }
-#endif
 
 #if ENABLE(JAVASCRIPT_I18N_API)
-bool RuntimeEnabledFeatures::isJavaScriptI18NAPIEnabled = false;
-
 bool RuntimeEnabledFeatures::javaScriptI18NAPIEnabled()
 {
-    return isJavaScriptI18NAPIEnabled;
+    return m_isJavaScriptI18NAPIEnabled;
 }
 #endif
 
 #if ENABLE(VIDEO)
-
-bool RuntimeEnabledFeatures::audioEnabled()
+bool RuntimeEnabledFeatures::audioEnabled() const
 {
     return MediaPlayer::isAvailable();
 }
 
-bool RuntimeEnabledFeatures::htmlMediaElementEnabled()
+bool RuntimeEnabledFeatures::htmlMediaElementEnabled() const
 {
     return MediaPlayer::isAvailable();
 }
 
-bool RuntimeEnabledFeatures::htmlAudioElementEnabled()
+bool RuntimeEnabledFeatures::htmlAudioElementEnabled() const
 {
     return MediaPlayer::isAvailable();
 }
 
-bool RuntimeEnabledFeatures::htmlVideoElementEnabled()
+bool RuntimeEnabledFeatures::htmlVideoElementEnabled() const
 {
     return MediaPlayer::isAvailable();
 }
 
-bool RuntimeEnabledFeatures::mediaErrorEnabled()
+bool RuntimeEnabledFeatures::htmlSourceElementEnabled() const
 {
     return MediaPlayer::isAvailable();
 }
 
-bool RuntimeEnabledFeatures::timeRangesEnabled()
+bool RuntimeEnabledFeatures::mediaControllerEnabled() const
 {
     return MediaPlayer::isAvailable();
 }
 
-#endif
-
-#if ENABLE(SHARED_WORKERS)
-bool RuntimeEnabledFeatures::sharedWorkerEnabled()
+bool RuntimeEnabledFeatures::mediaErrorEnabled() const
 {
-    return SharedWorkerRepository::isAvailable();
+    return MediaPlayer::isAvailable();
 }
-#endif
 
-#if ENABLE(WEB_SOCKETS)
-bool RuntimeEnabledFeatures::webSocketEnabled()
+bool RuntimeEnabledFeatures::timeRangesEnabled() const
 {
-    return WebSocket::isAvailable();
+    return MediaPlayer::isAvailable();
 }
 #endif
 
-#if ENABLE(DATABASE)
-bool RuntimeEnabledFeatures::openDatabaseEnabled()
-{
-    return AbstractDatabase::isAvailable();
-}
-
-bool RuntimeEnabledFeatures::openDatabaseSyncEnabled()
+#if ENABLE(WEB_SOCKETS)
+bool RuntimeEnabledFeatures::webSocketEnabled() const
 {
-    return AbstractDatabase::isAvailable();
+    return WebSocket::isAvailable();
 }
 #endif
 
-#if ENABLE(QUOTA)
-bool RuntimeEnabledFeatures::isQuotaEnabled = false;
-#endif
-
 } // namespace WebCore