Title: [271356] trunk/Source/WebCore
Revision
271356
Author
[email protected]
Date
2021-01-11 03:15:28 -0800 (Mon, 11 Jan 2021)

Log Message

[css-multicol] Update fragment flow state on element insertion when element position changes
https://bugs.webkit.org/show_bug.cgi?id=202805

Reviewed by Zalan Bujtas.

Let's imagine the following scenario:

<div1 style="columns: 2">
  <div2 style="columns:2; position: absolute">
    <div3 style="column-span:all">

The generated render tree is more or less the following:

DIV
|__RenderMultiColumnFlow
   |__DIV
      |__RenderMultiColumnFlow
      |  |__RenderMultiColumnSpannerPlaceholder
      |__DIV
      |__RenderMultiColumnSet

both <div1> and <div2> generate RenderMultiColumnFlows because they're multicolumn containers while the <div3> becomes a spanner and leaves
a placeholder in the place where it's supposed to be as it's a "column-span:all". Note that <div2> is absolutely positioned so it isn't really
part of the column flow of <div1> (there is no RenderMultiColumnSet for <div1>). Now if the <div2> becomes a statically positioned container
(i.e. style="position:static") then it should be inserted (actually its whole subtree) in the <div1> multicolumn flow.

That insertion implies doing 2 things, first notify the RenderMultiColumnFlow of <div1> that a new child was inserted and secondly update the
flow state of the subtree which starts in <div2> so they acknowledge <div1> as their enclosing fragment flow. The former was properly done.
However the latter was not done at all, meaning that they would be treated as not belonging to any multicolumn flow when they actually did.

* rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::childFlowStateChangesAndAffectsParentBlock): call initializeFragmentedFlowStateOnInsertion().

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (271355 => 271356)


--- trunk/Source/WebCore/ChangeLog	2021-01-11 10:31:00 UTC (rev 271355)
+++ trunk/Source/WebCore/ChangeLog	2021-01-11 11:15:28 UTC (rev 271356)
@@ -1,3 +1,38 @@
+2020-12-04  Sergio Villar Senin  <[email protected]>
+
+        [css-multicol] Update fragment flow state on element insertion when element position changes
+        https://bugs.webkit.org/show_bug.cgi?id=202805
+
+        Reviewed by Zalan Bujtas.
+
+        Let's imagine the following scenario:
+
+        <div1 style="columns: 2">
+          <div2 style="columns:2; position: absolute">
+            <div3 style="column-span:all">
+
+        The generated render tree is more or less the following:
+
+        DIV
+        |__RenderMultiColumnFlow
+           |__DIV
+              |__RenderMultiColumnFlow
+              |  |__RenderMultiColumnSpannerPlaceholder
+              |__DIV
+              |__RenderMultiColumnSet
+
+        both <div1> and <div2> generate RenderMultiColumnFlows because they're multicolumn containers while the <div3> becomes a spanner and leaves
+        a placeholder in the place where it's supposed to be as it's a "column-span:all". Note that <div2> is absolutely positioned so it isn't really
+        part of the column flow of <div1> (there is no RenderMultiColumnSet for <div1>). Now if the <div2> becomes a statically positioned container
+        (i.e. style="position:static") then it should be inserted (actually its whole subtree) in the <div1> multicolumn flow.
+
+        That insertion implies doing 2 things, first notify the RenderMultiColumnFlow of <div1> that a new child was inserted and secondly update the
+        flow state of the subtree which starts in <div2> so they acknowledge <div1> as their enclosing fragment flow. The former was properly done.
+        However the latter was not done at all, meaning that they would be treated as not belonging to any multicolumn flow when they actually did.
+
+        * rendering/updating/RenderTreeBuilder.cpp:
+        (WebCore::RenderTreeBuilder::childFlowStateChangesAndAffectsParentBlock): call initializeFragmentedFlowStateOnInsertion().
+
 2021-01-11  Xabier Rodriguez Calvar  <[email protected]>
 
         [GStreamer] Add support to build with native audio and video

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (271355 => 271356)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2021-01-11 10:31:00 UTC (rev 271355)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2021-01-11 11:15:28 UTC (rev 271356)
@@ -705,6 +705,7 @@
             if (auto* newEnclosingFragmentedFlow = newParent->enclosingFragmentedFlow(); is<RenderMultiColumnFlow>(newEnclosingFragmentedFlow) && currentEnclosingFragment != newEnclosingFragmentedFlow) {
                 // Let the fragmented flow know that it has a new in-flow descendant.
                 multiColumnBuilder().multiColumnDescendantInserted(downcast<RenderMultiColumnFlow>(*newEnclosingFragmentedFlow), child);
+                child.initializeFragmentedFlowStateOnInsertion();
             }
         }
     } else {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to