Title: [294779] trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp
Revision
294779
Author
[email protected]
Date
2022-05-24 17:06:14 -0700 (Tue, 24 May 2022)

Log Message

Remove floating objects during tree normalization after style changes
https://bugs.webkit.org/show_bug.cgi?id=240797

Reviewed by Darin Adler.

Float boxes define their own block formatting context and thus can't have other intruding
floats. That's why this scenario is not allowed in the code, except in the case when
a regular box with floatting descendants becomes float. In that case the tree might
be temporarily in a semi-correct state until we don't remove the intruding floats.

The current code deals with that by calling rebuildFloatingObjectSetFromIntrudingFloats()
in the subsequent layout. However it's possible that before that a style change kicks in and
mutates the render tree. In that case we could be manipulating stale objects. To prevent
that we can simply directly call removeFloatingObjects() when normalizing the tree after
a style change.

* Source/WebCore/rendering/updating/RenderTreeBuilder.cpp:
(WebCore::RenderTreeBuilder::normalizeTreeAfterStyleChange): Call removeFloatingObjects().

Canonical link: https://commits.webkit.org/250941@main

Modified Paths

Diff

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp (294778 => 294779)


--- trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2022-05-25 00:04:59 UTC (rev 294778)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp	2022-05-25 00:06:14 UTC (rev 294779)
@@ -673,6 +673,7 @@
                 }
             };
             clearDescendantFloats();
+            downcast<RenderBlockFlow>(renderer).removeFloatingObjects();
             // Fresh floats need to be reparented if they actually belong to the previous anonymous block.
             // It copies the logic of RenderBlock::addChildIgnoringContinuation
             if (renderer.previousSibling() && renderer.previousSibling()->isAnonymousBlock())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to