Title: [276872] trunk
Revision
276872
Author
za...@apple.com
Date
2021-05-01 05:54:29 -0700 (Sat, 01 May 2021)

Log Message

[RenderTreeBuilder] Reset the "children inline" state when merging anonymous table boxes
https://bugs.webkit.org/show_bug.cgi?id=225266
<rdar://77327951>

Reviewed by Simon Fraser.

Source/WebCore:

This patch fixes the case when we end up moving block level boxes to an anonymous table box (cell, row) which previously
had inline level boxes only (it happens when the destination ("to") table box has no in-flow children).

Test: fast/table/merge-anonymous-table-cells-with-block-children.html

* rendering/updating/RenderTreeBuilderTable.cpp:
(WebCore::RenderTreeBuilder::Table::collapseAndDetachAnonymousNextSibling):

LayoutTests:

* fast/table/merge-anonymous-table-cells-with-block-children-expected.txt: Added.
* fast/table/merge-anonymous-table-cells-with-block-children.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (276871 => 276872)


--- trunk/LayoutTests/ChangeLog	2021-05-01 03:26:53 UTC (rev 276871)
+++ trunk/LayoutTests/ChangeLog	2021-05-01 12:54:29 UTC (rev 276872)
@@ -1,3 +1,14 @@
+2021-05-01  Zalan Bujtas  <za...@apple.com>
+
+        [RenderTreeBuilder] Reset the "children inline" state when merging anonymous table boxes
+        https://bugs.webkit.org/show_bug.cgi?id=225266
+        <rdar://77327951>
+
+        Reviewed by Simon Fraser.
+
+        * fast/table/merge-anonymous-table-cells-with-block-children-expected.txt: Added.
+        * fast/table/merge-anonymous-table-cells-with-block-children.html: Added.
+
 2021-04-30  Wenson Hsieh  <wenson_hs...@apple.com>
 
         App highlight UI should be disabled when selecting text in image overlays

Added: trunk/LayoutTests/fast/table/merge-anonymous-table-cells-with-block-children-expected.txt (0 => 276872)


--- trunk/LayoutTests/fast/table/merge-anonymous-table-cells-with-block-children-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/table/merge-anonymous-table-cells-with-block-children-expected.txt	2021-05-01 12:54:29 UTC (rev 276872)
@@ -0,0 +1 @@
+

Added: trunk/LayoutTests/fast/table/merge-anonymous-table-cells-with-block-children.html (0 => 276872)


--- trunk/LayoutTests/fast/table/merge-anonymous-table-cells-with-block-children.html	                        (rev 0)
+++ trunk/LayoutTests/fast/table/merge-anonymous-table-cells-with-block-children.html	2021-05-01 12:54:29 UTC (rev 276872)
@@ -0,0 +1,20 @@
+<style>
+  :not(:first-child)::after {
+    content: 'a';
+  }
+</style>
+<!-- PASS if no crash or assert. -->
+<script>
+  if (window.testRunner)
+    testRunner.dumpAsText();
+  _onload_ = () => {
+    document.body.appendChild(document.createElement('div'));
+    let n0 = document.createElement('tr');
+    document.body.appendChild(n0);
+    n0.appendChild(document.createElement('tr'));
+    document.body.offsetTop;
+    n0.appendChild(document.createElement('td'));
+    document.body.offsetTop;
+    document.styleSheets[0].insertRule(`:empty { position: absolute; }`);
+  };
+</script>

Modified: trunk/Source/WebCore/ChangeLog (276871 => 276872)


--- trunk/Source/WebCore/ChangeLog	2021-05-01 03:26:53 UTC (rev 276871)
+++ trunk/Source/WebCore/ChangeLog	2021-05-01 12:54:29 UTC (rev 276872)
@@ -1,3 +1,19 @@
+2021-05-01  Zalan Bujtas  <za...@apple.com>
+
+        [RenderTreeBuilder] Reset the "children inline" state when merging anonymous table boxes
+        https://bugs.webkit.org/show_bug.cgi?id=225266
+        <rdar://77327951>
+
+        Reviewed by Simon Fraser.
+
+        This patch fixes the case when we end up moving block level boxes to an anonymous table box (cell, row) which previously
+        had inline level boxes only (it happens when the destination ("to") table box has no in-flow children).
+
+        Test: fast/table/merge-anonymous-table-cells-with-block-children.html
+
+        * rendering/updating/RenderTreeBuilderTable.cpp:
+        (WebCore::RenderTreeBuilder::Table::collapseAndDetachAnonymousNextSibling):
+
 2021-04-30  Wenson Hsieh  <wenson_hs...@apple.com>
 
         App highlight UI should be disabled when selecting text in image overlays

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderTable.cpp (276871 => 276872)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderTable.cpp	2021-05-01 03:26:53 UTC (rev 276871)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderTable.cpp	2021-05-01 12:54:29 UTC (rev 276872)
@@ -265,6 +265,7 @@
     if (!canCollapseNextSibling(*previousSibling, *nextSibling))
         return { };
     m_builder.moveAllChildren(*nextSibling, *previousSibling, RenderTreeBuilder::NormalizeAfterInsertion::No);
+    previousSibling->setChildrenInline(!previousSibling->firstInFlowChild() || previousSibling->firstInFlowChild()->isInline());
     return m_builder.detach(*parent, *nextSibling);
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to