Title: [268951] trunk
Revision
268951
Author
[email protected]
Date
2020-10-24 06:46:57 -0700 (Sat, 24 Oct 2020)

Log Message

[LFC][Integration] Replaced elements in newly created line layout should always be updated
https://bugs.webkit.org/show_bug.cgi?id=218150

Reviewed by Zalan Bujtas.

Source/WebCore:

Test: fast/inline/inline-with-img-dynamic.html

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutLFCLines):

We may need to recreate line layout while children still have valid style.
Ensure that replaced dimensions are still updated.

LayoutTests:

* fast/inline/inline-with-img-dynamic-expected.html: Added.
* fast/inline/inline-with-img-dynamic.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (268950 => 268951)


--- trunk/LayoutTests/ChangeLog	2020-10-24 13:22:44 UTC (rev 268950)
+++ trunk/LayoutTests/ChangeLog	2020-10-24 13:46:57 UTC (rev 268951)
@@ -1,3 +1,13 @@
+2020-10-24  Antti Koivisto  <[email protected]>
+
+        [LFC][Integration] Replaced elements in newly created line layout should always be updated
+        https://bugs.webkit.org/show_bug.cgi?id=218150
+
+        Reviewed by Zalan Bujtas.
+
+        * fast/inline/inline-with-img-dynamic-expected.html: Added.
+        * fast/inline/inline-with-img-dynamic.html: Added.
+
 2020-10-23  Simon Fraser  <[email protected]>
 
         REGRESSION (r260276): Unable to click on image and text link at the bottom of https://www.nytimes.com/ article

Added: trunk/LayoutTests/fast/inline/inline-with-img-dynamic-expected.html (0 => 268951)


--- trunk/LayoutTests/fast/inline/inline-with-img-dynamic-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/inline-with-img-dynamic-expected.html	2020-10-24 13:46:57 UTC (rev 268951)
@@ -0,0 +1 @@
+<div><img src=""

Added: trunk/LayoutTests/fast/inline/inline-with-img-dynamic.html (0 => 268951)


--- trunk/LayoutTests/fast/inline/inline-with-img-dynamic.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/inline-with-img-dynamic.html	2020-10-24 13:46:57 UTC (rev 268951)
@@ -0,0 +1,7 @@
+<div id=test><img _onload_="runTest()" src=""
+<script>
+async function runTest() {
+  await new Promise(requestAnimationFrame);
+  test.appendChild(document.createTextNode("text"));
+}
+</script>

Modified: trunk/Source/WebCore/ChangeLog (268950 => 268951)


--- trunk/Source/WebCore/ChangeLog	2020-10-24 13:22:44 UTC (rev 268950)
+++ trunk/Source/WebCore/ChangeLog	2020-10-24 13:46:57 UTC (rev 268951)
@@ -1,3 +1,18 @@
+2020-10-24  Antti Koivisto  <[email protected]>
+
+        [LFC][Integration] Replaced elements in newly created line layout should always be updated
+        https://bugs.webkit.org/show_bug.cgi?id=218150
+
+        Reviewed by Zalan Bujtas.
+
+        Test: fast/inline/inline-with-img-dynamic.html
+
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::layoutLFCLines):
+
+        We may need to recreate line layout while children still have valid style.
+        Ensure that replaced dimensions are still updated.
+
 2020-10-24  Zalan Bujtas  <[email protected]>
 
         [LFC][IFC] Negative margin start pulls the replaced box to logical left direction

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (268950 => 268951)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2020-10-24 13:22:44 UTC (rev 268950)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2020-10-24 13:46:57 UTC (rev 268951)
@@ -3655,17 +3655,23 @@
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
 void RenderBlockFlow::layoutLFCLines(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom)
 {
-    if (!layoutFormattingContextLineLayout())
+    bool needsUpdateReplacedDimensions = false;
+
+    if (!layoutFormattingContextLineLayout()) {
         m_lineLayout = makeUnique<LayoutIntegration::LineLayout>(*this);
+        needsUpdateReplacedDimensions = true;
+    }
 
     auto& layoutFormattingContextLineLayout = *this->layoutFormattingContextLineLayout();
 
     for (auto& renderer : childrenOfType<RenderObject>(*this)) {
-        if (!relayoutChildren && !renderer.needsLayout())
+        if (relayoutChildren)
+            renderer.setNeedsLayout(MarkOnlyThis);
+        if (!renderer.needsLayout() && !needsUpdateReplacedDimensions)
             continue;
+
         if (is<RenderReplaced>(renderer)) {
             auto& replaced = downcast<RenderReplaced>(renderer);
-            replaced.setNeedsLayout(MarkOnlyThis);
             replaced.layoutIfNeeded();
             layoutFormattingContextLineLayout.updateReplacedDimensions(replaced);
             continue;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to