Title: [200437] trunk/Source/WebKit2
Revision
200437
Author
[email protected]
Date
2016-05-04 15:29:18 -0700 (Wed, 04 May 2016)

Log Message

Experimental features should toggle runtime flags
https://bugs.webkit.org/show_bug.cgi?id=157353
<rdar://problem/23621603>

Reviewed by Anders Carlsson.

Hook up the experimental WebPreferences to RuntimeEnabledFeatures.
In the process I removed the general preference for WebGL 2 (we
already had an experimental feature for it) and moved Custom
Elements and Shadow DOM to experimental.

I also removed the C versions of the preferences, since experimental
features only need the ObjC API (which is generated automatically).

* Shared/WebPreferencesDefinitions.h: Move/remove some features and
make the experimental section more clear.
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetWebGL2Enabled): Deleted.
(WKPreferencesGetWebGL2Enabled): Deleted.
(WKPreferencesSetShadowDOMEnabled): Deleted.
(WKPreferencesGetShadowDOMEnabled): Deleted.
(WKPreferencesSetCustomElementsEnabled): Deleted.
(WKPreferencesGetCustomElementsEnabled): Deleted.
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/WebPreferences.cpp:
(WebKit::WebPreferences::updateBoolValueForExperimentalFeatureKey): A
version of updateBoolValueForKey that doesn't call the platform
function (e.g. doesn't save to NSUserDefaults).
* UIProcess/WebPreferences.h:
* UIProcess/mac/WebPreferencesMac.mm:
(WebKit::WebPreferences::platformInitializeStore): Deleted.
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (200436 => 200437)


--- trunk/Source/WebKit2/ChangeLog	2016-05-04 22:28:40 UTC (rev 200436)
+++ trunk/Source/WebKit2/ChangeLog	2016-05-04 22:29:18 UTC (rev 200437)
@@ -1,5 +1,43 @@
 2016-05-04  Dean Jackson  <[email protected]>
 
+        Experimental features should toggle runtime flags
+        https://bugs.webkit.org/show_bug.cgi?id=157353
+        <rdar://problem/23621603>
+
+        Reviewed by Anders Carlsson.
+
+        Hook up the experimental WebPreferences to RuntimeEnabledFeatures.
+        In the process I removed the general preference for WebGL 2 (we
+        already had an experimental feature for it) and moved Custom
+        Elements and Shadow DOM to experimental.
+
+        I also removed the C versions of the preferences, since experimental
+        features only need the ObjC API (which is generated automatically).
+
+        * Shared/WebPreferencesDefinitions.h: Move/remove some features and
+        make the experimental section more clear.
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetWebGL2Enabled): Deleted.
+        (WKPreferencesGetWebGL2Enabled): Deleted.
+        (WKPreferencesSetShadowDOMEnabled): Deleted.
+        (WKPreferencesGetShadowDOMEnabled): Deleted.
+        (WKPreferencesSetCustomElementsEnabled): Deleted.
+        (WKPreferencesGetCustomElementsEnabled): Deleted.
+        * UIProcess/API/C/WKPreferencesRefPrivate.h:
+        * UIProcess/WebPreferences.cpp:
+        (WebKit::WebPreferences::updateBoolValueForExperimentalFeatureKey): A
+        version of updateBoolValueForKey that doesn't call the platform
+        function (e.g. doesn't save to NSUserDefaults).
+        * UIProcess/WebPreferences.h:
+        * UIProcess/mac/WebPreferencesMac.mm:
+        (WebKit::WebPreferences::platformInitializeStore): Deleted.
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
+2016-05-04  Dean Jackson  <[email protected]>
+
         TestRunner should always enable all the experimental features
         https://bugs.webkit.org/show_bug.cgi?id=157360
         <rdar://problem/26099748>

Modified: trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h (200436 => 200437)


--- trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h	2016-05-04 22:28:40 UTC (rev 200436)
+++ trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h	2016-05-04 22:29:18 UTC (rev 200437)
@@ -231,10 +231,7 @@
     macro(NewBlockInsideInlineModelEnabled, newBlockInsideInlineModelEnabled, Bool, bool, false, "", "") \
     macro(HTTPEquivEnabled, httpEquivEnabled, Bool, bool, true, "", "") \
     macro(MockCaptureDevicesEnabled, mockCaptureDevicesEnabled, Bool, bool, false, "", "") \
-    macro(ShadowDOMEnabled, shadowDOMEnabled, Bool, bool, true, "", "") \
-    macro(CustomElementsEnabled, customElementsEnabled, Bool, bool, false, "", "") \
     macro(FetchAPIEnabled, fetchAPIEnabled, Bool, bool, false, "", "") \
-    macro(WebGL2Enabled, webGL2Enabled, Bool, bool, false, "", "") \
     macro(DownloadAttributeEnabled, downloadAttributeEnabled, Bool, bool, false, "", "") \
     macro(SelectionPaintingWithoutSelectionGapsEnabled, selectionPaintingWithoutSelectionGapsEnabled, Bool, bool, DEFAULT_SELECTION_PAINTING_WITHOUT_SELECTION_GAPS_ENABLED, "", "") \
     FOR_EACH_ADDITIONAL_WEBKIT_BOOL_PREFERENCE(macro) \
@@ -285,15 +282,20 @@
 #define FOR_EACH_WEBKIT_DEBUG_UINT32_PREFERENCE(macro) \
     macro(VisibleDebugOverlayRegions, visibleDebugOverlayRegions, UInt32, uint32_t, 0, "", "")
 
-// Remember to provide the last two parameters for all experimental features. They
-// are the text exposed to the user from the WebKit client. Also note that the key
-// should be prefixed with "experimental" so that it doesn't clash if/when the feature
-// becomes stable.
+// For experimental features:
+// - The type should be boolean.
+// - You must provide the last two parameters for all experimental features. They
+//   are the text exposed to the user from the WebKit client.
+// - They should be alphabetically ordered by the human readable text.
+// - The key should be prefixed with "experimental" so that it doesn't clash if/when the feature
+//   becomes stable.
+// - They should be false by default. The client is responsible for enabling them.
 
 #define FOR_EACH_WEBKIT_EXPERIMENTAL_FEATURE_PREFERENCE(macro) \
-    macro(ExperimentalShadowDOMEnabled, experimentalShadowDOMEnabled, Bool, bool, false, "Shadow DOM", "Support for the Shadow DOM feature") \
-    macro(ExperimentalWebGL2Enabled, experimentalWebGL2Enabled, Bool, bool, false, "WebGL 2.0", "Prototype WebGL 2 Support") \
-    macro(ExperimentalCSSGridLayoutEnabled, experimentalCSSGridLayoutEnabled, Bool, bool, true, "CSS Grid Layout", "CSS Grid Layout") \
+    macro(ExperimentalCSSGridLayoutEnabled, experimentalCSSGridLayoutEnabled, Bool, bool, false, "CSS Grid", "CSS Grid Layout Module support") \
+    macro(ExperimentalCustomElementsEnabled, experimentalCustomElementsEnabled, Bool, bool, false, "Custom Elements", "HTML Custom Elements prototype") \
+    macro(ExperimentalShadowDOMEnabled, experimentalShadowDOMEnabled, Bool, bool, false, "Shadow DOM", "HTML Shadow DOM prototype") \
+    macro(ExperimentalWebGL2Enabled, experimentalWebGL2Enabled, Bool, bool, false, "WebGL 2.0", "WebGL 2 prototype") \
     \
 
 #if PLATFORM(COCOA)

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp (200436 => 200437)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp	2016-05-04 22:28:40 UTC (rev 200436)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp	2016-05-04 22:29:18 UTC (rev 200437)
@@ -468,16 +468,6 @@
     return toImpl(preferencesRef)->webGLEnabled();
 }
 
-void WKPreferencesSetWebGL2Enabled(WKPreferencesRef preferencesRef, bool flag)
-{
-    toImpl(preferencesRef)->setWebGL2Enabled(flag);
-}
-
-bool WKPreferencesGetWebGL2Enabled(WKPreferencesRef preferencesRef)
-{
-    return toImpl(preferencesRef)->webGL2Enabled();
-}
-
 void WKPreferencesSetForceSoftwareWebGLRendering(WKPreferencesRef preferencesRef, bool flag)
 {
     toImpl(preferencesRef)->setForceSoftwareWebGLRendering(flag);
@@ -1506,26 +1496,6 @@
     return toImpl(preferencesRef)->mockCaptureDevicesEnabled();
 }
 
-void WKPreferencesSetShadowDOMEnabled(WKPreferencesRef preferencesRef, bool flag)
-{
-    toImpl(preferencesRef)->setShadowDOMEnabled(flag);
-}
-
-bool WKPreferencesGetShadowDOMEnabled(WKPreferencesRef preferencesRef)
-{
-    return toImpl(preferencesRef)->shadowDOMEnabled();
-}
-
-void WKPreferencesSetCustomElementsEnabled(WKPreferencesRef preferencesRef, bool flag)
-{
-    toImpl(preferencesRef)->setCustomElementsEnabled(flag);
-}
-
-bool WKPreferencesGetCustomElementsEnabled(WKPreferencesRef preferencesRef)
-{
-    return toImpl(preferencesRef)->customElementsEnabled();
-}
-
 void WKPreferencesSetFetchAPIEnabled(WKPreferencesRef preferencesRef, bool flag)
 {
     toImpl(preferencesRef)->setFetchAPIEnabled(flag);

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h (200436 => 200437)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h	2016-05-04 22:28:40 UTC (rev 200436)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h	2016-05-04 22:29:18 UTC (rev 200437)
@@ -100,10 +100,6 @@
 WK_EXPORT bool WKPreferencesGetWebGLEnabled(WKPreferencesRef);
 
 // Defaults to false.
-WK_EXPORT void WKPreferencesSetWebGL2Enabled(WKPreferencesRef, bool);
-WK_EXPORT bool WKPreferencesGetWebGL2Enabled(WKPreferencesRef);
-
-// Defaults to false.
 WK_EXPORT void WKPreferencesSetForceSoftwareWebGLRendering(WKPreferencesRef, bool);
 WK_EXPORT bool WKPreferencesGetForceSoftwareWebGLRendering(WKPreferencesRef);
 
@@ -417,15 +413,7 @@
 WK_EXPORT void WKPreferencesSetMockCaptureDevicesEnabled(WKPreferencesRef, bool);
 WK_EXPORT bool WKPreferencesGetMockCaptureDevicesEnabled(WKPreferencesRef);
     
-// Defaults to true
-WK_EXPORT void WKPreferencesSetShadowDOMEnabled(WKPreferencesRef, bool flag);
-WK_EXPORT bool WKPreferencesGetShadowDOMEnabled(WKPreferencesRef);
-
 // Defaults to false
-WK_EXPORT void WKPreferencesSetCustomElementsEnabled(WKPreferencesRef, bool flag);
-WK_EXPORT bool WKPreferencesGetCustomElementsEnabled(WKPreferencesRef);
-
-// Defaults to false
 WK_EXPORT void WKPreferencesSetFetchAPIEnabled(WKPreferencesRef, bool flag);
 WK_EXPORT bool WKPreferencesGetFetchAPIEnabled(WKPreferencesRef);
 

Modified: trunk/Source/WebKit2/UIProcess/WebPreferences.cpp (200436 => 200437)


--- trunk/Source/WebKit2/UIProcess/WebPreferences.cpp	2016-05-04 22:28:40 UTC (rev 200436)
+++ trunk/Source/WebKit2/UIProcess/WebPreferences.cpp	2016-05-04 22:29:18 UTC (rev 200437)
@@ -129,6 +129,11 @@
     update(); // FIXME: Only send over the changed key and value.
 }
 
+void WebPreferences::updateBoolValueForExperimentalFeatureKey(const String& key, bool value)
+{
+    update(); // FIXME: Only send over the changed key and value.
+}
+
 void WebPreferences::updateUInt32ValueForKey(const String& key, uint32_t value)
 {
     platformUpdateUInt32ValueForKey(key, value);
@@ -187,10 +192,27 @@
 
 FOR_EACH_WEBKIT_PREFERENCE(DEFINE_PREFERENCE_GETTER_AND_SETTERS)
 FOR_EACH_WEBKIT_DEBUG_PREFERENCE(DEFINE_PREFERENCE_GETTER_AND_SETTERS)
-FOR_EACH_WEBKIT_EXPERIMENTAL_FEATURE_PREFERENCE(DEFINE_PREFERENCE_GETTER_AND_SETTERS)
 
 #undef DEFINE_PREFERENCE_GETTER_AND_SETTERS
 
+#define DEFINE_EXPERIMENTAL_PREFERENCE_GETTER_AND_SETTERS(KeyUpper, KeyLower, TypeName, Type, DefaultValue, HumanReadableName, HumanReadableDescription) \
+    void WebPreferences::set##KeyUpper(const Type& value) \
+    { \
+        if (!m_store.set##TypeName##ValueForKey(WebPreferencesKey::KeyLower##Key(), value)) \
+            return; \
+        update##TypeName##ValueForExperimentalFeatureKey(WebPreferencesKey::KeyLower##Key(), value); \
+    \
+    } \
+    \
+    Type WebPreferences::KeyLower() const \
+    { \
+        return m_store.get##TypeName##ValueForKey(WebPreferencesKey::KeyLower##Key()); \
+    } \
+
+FOR_EACH_WEBKIT_EXPERIMENTAL_FEATURE_PREFERENCE(DEFINE_EXPERIMENTAL_PREFERENCE_GETTER_AND_SETTERS)
+
+#undef DEFINE_EXPERIMENTAL_PREFERENCE_GETTER_AND_SETTERS
+
 static Vector<RefPtr<API::Object>> createExperimentalFeaturesVector()
 {
     Vector<RefPtr<API::Object>> features;

Modified: trunk/Source/WebKit2/UIProcess/WebPreferences.h (200436 => 200437)


--- trunk/Source/WebKit2/UIProcess/WebPreferences.h	2016-05-04 22:28:40 UTC (rev 200436)
+++ trunk/Source/WebKit2/UIProcess/WebPreferences.h	2016-05-04 22:29:18 UTC (rev 200437)
@@ -81,6 +81,7 @@
 
     void updateStringValueForKey(const String& key, const String& value);
     void updateBoolValueForKey(const String& key, bool value);
+    void updateBoolValueForExperimentalFeatureKey(const String& key, bool value);
     void updateUInt32ValueForKey(const String& key, uint32_t value);
     void updateDoubleValueForKey(const String& key, double value);
     void updateFloatValueForKey(const String& key, float value);

Modified: trunk/Source/WebKit2/UIProcess/mac/WebPreferencesMac.mm (200436 => 200437)


--- trunk/Source/WebKit2/UIProcess/mac/WebPreferencesMac.mm	2016-05-04 22:28:40 UTC (rev 200436)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPreferencesMac.mm	2016-05-04 22:29:18 UTC (rev 200437)
@@ -147,7 +147,6 @@
 #define INITIALIZE_DEBUG_PREFERENCE_FROM_NSUSERDEFAULTS(KeyUpper, KeyLower, TypeName, Type, DefaultValue, HumanReadableName, HumanReadableDescription) \
     setDebug##TypeName##ValueIfInUserDefaults(m_identifier, m_keyPrefix, m_globalDebugKeyPrefix, WebPreferencesKey::KeyLower##Key(), m_store);
 
-    FOR_EACH_WEBKIT_EXPERIMENTAL_FEATURE_PREFERENCE(INITIALIZE_DEBUG_PREFERENCE_FROM_NSUSERDEFAULTS)
     FOR_EACH_WEBKIT_DEBUG_PREFERENCE(INITIALIZE_DEBUG_PREFERENCE_FROM_NSUSERDEFAULTS)
 
 #undef INITIALIZE_DEBUG_PREFERENCE_FROM_NSUSERDEFAULTS

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (200436 => 200437)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2016-05-04 22:28:40 UTC (rev 200436)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2016-05-04 22:29:18 UTC (rev 200437)
@@ -193,21 +193,6 @@
         RuntimeEnabledFeatures::sharedFeatures().setCSSCompositingEnabled(enabled);
 #endif
     
-#if ENABLE(SHADOW_DOM)
-    if (preference == "WebKitShadowDOMEnabled")
-        RuntimeEnabledFeatures::sharedFeatures().setShadowDOMEnabled(enabled);
-#endif
-
-#if ENABLE(CUSTOM_ELEMENTS)
-    if (preference == "WebKitCustomElementsEnabled")
-        RuntimeEnabledFeatures::sharedFeatures().setCustomElementsEnabled(enabled);
-#endif
-
-#if ENABLE(WEBGL2)
-    if (preference == "WebKitWebGL2Enabled")
-        RuntimeEnabledFeatures::sharedFeatures().setWebGL2Enabled(enabled);
-#endif
-
 #if ENABLE(FETCH_API)
     if (preference == "WebKitFetchAPIEnabled")
         RuntimeEnabledFeatures::sharedFeatures().setFetchAPIEnabled(enabled);
@@ -223,6 +208,21 @@
         RuntimeEnabledFeatures::sharedFeatures().setCSSGridLayoutEnabled(enabled);
 #endif
 
+#if ENABLE(CUSTOM_ELEMENTS)
+    if (preference == "WebKitExperimentalCustomElementsEnabled")
+        RuntimeEnabledFeatures::sharedFeatures().setCustomElementsEnabled(enabled);
+#endif
+
+#if ENABLE(SHADOW_DOM)
+    if (preference == "WebKitExperimentalShadowDOMEnabled")
+        RuntimeEnabledFeatures::sharedFeatures().setShadowDOMEnabled(enabled);
+#endif
+
+#if ENABLE(WEBGL2)
+    if (preference == "WebKitExperimentalWebGL2Enabled")
+        RuntimeEnabledFeatures::sharedFeatures().setWebGL2Enabled(enabled);
+#endif
+
     // Map the names used in LayoutTests with the names used in WebCore::Settings and WebPreferencesStore.
 #define FOR_EACH_OVERRIDE_BOOL_PREFERENCE(macro) \
     macro(WebKitAcceleratedCompositingEnabled, AcceleratedCompositingEnabled, acceleratedCompositingEnabled) \

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (200436 => 200437)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-05-04 22:28:40 UTC (rev 200436)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-05-04 22:29:18 UTC (rev 200437)
@@ -3100,18 +3100,6 @@
     settings.setServiceControlsEnabled(store.getBoolValueForKey(WebPreferencesKey::serviceControlsEnabledKey()));
 #endif
 
-#if ENABLE(SHADOW_DOM)
-    RuntimeEnabledFeatures::sharedFeatures().setShadowDOMEnabled(store.getBoolValueForKey(WebPreferencesKey::shadowDOMEnabledKey()));
-#endif
-
-#if ENABLE(CUSTOM_ELEMENTS)
-    RuntimeEnabledFeatures::sharedFeatures().setCustomElementsEnabled(store.getBoolValueForKey(WebPreferencesKey::customElementsEnabledKey()));
-#endif
-
-#if ENABLE(WEBGL2)
-    RuntimeEnabledFeatures::sharedFeatures().setWebGL2Enabled(store.getBoolValueForKey(WebPreferencesKey::webGL2EnabledKey()));
-#endif
-
 #if ENABLE(FETCH_API)
     RuntimeEnabledFeatures::sharedFeatures().setFetchAPIEnabled(store.getBoolValueForKey(WebPreferencesKey::fetchAPIEnabledKey()));
 #endif
@@ -3120,10 +3108,24 @@
     RuntimeEnabledFeatures::sharedFeatures().setDownloadAttributeEnabled(store.getBoolValueForKey(WebPreferencesKey::downloadAttributeEnabledKey()));
 #endif
 
+    // Experimental Features.
+
 #if ENABLE(CSS_GRID_LAYOUT)
     RuntimeEnabledFeatures::sharedFeatures().setCSSGridLayoutEnabled(store.getBoolValueForKey(WebPreferencesKey::experimentalCSSGridLayoutEnabledKey()));
 #endif
 
+#if ENABLE(CUSTOM_ELEMENTS)
+    RuntimeEnabledFeatures::sharedFeatures().setCustomElementsEnabled(store.getBoolValueForKey(WebPreferencesKey::experimentalCustomElementsEnabledKey()));
+#endif
+
+#if ENABLE(SHADOW_DOM)
+    RuntimeEnabledFeatures::sharedFeatures().setShadowDOMEnabled(store.getBoolValueForKey(WebPreferencesKey::experimentalShadowDOMEnabledKey()));
+#endif
+
+#if ENABLE(WEBGL2)
+    RuntimeEnabledFeatures::sharedFeatures().setWebGL2Enabled(store.getBoolValueForKey(WebPreferencesKey::experimentalWebGL2EnabledKey()));
+#endif
+
     bool processSuppressionEnabled = store.getBoolValueForKey(WebPreferencesKey::pageVisibilityBasedProcessSuppressionEnabledKey());
     if (m_processSuppressionEnabled != processSuppressionEnabled) {
         m_processSuppressionEnabled = processSuppressionEnabled;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to