Title: [274035] trunk
Revision
274035
Author
[email protected]
Date
2021-03-06 04:59:04 -0800 (Sat, 06 Mar 2021)

Log Message

[RenderTreeBuilder] Readjust the first child when it is the multicolumn container
https://bugs.webkit.org/show_bug.cgi?id=222851
<rdar://problem/73392642>

Reviewed by Simon Fraser.

Source/WebCore:

When a newly constructed renderer is supposed to be first child of its soon-to-be parent but
the parent establishes a multicolumn context (so its first child is a RenderMultiColumnFlow) this
renderer should be attached under the column container instead.

Test: fast/multicol/readjust-first-child-on-attach.html

* rendering/updating/RenderTreeBuilderBlockFlow.cpp:
(WebCore::RenderTreeBuilder::BlockFlow::attach):

LayoutTests:

* fast/multicol/readjust-first-child-on-attach-expected.txt: Added.
* fast/multicol/readjust-first-child-on-attach.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (274034 => 274035)


--- trunk/LayoutTests/ChangeLog	2021-03-06 12:53:32 UTC (rev 274034)
+++ trunk/LayoutTests/ChangeLog	2021-03-06 12:59:04 UTC (rev 274035)
@@ -1,3 +1,14 @@
+2021-03-06  Zalan Bujtas  <[email protected]>
+
+        [RenderTreeBuilder] Readjust the first child when it is the multicolumn container
+        https://bugs.webkit.org/show_bug.cgi?id=222851
+        <rdar://problem/73392642>
+
+        Reviewed by Simon Fraser.
+
+        * fast/multicol/readjust-first-child-on-attach-expected.txt: Added.
+        * fast/multicol/readjust-first-child-on-attach.html: Added.
+
 2021-03-06  Tim Horton  <[email protected]>
 
         <model> should create a model-owning compositing layer

Added: trunk/LayoutTests/fast/multicol/readjust-first-child-on-attach-expected.txt (0 => 274035)


--- trunk/LayoutTests/fast/multicol/readjust-first-child-on-attach-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/readjust-first-child-on-attach-expected.txt	2021-03-06 12:59:04 UTC (rev 274035)
@@ -0,0 +1 @@
+PASS if no crash or assert.

Added: trunk/LayoutTests/fast/multicol/readjust-first-child-on-attach.html (0 => 274035)


--- trunk/LayoutTests/fast/multicol/readjust-first-child-on-attach.html	                        (rev 0)
+++ trunk/LayoutTests/fast/multicol/readjust-first-child-on-attach.html	2021-03-06 12:59:04 UTC (rev 274035)
@@ -0,0 +1,20 @@
+<style>
+  ruby {
+    columns: 1px;
+    -webkit-appearance: media-play-button;
+  }
+  ruby::before {
+    display: block;
+    content: url();
+  }
+</style>
+<script>
+  if (window.testRunner)
+    testRunner.dumpAsText();
+  _onload_ = () => {
+    document.styleSheets[0].insertRule(`ruby {}`);
+  };
+</script>
+<body>
+<ruby>PASS if no crash or assert.</ruby>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (274034 => 274035)


--- trunk/Source/WebCore/ChangeLog	2021-03-06 12:53:32 UTC (rev 274034)
+++ trunk/Source/WebCore/ChangeLog	2021-03-06 12:59:04 UTC (rev 274035)
@@ -1,3 +1,20 @@
+2021-03-06  Zalan Bujtas  <[email protected]>
+
+        [RenderTreeBuilder] Readjust the first child when it is the multicolumn container
+        https://bugs.webkit.org/show_bug.cgi?id=222851
+        <rdar://problem/73392642>
+
+        Reviewed by Simon Fraser.
+
+        When a newly constructed renderer is supposed to be first child of its soon-to-be parent but
+        the parent establishes a multicolumn context (so its first child is a RenderMultiColumnFlow) this
+        renderer should be attached under the column container instead.
+
+        Test: fast/multicol/readjust-first-child-on-attach.html
+
+        * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
+        (WebCore::RenderTreeBuilder::BlockFlow::attach):
+
 2021-03-06  Dean Jackson  <[email protected]>
 
         dlopen_preflight is failing (temporarily) but obsolete

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlockFlow.cpp (274034 => 274035)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlockFlow.cpp	2021-03-06 12:53:32 UTC (rev 274034)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlockFlow.cpp	2021-03-06 12:59:04 UTC (rev 274035)
@@ -39,7 +39,7 @@
 
 void RenderTreeBuilder::BlockFlow::attach(RenderBlockFlow& parent, RenderPtr<RenderObject> child, RenderObject* beforeChild)
 {
-    if (parent.multiColumnFlow()) {
+    if (auto* multicolumnFlow = parent.multiColumnFlow()) {
         auto legendAvoidsMulticolumn = parent.isFieldset() && child->isLegend();
         if (legendAvoidsMulticolumn)
             return m_builder.blockBuilder().attach(parent, WTFMove(child), nullptr);
@@ -46,9 +46,11 @@
 
         auto legendBeforeChildIsIncorrect = parent.isFieldset() && beforeChild && beforeChild->isLegend();
         if (legendBeforeChildIsIncorrect)
-            return m_builder.blockBuilder().attach(*parent.multiColumnFlow(), WTFMove(child), nullptr);
+            return m_builder.blockBuilder().attach(*multicolumnFlow, WTFMove(child), nullptr);
 
-        return m_builder.attach(*parent.multiColumnFlow(), WTFMove(child), beforeChild);
+        // When the before child is set to be the first child of the RenderBlockFlow, we need to readjust it to be the first
+        // child of the multicol conainter.
+        return m_builder.attach(*multicolumnFlow, WTFMove(child), beforeChild == multicolumnFlow ? multicolumnFlow->firstChild() : beforeChild);
     }
 
     auto* beforeChildOrPlaceholder = beforeChild;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to