Add a RuntimeEnabledFeature for display: contents, defaulted to false.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 May 2017 15:51:41 +0000 (15:51 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 May 2017 15:51:41 +0000 (15:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=171984

Patch by Emilio Cobos Álvarez <ecobos@igalia.com> on 2017-05-17
Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

* web-platform-tests/innerText/getter-expected.txt:

Source/WebCore:

The "defaulted to false" is not only because there are spec issues,
but because I ran the WPT suite, and there was a fair amount of
crashes and messed render trees.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyle):
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setDisplayContentsEnabled):
(WebCore::RuntimeEnabledFeatures::displayContentsEnabled):

Source/WebKit/mac:

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences displayContentsEnabled]):
(-[WebPreferences setDisplayContentsEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetDisplayContentsEnabled):
(WKPreferencesGetDisplayContentsEnabled):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Tools:

* DumpRenderTree/mac/DumpRenderTree.mm:
(enableExperimentalFeatures):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216974 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/innerText/getter-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/page/RuntimeEnabledFeatures.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
Source/WebKit/mac/WebView/WebPreferences.mm
Source/WebKit/mac/WebView/WebPreferencesPrivate.h
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesDefinitions.h
Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Tools/ChangeLog
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/WebKitTestRunner/TestController.cpp

index 4a590e7..908e9bb 100644 (file)
@@ -1,3 +1,12 @@
+2017-05-17  Emilio Cobos Álvarez  <ecobos@igalia.com>
+
+        Add a RuntimeEnabledFeature for display: contents, defaulted to false.
+        https://bugs.webkit.org/show_bug.cgi?id=171984
+
+        Reviewed by Antti Koivisto.
+
+        * web-platform-tests/innerText/getter-expected.txt:
+
 2017-05-16  Chris Dumez  <cdumez@apple.com>
 
         Implement DOMMatrix / DOMMatrixReadOnly
index 91f2086..47201d5 100644 (file)
@@ -51,9 +51,9 @@ FAIL non-display-none child of svg ("<div id='target'>abc") assert_equals: expec
 PASS display:none child of svg ("<div style='display:none' id='target'>abc") 
 PASS child of display:none child of svg ("<div style='display:none'><div id='target'>abc") 
 PASS display:contents container ("<div style='display:contents'>abc") 
-PASS display:contents container ("<div><div style='display:contents'>abc") 
-PASS display:contents rendered ("<div>123<span style='display:contents'>abc") 
-PASS display:contents not processed via textContent ("<div style='display:contents'>   ") 
+FAIL display:contents container ("<div><div style='display:contents'>abc") assert_equals: expected "abc" but got ""
+FAIL display:contents rendered ("<div>123<span style='display:contents'>abc") assert_equals: expected "123abc" but got "123"
+FAIL display:contents not processed via textContent ("<div style='display:contents'>   ") assert_equals: expected "" but got "   "
 PASS display:contents not processed via textContent ("<div><div style='display:contents'>   ") 
 PASS visibility:hidden container ("<div style='visibility:hidden'>abc") 
 PASS visibility:hidden child not rendered ("<div>123<span style='visibility:hidden'>abc") 
index 7ade803..408c6a8 100644 (file)
@@ -1,3 +1,20 @@
+2017-05-17  Emilio Cobos Álvarez  <ecobos@igalia.com>
+
+        Add a RuntimeEnabledFeature for display: contents, defaulted to false.
+        https://bugs.webkit.org/show_bug.cgi?id=171984
+
+        Reviewed by Antti Koivisto.
+
+        The "defaulted to false" is not only because there are spec issues,
+        but because I ran the WPT suite, and there was a fair amount of
+        crashes and messed render trees.
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::adjustRenderStyle):
+        * page/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::setDisplayContentsEnabled):
+        (WebCore::RuntimeEnabledFeatures::displayContentsEnabled):
+
 2017-05-17  Antti Koivisto  <antti@apple.com>
 
         Regression (198943): <marquee> shouldn't wrap text
index 7074d23..a1029ee 100644 (file)
 #include "RenderTheme.h"
 #include "RenderView.h"
 #include "RuleSet.h"
+#include "RuntimeEnabledFeatures.h"
 #include "SVGDocument.h"
 #include "SVGDocumentExtensions.h"
 #include "SVGFontFaceElement.h"
@@ -795,7 +796,7 @@ void StyleResolver::adjustRenderStyle(RenderStyle& style, const RenderStyle& par
 
     if (style.display() == CONTENTS) {
         // FIXME: Enable for all elements.
-        bool elementSupportsDisplayContents = is<HTMLSlotElement>(element);
+        bool elementSupportsDisplayContents = is<HTMLSlotElement>(element) || RuntimeEnabledFeatures::sharedFeatures().displayContentsEnabled();
         if (!elementSupportsDisplayContents)
             style.setDisplay(INLINE);
     }
index 61811e4..ba6cb6f 100644 (file)
@@ -43,6 +43,9 @@ namespace WebCore {
 class RuntimeEnabledFeatures {
     WTF_MAKE_NONCOPYABLE(RuntimeEnabledFeatures);
 public:
+    void setDisplayContentsEnabled(bool isEnabled) { m_isDisplayContentsEnabled = isEnabled; }
+    bool displayContentsEnabled() const { return m_isDisplayContentsEnabled; }
+
     void setDOMIteratorEnabled(bool isEnabled) { m_isDOMIteratorEnabled = isEnabled; }
     bool domIteratorEnabled() const { return m_isDOMIteratorEnabled; }
 
@@ -226,6 +229,7 @@ private:
     bool m_isInteractiveFormValidationEnabled { false };
     bool m_isCredentialManagementEnabled { false };
 
+    bool m_isDisplayContentsEnabled { false };
     bool m_isDOMIteratorEnabled { true };
     bool m_isGeolocationEnabled { true };
     bool m_isShadowDOMEnabled { true };
index be7c291..5de9802 100644 (file)
@@ -1,3 +1,19 @@
+2017-05-17  Emilio Cobos Álvarez  <ecobos@igalia.com>
+
+        Add a RuntimeEnabledFeature for display: contents, defaulted to false.
+        https://bugs.webkit.org/show_bug.cgi?id=171984
+
+        Reviewed by Antti Koivisto.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences displayContentsEnabled]):
+        (-[WebPreferences setDisplayContentsEnabled:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2017-05-16  Sam Weinig  <sam@webkit.org>
 
         Bring Notification.idl up to spec
index 7d6de1f..2124e19 100644 (file)
 #define WebKitMediaCaptureRequiresSecureConnectionPreferenceKey @"WebKitMediaCaptureRequiresSecureConnection"
 #define WebKitAttachmentElementEnabledPreferenceKey @"WebKitAttachmentElementEnabled"
 #define WebKitIntersectionObserverEnabledPreferenceKey @"WebKitIntersectionObserverEnabled"
+#define WebKitDisplayContentsEnabledPreferenceKey @"WebKitDisplayContentsEnabled"
 #define WebKitUserTimingEnabledPreferenceKey @"WebKitUserTimingEnabled"
 #define WebKitResourceTimingEnabledPreferenceKey @"WebKitResourceTimingEnabled"
index f8c57c8..8402b68 100644 (file)
@@ -666,6 +666,7 @@ public:
 #if ENABLE(INTERSECTION_OBSERVER)
         @NO, WebKitIntersectionObserverEnabledPreferenceKey,
 #endif
+        @NO, WebKitDisplayContentsEnabledPreferenceKey,
         @NO, WebKitUserTimingEnabledPreferenceKey,
         @NO, WebKitResourceTimingEnabledPreferenceKey,
         @NO, WebKitCredentialManagementEnabledPreferenceKey,
@@ -3033,6 +3034,16 @@ static NSString *classIBCreatorID = nil;
     [self _setBoolValue:flag forKey:WebKitIntersectionObserverEnabledPreferenceKey];
 }
 
+- (BOOL)displayContentsEnabled
+{
+    return [self _boolValueForKey:WebKitDisplayContentsEnabledPreferenceKey];
+}
+
+- (void)setDisplayContentsEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitDisplayContentsEnabledPreferenceKey];
+}
+
 - (BOOL)userTimingEnabled
 {
     return [self _boolValueForKey:WebKitUserTimingEnabledPreferenceKey];
index 823fc36..efcb165 100644 (file)
@@ -555,6 +555,7 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification;
 @property (nonatomic) BOOL attachmentElementEnabled;
 @property (nonatomic) BOOL allowsInlineMediaPlaybackAfterFullscreen;
 @property (nonatomic) BOOL intersectionObserverEnabled;
+@property (nonatomic) BOOL displayContentsEnabled;
 @property (nonatomic) BOOL userTimingEnabled;
 @property (nonatomic) BOOL resourceTimingEnabled;
 @property (nonatomic) BOOL linkPreloadEnabled;
index 7c1e057..9dfe567 100644 (file)
@@ -3043,6 +3043,7 @@ static bool needsSelfRetainWhileLoadingQuirk()
 #if ENABLE(INTERSECTION_OBSERVER)
     RuntimeEnabledFeatures::sharedFeatures().setIntersectionObserverEnabled(preferences.intersectionObserverEnabled);
 #endif
+    RuntimeEnabledFeatures::sharedFeatures().setDisplayContentsEnabled(preferences.displayContentsEnabled);
 
 #if ENABLE(SUBTLE_CRYPTO)
     RuntimeEnabledFeatures::sharedFeatures().setSubtleCryptoEnabled([preferences subtleCryptoEnabled]);
index c8a3b07..1023a90 100644 (file)
@@ -1,3 +1,18 @@
+2017-05-17  Emilio Cobos Álvarez  <ecobos@igalia.com>
+
+        Add a RuntimeEnabledFeature for display: contents, defaulted to false.
+        https://bugs.webkit.org/show_bug.cgi?id=171984
+
+        Reviewed by Antti Koivisto.
+
+        * Shared/WebPreferencesDefinitions.h:
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetDisplayContentsEnabled):
+        (WKPreferencesGetDisplayContentsEnabled):
+        * UIProcess/API/C/WKPreferencesRefPrivate.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences):
+
 2017-05-17  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Unreviewed. Fix the build with MEDIA_STREAM disabled after r216952.
index 6d876e7..8c59a84 100644 (file)
     macro(WebAnimationsEnabled, webAnimationsEnabled, Bool, bool, false, "Web Animations", "Web Animations prototype") \
     macro(WebGL2Enabled, webGL2Enabled, Bool, bool, false, "WebGL 2.0", "WebGL 2 prototype") \
     macro(WebGPUEnabled, webGPUEnabled, Bool, bool, false, "WebGPU", "WebGPU prototype") \
+    macro(DisplayContentsEnabled, displayContentsEnabled, Bool, bool, false, "display: contents", "Enable CSS display: contents support") \
     \
 
 #if PLATFORM(COCOA)
index ead76ba..1c2a2a4 100644 (file)
@@ -1631,6 +1631,16 @@ bool WKPreferencesGetFetchAPIEnabled(WKPreferencesRef preferencesRef)
     return toImpl(preferencesRef)->fetchAPIEnabled();
 }
 
+void WKPreferencesSetDisplayContentsEnabled(WKPreferencesRef preferencesRef, bool flag)
+{
+    toImpl(preferencesRef)->setDisplayContentsEnabled(flag);
+}
+
+bool WKPreferencesGetDisplayContentsEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->displayContentsEnabled();
+}
+
 void WKPreferencesSetDownloadAttributeEnabled(WKPreferencesRef preferencesRef, bool flag)
 {
     toImpl(preferencesRef)->setDownloadAttributeEnabled(flag);
index cd232b9..12557b3 100644 (file)
@@ -458,6 +458,10 @@ WK_EXPORT void WKPreferencesSetIntersectionObserverEnabled(WKPreferencesRef, boo
 WK_EXPORT bool WKPreferencesGetIntersectionObserverEnabled(WKPreferencesRef);
 
 // Defaults to false
+WK_EXPORT void WKPreferencesSetDisplayContentsEnabled(WKPreferencesRef, bool flag);
+WK_EXPORT bool WKPreferencesGetDisplayContentsEnabled(WKPreferencesRef);
+
+// Defaults to false
 WK_EXPORT void WKPreferencesSetUserTimingEnabled(WKPreferencesRef, bool flag);
 WK_EXPORT bool WKPreferencesGetUserTimingEnabled(WKPreferencesRef);
 
index 73528d7..13b56cc 100644 (file)
@@ -3352,6 +3352,8 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
     RuntimeEnabledFeatures::sharedFeatures().setIntersectionObserverEnabled(store.getBoolValueForKey(WebPreferencesKey::intersectionObserverEnabledKey()));
 #endif
 
+    RuntimeEnabledFeatures::sharedFeatures().setDisplayContentsEnabled(store.getBoolValueForKey(WebPreferencesKey::displayContentsEnabledKey()));
+
     RuntimeEnabledFeatures::sharedFeatures().setUserTimingEnabled(store.getBoolValueForKey(WebPreferencesKey::userTimingEnabledKey()));
     RuntimeEnabledFeatures::sharedFeatures().setResourceTimingEnabled(store.getBoolValueForKey(WebPreferencesKey::resourceTimingEnabledKey()));
     RuntimeEnabledFeatures::sharedFeatures().setLinkPreloadEnabled(store.getBoolValueForKey(WebPreferencesKey::linkPreloadEnabledKey()));
index b549958..4f7a09e 100644 (file)
@@ -1,3 +1,15 @@
+2017-05-17  Emilio Cobos Álvarez  <ecobos@igalia.com>
+
+        Add a RuntimeEnabledFeature for display: contents, defaulted to false.
+        https://bugs.webkit.org/show_bug.cgi?id=171984
+
+        Reviewed by Antti Koivisto.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (enableExperimentalFeatures):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::resetPreferencesToConsistentValues):
+
 2017-05-16  Timothy Horton  <timothy_horton@apple.com>
 
         Fix the build
index b4e6876..f8bd95c 100644 (file)
@@ -838,6 +838,7 @@ static NSString *libraryPathForDumpRenderTree()
 static void enableExperimentalFeatures(WebPreferences* preferences)
 {
     [preferences setCSSGridLayoutEnabled:YES];
+    [preferences setDisplayContentsEnabled:YES];
     // FIXME: SpringTimingFunction
     [preferences setGamepadsEnabled:YES];
     [preferences setLinkPreloadEnabled:YES];
index afdd9a8..f0be9d1 100644 (file)
@@ -674,6 +674,7 @@ void TestController::resetPreferencesToConsistentValues(const TestOptions& optio
     WKPreferencesSetArtificialPluginInitializationDelayEnabled(preferences, false);
     WKPreferencesSetTabToLinksEnabled(preferences, false);
     WKPreferencesSetInteractiveFormValidationEnabled(preferences, true);
+    WKPreferencesSetDisplayContentsEnabled(preferences, true);
 
     WKPreferencesSetMockScrollbarsEnabled(preferences, options.useMockScrollbars);
     WKPreferencesSetNeedsSiteSpecificQuirks(preferences, options.needsSiteSpecificQuirks);