Delete line boxes when moving text renderers between block flows
https://bugs.webkit.org/show_bug.cgi?id=210000
Reviewed by Antti Koivisto.
After style and/or tree mutation the existing line boxes are destroyed during the subsequent layout.
When the text renderer moves between block flows and the destination block flow initiates a different
type of line layout, we need to make sure the previous line content is cleaned up properly.
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutSimpleLines):
(WebCore::RenderBlockFlow::layoutLFCLines):
* rendering/RenderText.cpp:
(WebCore::RenderText::removeAndDestroyTextBoxes):
(WebCore::RenderText::dirtyLineBoxes):
(WebCore::RenderText::deleteLineBoxes):
* rendering/RenderText.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@259611 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/rendering/RenderBlockFlow.cpp b/Source/WebCore/rendering/RenderBlockFlow.cpp
index 55bb80b..d09b1c8 100644
--- a/Source/WebCore/rendering/RenderBlockFlow.cpp
+++ b/Source/WebCore/rendering/RenderBlockFlow.cpp
@@ -3715,8 +3715,11 @@
SimpleLineLayout::adjustLinePositionsForPagination(simpleLineLayout, *this);
}
- for (auto& renderer : childrenOfType<RenderObject>(*this))
+ for (auto& renderer : childrenOfType<RenderObject>(*this)) {
+ if (is<RenderText>(renderer))
+ downcast<RenderText>(renderer).deleteLineBoxes();
renderer.clearNeedsLayout();
+ }
LayoutUnit lineLayoutHeight = SimpleLineLayout::computeFlowHeight(*this, simpleLineLayout);
LayoutUnit lineLayoutTop = borderAndPaddingBefore();
@@ -3733,8 +3736,11 @@
auto& layoutFormattingContextLineLayout = *this->layoutFormattingContextLineLayout();
- for (auto& renderer : childrenOfType<RenderObject>(*this))
+ for (auto& renderer : childrenOfType<RenderObject>(*this)) {
+ if (is<RenderText>(renderer))
+ downcast<RenderText>(renderer).deleteLineBoxes();
renderer.clearNeedsLayout();
+ }
layoutFormattingContextLineLayout.layout();