Title: [197921] trunk
Revision
197921
Author
[email protected]
Date
2016-03-09 20:43:14 -0800 (Wed, 09 Mar 2016)

Log Message

Add runtime flags for shadow DOM and custom elements
https://bugs.webkit.org/show_bug.cgi?id=155213

Reviewed by Dean Jackson.

Source/WebCore:

Added new runtime flags for shadow DOM and custom elements.

* bindings/generic/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setShadowDOMEnabled): Added.
(WebCore::RuntimeEnabledFeatures::shadowDOMEnabled): Added.
(WebCore::RuntimeEnabledFeatures::setCustomElementsEnabled): Added.
(WebCore::RuntimeEnabledFeatures::customElementsEnabled): Added.
* dom/Document.idl:
* dom/Element.idl:
* dom/Node.idl:
* dom/NonDocumentTypeChildNode.idl:
* dom/ShadowRoot.idl:
* html/HTMLSlotElement.idl:

Source/WebKit/mac:

Set the runtime flag based on preferences. Enable shadow DOM and disable custom elements by default.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences shadowDOMEnabled]):
(-[WebPreferences setShadowDOMEnabled:]):
(-[WebPreferences customElementsEnabled]):
(-[WebPreferences setCustomElementsEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

Set the runtime flag based on preferences. Enable shadow DOM and disable custom elements by default.

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetShadowDOMEnabled):
(WKPreferencesGetShadowDOMEnabled):
(WKPreferencesSetCustomElementsEnabled):
(WKPreferencesGetCustomElementsEnabled):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Source/WTF:

Removed the manual overrides of ENABLE_SHADOW_DOM and ENABLE_CUSTOM_ELEMENTS as they were
making --no-shadow-dom and --no-custom-elements flags on build-webkit useless.

* wtf/FeatureDefines.h:

Tools:

Always enable shadow DOM and custom elements during testing.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues):
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::beginTesting):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setShadowDOMEnabled): Added.
* WebKitTestRunner/InjectedBundle/TestRunner.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (197920 => 197921)


--- trunk/Source/WTF/ChangeLog	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Source/WTF/ChangeLog	2016-03-10 04:43:14 UTC (rev 197921)
@@ -1,3 +1,15 @@
+2016-03-09  Ryosuke Niwa  <[email protected]>
+
+        Add runtime flags for shadow DOM and custom elements
+        https://bugs.webkit.org/show_bug.cgi?id=155213
+
+        Reviewed by Dean Jackson.
+
+        Removed the manual overrides of ENABLE_SHADOW_DOM and ENABLE_CUSTOM_ELEMENTS as they were
+        making --no-shadow-dom and --no-custom-elements flags on build-webkit useless.
+
+        * wtf/FeatureDefines.h:
+
 2016-03-09  Keith Rollin  <[email protected]>
 
         Add state dumping facility

Modified: trunk/Source/WTF/wtf/FeatureDefines.h (197920 => 197921)


--- trunk/Source/WTF/wtf/FeatureDefines.h	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Source/WTF/wtf/FeatureDefines.h	2016-03-10 04:43:14 UTC (rev 197921)
@@ -134,14 +134,6 @@
 #define ENABLE_RESPECT_EXIF_ORIENTATION 1
 #endif
 
-#if !defined(ENABLE_SHADOW_DOM)
-#define ENABLE_SHADOW_DOM 1
-#endif
-
-#if !defined(ENABLE_CUSTOM_ELEMENTS)
-#define ENABLE_CUSTOM_ELEMENTS 1
-#endif
-
 #if !defined(ENABLE_TEXT_CARET)
 #define ENABLE_TEXT_CARET 0
 #endif
@@ -258,14 +250,6 @@
 #define ENABLE_PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC 1
 #endif
 
-#if !defined(ENABLE_SHADOW_DOM)
-#define ENABLE_SHADOW_DOM 1
-#endif
-
-#if !defined(ENABLE_CUSTOM_ELEMENTS)
-#define ENABLE_CUSTOM_ELEMENTS 1
-#endif
-
 #if !defined(ENABLE_MAC_GESTURE_EVENTS) && USE(APPLE_INTERNAL_SDK)
 #define ENABLE_MAC_GESTURE_EVENTS 1
 #endif
@@ -695,14 +679,6 @@
 #define ENABLE_RUBBER_BANDING 0
 #endif
 
-#if !defined(ENABLE_SHADOW_DOM)
-#define ENABLE_SHADOW_DOM 0
-#endif
-
-#if !defined(ENABLE_CUSTOM_ELEMENTS)
-#define ENABLE_CUSTOM_ELEMENTS 0
-#endif
-
 #if !defined(ENABLE_SMOOTH_SCROLLING)
 #define ENABLE_SMOOTH_SCROLLING 0
 #endif

Modified: trunk/Source/WebCore/ChangeLog (197920 => 197921)


--- trunk/Source/WebCore/ChangeLog	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Source/WebCore/ChangeLog	2016-03-10 04:43:14 UTC (rev 197921)
@@ -1,5 +1,26 @@
 2016-03-09  Ryosuke Niwa  <[email protected]>
 
+        Add runtime flags for shadow DOM and custom elements
+        https://bugs.webkit.org/show_bug.cgi?id=155213
+
+        Reviewed by Dean Jackson.
+
+        Added new runtime flags for shadow DOM and custom elements.
+
+        * bindings/generic/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::setShadowDOMEnabled): Added.
+        (WebCore::RuntimeEnabledFeatures::shadowDOMEnabled): Added.
+        (WebCore::RuntimeEnabledFeatures::setCustomElementsEnabled): Added.
+        (WebCore::RuntimeEnabledFeatures::customElementsEnabled): Added.
+        * dom/Document.idl:
+        * dom/Element.idl:
+        * dom/Node.idl:
+        * dom/NonDocumentTypeChildNode.idl:
+        * dom/ShadowRoot.idl:
+        * html/HTMLSlotElement.idl:
+
+2016-03-09  Ryosuke Niwa  <[email protected]>
+
         defineElement should upgrade existing unresolved custom elements
         https://bugs.webkit.org/show_bug.cgi?id=155107
 

Modified: trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h (197920 => 197921)


--- trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h	2016-03-10 04:43:14 UTC (rev 197921)
@@ -206,6 +206,16 @@
     bool webAnimationsEnabled() const { return m_areWebAnimationsEnabled; }
 #endif
 
+#if ENABLE(SHADOW_DOM)
+    void setShadowDOMEnabled(bool isEnabled) { m_isShadowDOMEnabled = isEnabled; }
+    bool shadowDOMEnabled() const { return m_isShadowDOMEnabled; }
+#endif
+
+#if ENABLE(CUSTOM_ELEMENTS)
+    void setCustomElementsEnabled(bool areEnabled) { m_areCustomElementsEnabled = areEnabled; }
+    bool customElementsEnabled() const { return m_areCustomElementsEnabled; }
+#endif
+
     WEBCORE_EXPORT static RuntimeEnabledFeatures& sharedFeatures();
 
 private:
@@ -288,7 +298,15 @@
 #if ENABLE(WEB_ANIMATIONS)
     bool m_areWebAnimationsEnabled;
 #endif
+    
+#if ENABLE(SHADOW_DOM)
+    bool m_isShadowDOMEnabled;
+#endif
 
+#if ENABLE(CUSTOM_ELEMENTS)
+    bool m_areCustomElementsEnabled;
+#endif
+
     friend class WTF::NeverDestroyed<RuntimeEnabledFeatures>;
 };
 

Modified: trunk/Source/WebCore/dom/Document.idl (197920 => 197921)


--- trunk/Source/WebCore/dom/Document.idl	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Source/WebCore/dom/Document.idl	2016-03-10 04:43:14 UTC (rev 197921)
@@ -294,7 +294,7 @@
 #endif
 
 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
-    [Custom, RaisesException, Conditional=CUSTOM_ELEMENTS]
+    [Custom, RaisesException, Conditional=CUSTOM_ELEMENTS, EnabledAtRuntime=CustomElements]
     void defineElement(DOMString localName, Function constructor);
 #endif
 

Modified: trunk/Source/WebCore/dom/Element.idl (197920 => 197921)


--- trunk/Source/WebCore/dom/Element.idl	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Source/WebCore/dom/Element.idl	2016-03-10 04:43:14 UTC (rev 197921)
@@ -171,9 +171,9 @@
 
     // Shadow DOM API
 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
-    [Conditional=SHADOW_DOM, RaisesException] ShadowRoot attachShadow(Dictionary options);
-    [Conditional=SHADOW_DOM, ImplementedAs=shadowRootForBindings, CallWith=ScriptState] readonly attribute ShadowRoot shadowRoot;
-    [Conditional=SHADOW_DOM, Reflect] attribute DOMString slot;
+    [Conditional=SHADOW_DOM, EnabledAtRuntime=ShadowDOM, RaisesException] ShadowRoot attachShadow(Dictionary options);
+    [Conditional=SHADOW_DOM, EnabledAtRuntime=ShadowDOM, ImplementedAs=shadowRootForBindings, CallWith=ScriptState] readonly attribute ShadowRoot shadowRoot;
+    [Conditional=SHADOW_DOM, EnabledAtRuntime=ShadowDOM, Reflect] attribute DOMString slot;
 #endif
 
     // Event Handlers

Modified: trunk/Source/WebCore/dom/NonDocumentTypeChildNode.idl (197920 => 197921)


--- trunk/Source/WebCore/dom/NonDocumentTypeChildNode.idl	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Source/WebCore/dom/NonDocumentTypeChildNode.idl	2016-03-10 04:43:14 UTC (rev 197921)
@@ -32,6 +32,6 @@
     readonly attribute Element nextElementSibling;
 
 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
-    [Conditional=SHADOW_DOM] readonly attribute HTMLSlotElement assignedSlot;
+    [Conditional=SHADOW_DOM, EnabledAtRuntime=ShadowDOM] readonly attribute HTMLSlotElement assignedSlot;
 #endif
 };

Modified: trunk/Source/WebCore/dom/ShadowRoot.idl (197920 => 197921)


--- trunk/Source/WebCore/dom/ShadowRoot.idl	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Source/WebCore/dom/ShadowRoot.idl	2016-03-10 04:43:14 UTC (rev 197921)
@@ -25,6 +25,7 @@
 
 [
     Conditional=SHADOW_DOM,
+    EnabledAtRuntime=ShadowDOM,
     JSGenerateToJSObject
 ] interface ShadowRoot : DocumentFragment {
     readonly attribute Element          activeElement;

Modified: trunk/Source/WebCore/html/HTMLSlotElement.idl (197920 => 197921)


--- trunk/Source/WebCore/html/HTMLSlotElement.idl	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Source/WebCore/html/HTMLSlotElement.idl	2016-03-10 04:43:14 UTC (rev 197921)
@@ -26,6 +26,7 @@
 // https://w3c.github.io/webcomponents/spec/shadow/#idl-def-HTMLSlotElement
 [
     Conditional=SHADOW_DOM,
+    EnabledAtRuntime=ShadowDOM,
     JSGenerateToNativeObject
 ] interface HTMLSlotElement : HTMLElement {
 

Modified: trunk/Source/WebKit/mac/ChangeLog (197920 => 197921)


--- trunk/Source/WebKit/mac/ChangeLog	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Source/WebKit/mac/ChangeLog	2016-03-10 04:43:14 UTC (rev 197921)
@@ -1,3 +1,23 @@
+2016-03-09  Ryosuke Niwa  <[email protected]>
+
+        Add runtime flags for shadow DOM and custom elements
+        https://bugs.webkit.org/show_bug.cgi?id=155213
+
+        Reviewed by Dean Jackson.
+
+        Set the runtime flag based on preferences. Enable shadow DOM and disable custom elements by default.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences shadowDOMEnabled]):
+        (-[WebPreferences setShadowDOMEnabled:]):
+        (-[WebPreferences customElementsEnabled]):
+        (-[WebPreferences setCustomElementsEnabled:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2016-03-09  David Kilzer  <[email protected]>
 
         REGRESSION (r197149): Missing availability checks when soft-linking DataDetectors.framework

Modified: trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h (197920 => 197921)


--- trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h	2016-03-10 04:43:14 UTC (rev 197921)
@@ -157,6 +157,8 @@
 #define WebKitGamepadsEnabledPreferenceKey @"WebKitGamepadsEnabled"
 #define WebKitServiceControlsEnabledPreferenceKey @"WebKitServiceControlsEnabled"
 #define WebKitMediaKeysStorageDirectoryKey @"WebKitMediaKeysStorageDirectory"
+#define WebKitShadowDOMEnabledPreferenceKey @"WebKitShadowDOMEnabled"
+#define WebKitCustomElementsEnabledPreferenceKey @"WebKitCustomElementsEnabled"
 
 #if !TARGET_OS_IPHONE
 // These are private both because callers should be using the cover methods and because the

Modified: trunk/Source/WebKit/mac/WebView/WebPreferences.mm (197920 => 197921)


--- trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Source/WebKit/mac/WebView/WebPreferences.mm	2016-03-10 04:43:14 UTC (rev 197921)
@@ -602,6 +602,12 @@
 #if ENABLE(MEDIA_STREAM)
         [NSNumber numberWithBool:NO], WebKitMockCaptureDevicesEnabledPreferenceKey,
 #endif
+#if ENABLE(SHADOW_DOM)
+        [NSNumber numberWithBool:YES], WebKitShadowDOMEnabledPreferenceKey,
+#endif
+#if ENABLE(CUSTOM_ELEMENTS)
+        [NSNumber numberWithBool:NO], WebKitCustomElementsEnabledPreferenceKey,
+#endif
         nil];
 
 #if !PLATFORM(IOS)
@@ -2639,6 +2645,26 @@
     [self _setBoolValue:flag forKey:WebKitMockCaptureDevicesEnabledPreferenceKey];
 }
 
+- (BOOL)shadowDOMEnabled
+{
+    return [self _boolValueForKey:WebKitShadowDOMEnabledPreferenceKey];
+}
+
+- (void)setShadowDOMEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitShadowDOMEnabledPreferenceKey];
+}
+
+- (BOOL)customElementsEnabled
+{
+    return [self _boolValueForKey:WebKitCustomElementsEnabledPreferenceKey];
+}
+
+- (void)setCustomElementsEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitCustomElementsEnabledPreferenceKey];
+}
+
 @end
 
 @implementation WebPreferences (WebInternal)

Modified: trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h (197920 => 197921)


--- trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h	2016-03-10 04:43:14 UTC (rev 197921)
@@ -467,6 +467,12 @@
 - (void)setMockCaptureDevicesEnabled:(BOOL)flag;
 - (BOOL)mockCaptureDevicesEnabled;
 
+- (void)setShadowDOMEnabled:(BOOL)flag;
+- (BOOL)shadowDOMEnabled;
+
+- (void)setCustomElementsEnabled:(BOOL)flag;
+- (BOOL)customElementsEnabled;
+
 @property (nonatomic) BOOL _javascript_MarkupEnabled;
 @property (nonatomic) BOOL mediaDataLoadsAutomatically;
 

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (197920 => 197921)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2016-03-10 04:43:14 UTC (rev 197921)
@@ -2481,6 +2481,14 @@
     RuntimeEnabledFeatures::sharedFeatures().setWebkitIndexedDBEnabled(true);
 #endif
 
+#if ENABLE(SHADOW_DOM)
+    RuntimeEnabledFeatures::sharedFeatures().setShadowDOMEnabled([preferences shadowDOMEnabled]);
+#endif
+#if ENABLE(CUSTOM_ELEMENTS)
+    RuntimeEnabledFeatures::sharedFeatures().setCustomElementsEnabled([preferences customElementsEnabled]);
+#endif
+
+
     NSTimeInterval timeout = [preferences incrementalRenderingSuppressionTimeoutInSeconds];
     if (timeout > 0)
         settings.setIncrementalRenderingSuppressionTimeoutInSeconds(timeout);

Modified: trunk/Source/WebKit2/ChangeLog (197920 => 197921)


--- trunk/Source/WebKit2/ChangeLog	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Source/WebKit2/ChangeLog	2016-03-10 04:43:14 UTC (rev 197921)
@@ -1,3 +1,24 @@
+2016-03-09  Ryosuke Niwa  <[email protected]>
+
+        Add runtime flags for shadow DOM and custom elements
+        https://bugs.webkit.org/show_bug.cgi?id=155213
+
+        Reviewed by Dean Jackson.
+
+        Set the runtime flag based on preferences. Enable shadow DOM and disable custom elements by default.
+
+        * Shared/WebPreferencesDefinitions.h:
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetShadowDOMEnabled):
+        (WKPreferencesGetShadowDOMEnabled):
+        (WKPreferencesSetCustomElementsEnabled):
+        (WKPreferencesGetCustomElementsEnabled):
+        * UIProcess/API/C/WKPreferencesRefPrivate.h:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::overrideBoolPreferenceForTestRunner):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2016-03-09  Brent Fulgham  <[email protected]>
 
         Handling 'allowUniversalAccessFromFileURLs' on WKWebViewConfiguration causes test breakage

Modified: trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h (197920 => 197921)


--- trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h	2016-03-10 04:43:14 UTC (rev 197921)
@@ -224,6 +224,8 @@
     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) \
     FOR_EACH_ADDITIONAL_WEBKIT_BOOL_PREFERENCE(macro) \
     \
 

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


--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp	2016-03-10 04:43:14 UTC (rev 197921)
@@ -1466,3 +1466,23 @@
 {
     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)->setShadowDOMEnabled(flag);
+}
+
+bool WKPreferencesGetCustomElementsEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->shadowDOMEnabled();
+}

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


--- trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h	2016-03-10 04:43:14 UTC (rev 197921)
@@ -402,7 +402,15 @@
 // Defaults to false.
 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);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (197920 => 197921)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2016-03-10 04:43:14 UTC (rev 197921)
@@ -192,7 +192,17 @@
     if (preference == "WebKitCSSCompositingEnabled")
         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
+
     // 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 (197920 => 197921)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2016-03-10 04:43:14 UTC (rev 197921)
@@ -3057,6 +3057,14 @@
     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
+
     bool processSuppressionEnabled = store.getBoolValueForKey(WebPreferencesKey::pageVisibilityBasedProcessSuppressionEnabledKey());
     if (m_processSuppressionEnabled != processSuppressionEnabled) {
         m_processSuppressionEnabled = processSuppressionEnabled;

Modified: trunk/Tools/ChangeLog (197920 => 197921)


--- trunk/Tools/ChangeLog	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Tools/ChangeLog	2016-03-10 04:43:14 UTC (rev 197921)
@@ -1,3 +1,20 @@
+2016-03-09  Ryosuke Niwa  <[email protected]>
+
+        Add runtime flags for shadow DOM and custom elements
+        https://bugs.webkit.org/show_bug.cgi?id=155213
+
+        Reviewed by Dean Jackson.
+
+        Always enable shadow DOM and custom elements during testing.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetWebPreferencesToConsistentValues):
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::beginTesting):
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::setShadowDOMEnabled): Added.
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+
 2016-03-09  Brent Fulgham  <[email protected]>
 
         Handling 'allowUniversalAccessFromFileURLs' on WKWebViewConfiguration causes test breakage

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (197920 => 197921)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2016-03-10 04:43:14 UTC (rev 197921)
@@ -984,6 +984,9 @@
     [preferences setMediaSourceEnabled:YES];
 #endif
 
+    [preferences setShadowDOMEnabled:YES];
+    [preferences setCustomElementsEnabled:YES];
+
     [preferences setHiddenPageDOMTimerThrottlingEnabled:NO];
     [preferences setHiddenPageCSSAnimationSuspensionEnabled:NO];
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (197920 => 197921)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2016-03-10 04:43:14 UTC (rev 197921)
@@ -304,6 +304,10 @@
     m_testRunner->setShouldDumpFrameLoadCallbacks(booleanForKey(settings, "DumpFrameLoadDelegates"));
     m_testRunner->setUserStyleSheetEnabled(false);
     m_testRunner->setXSSAuditorEnabled(false);
+
+    m_testRunner->setShadowDOMEnabled(true);
+    m_testRunner->setCustomElementsEnabled(true);
+
     m_testRunner->setCloseRemainingWindowsWhenComplete(false);
     m_testRunner->setAcceptsEditing(true);
     m_testRunner->setTabKeyCyclesThroughElements(true);

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (197920 => 197921)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2016-03-10 04:43:14 UTC (rev 197921)
@@ -318,6 +318,20 @@
     WKBundleOverrideBoolPreferenceForTestRunner(injectedBundle.bundle(), injectedBundle.pageGroup(), key.get(), enabled);
 }
 
+void TestRunner::setShadowDOMEnabled(bool enabled)
+{
+    WKRetainPtr<WKStringRef> key(AdoptWK, WKStringCreateWithUTF8CString("WebKitShadowDOMEnabled"));
+    auto& injectedBundle = InjectedBundle::singleton();
+    WKBundleOverrideBoolPreferenceForTestRunner(injectedBundle.bundle(), injectedBundle.pageGroup(), key.get(), enabled);
+}
+
+void TestRunner::setCustomElementsEnabled(bool enabled)
+{
+    WKRetainPtr<WKStringRef> key(AdoptWK, WKStringCreateWithUTF8CString("WebKitCustomElementsEnabled"));
+    auto& injectedBundle = InjectedBundle::singleton();
+    WKBundleOverrideBoolPreferenceForTestRunner(injectedBundle.bundle(), injectedBundle.pageGroup(), key.get(), enabled);
+}
+
 void TestRunner::setAllowUniversalAccessFromFileURLs(bool enabled)
 {
     auto& injectedBundle = InjectedBundle::singleton();

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (197920 => 197921)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2016-03-10 04:06:51 UTC (rev 197920)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2016-03-10 04:43:14 UTC (rev 197921)
@@ -98,6 +98,8 @@
     void setCanOpenWindows(bool);
     void setCloseRemainingWindowsWhenComplete(bool value) { m_shouldCloseExtraWindows = value; }
     void setXSSAuditorEnabled(bool);
+    void setShadowDOMEnabled(bool);
+    void setCustomElementsEnabled(bool);
     void setAllowUniversalAccessFromFileURLs(bool);
     void setAllowFileAccessFromFileURLs(bool);
     void setPluginsEnabled(bool);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to