Title: [214232] trunk
Revision
214232
Author
za...@apple.com
Date
2017-03-21 14:39:01 -0700 (Tue, 21 Mar 2017)

Log Message

2017-03-21  Zalan Bujtas  <za...@apple.com>

        Tear down descendant renderers when <slot>'s display value is set to no "contents".
        https://bugs.webkit.org/show_bug.cgi?id=169921
        <rdar://problem/30336417>

        Reviewed by Antti Koivisto.

        Since "display: contents" does not generate a renderer, when an element's display value is
        changed to something other than "contents", we not only create a renderer but also reparent its descendant
        subtree (e.g from slot's parent to the newly constructed slot renderer). During this reparenting, we
        need to tear down the descendant subtree tree and build it up again to reflect the new rendering context.

        Test: fast/shadow-dom/slot-with-continuation-descendants.html

        * style/RenderTreeUpdater.cpp:
        (WebCore::RenderTreeUpdater::updateElementRenderer):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (214231 => 214232)


--- trunk/LayoutTests/ChangeLog	2017-03-21 21:25:47 UTC (rev 214231)
+++ trunk/LayoutTests/ChangeLog	2017-03-21 21:39:01 UTC (rev 214232)
@@ -1,3 +1,14 @@
+2017-03-21  Zalan Bujtas  <za...@apple.com>
+
+        Tear down descendant renderers when <slot>'s display value is set to no "contents".
+        https://bugs.webkit.org/show_bug.cgi?id=169921
+        <rdar://problem/30336417>
+
+        Reviewed by Antti Koivisto.
+
+        * fast/shadow-dom/slot-with-continuation-descendants-expected.txt: Added.
+        * fast/shadow-dom/slot-with-continuation-descendants.html: Added.
+
 2017-03-21  Carlos Alberto Lopez Perez  <clo...@igalia.com>
 
         [GTK][Wayland] Enable WebGL, 3D and compositing layout tests

Added: trunk/LayoutTests/fast/shadow-dom/slot-with-continuation-descendants-expected.txt (0 => 214232)


--- trunk/LayoutTests/fast/shadow-dom/slot-with-continuation-descendants-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/slot-with-continuation-descendants-expected.txt	2017-03-21 21:39:01 UTC (rev 214232)
@@ -0,0 +1,2 @@
+PASS if no crash
+or assert.

Added: trunk/LayoutTests/fast/shadow-dom/slot-with-continuation-descendants.html (0 => 214232)


--- trunk/LayoutTests/fast/shadow-dom/slot-with-continuation-descendants.html	                        (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/slot-with-continuation-descendants.html	2017-03-21 21:39:01 UTC (rev 214232)
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we can handle continuation when "display: contents" element becomes non-contents</title>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+</head>
+<body>
+<slot id=slot>PASS if no crash<span><div></div></span>or assert.</slot>
+<script>
+document.body.offsetHeight;
+slot.style.display = "inline";
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (214231 => 214232)


--- trunk/Source/WebCore/ChangeLog	2017-03-21 21:25:47 UTC (rev 214231)
+++ trunk/Source/WebCore/ChangeLog	2017-03-21 21:39:01 UTC (rev 214232)
@@ -1,3 +1,21 @@
+2017-03-21  Zalan Bujtas  <za...@apple.com>
+
+        Tear down descendant renderers when <slot>'s display value is set to no "contents".
+        https://bugs.webkit.org/show_bug.cgi?id=169921
+        <rdar://problem/30336417>
+
+        Reviewed by Antti Koivisto.
+
+        Since "display: contents" does not generate a renderer, when an element's display value is
+        changed to something other than "contents", we not only create a renderer but also reparent its descendant
+        subtree (e.g from slot's parent to the newly constructed slot renderer). During this reparenting, we
+        need to tear down the descendant subtree tree and build it up again to reflect the new rendering context.
+
+        Test: fast/shadow-dom/slot-with-continuation-descendants.html
+
+        * style/RenderTreeUpdater.cpp:
+        (WebCore::RenderTreeUpdater::updateElementRenderer):
+
 2017-03-19  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Teach TextIndicator to estimate the background color of the given Range

Modified: trunk/Source/WebCore/style/RenderTreeUpdater.cpp (214231 => 214232)


--- trunk/Source/WebCore/style/RenderTreeUpdater.cpp	2017-03-21 21:25:47 UTC (rev 214231)
+++ trunk/Source/WebCore/style/RenderTreeUpdater.cpp	2017-03-21 21:39:01 UTC (rev 214232)
@@ -257,7 +257,8 @@
     CheckForVisibilityChange checkForVisibilityChange(element);
 #endif
 
-    bool shouldTearDownRenderers = update.change == Style::Detach && (element.renderer() || element.isNamedFlowContentElement());
+    bool shouldTearDownRenderers = update.change == Style::Detach
+        && (element.renderer() || element.isNamedFlowContentElement() || element.hasDisplayContents());
     if (shouldTearDownRenderers)
         tearDownRenderers(element, TeardownType::KeepHoverAndActive);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to