Title: [259611] trunk/Source/WebCore
Revision
259611
Author
[email protected]
Date
2020-04-06 16:34:51 -0700 (Mon, 06 Apr 2020)

Log Message

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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (259610 => 259611)


--- trunk/Source/WebCore/ChangeLog	2020-04-06 23:25:58 UTC (rev 259610)
+++ trunk/Source/WebCore/ChangeLog	2020-04-06 23:34:51 UTC (rev 259611)
@@ -1,3 +1,23 @@
+2020-04-06  Zalan Bujtas  <[email protected]>
+
+        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:
+
 2020-04-06  Ross Kirsling  <[email protected]>
 
         Update minimum ICU version to 60.2

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (259610 => 259611)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2020-04-06 23:25:58 UTC (rev 259610)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2020-04-06 23:34:51 UTC (rev 259611)
@@ -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();
 

Modified: trunk/Source/WebCore/rendering/RenderText.cpp (259610 => 259611)


--- trunk/Source/WebCore/rendering/RenderText.cpp	2020-04-06 23:25:58 UTC (rev 259610)
+++ trunk/Source/WebCore/rendering/RenderText.cpp	2020-04-06 23:34:51 UTC (rev 259611)
@@ -280,7 +280,7 @@
     else
         m_lineBoxes.invalidateParentChildLists();
 #endif
-    m_lineBoxes.deleteAll();
+    deleteLineBoxes();
 }
 
 void RenderText::willBeDestroyed()
@@ -1298,12 +1298,17 @@
 void RenderText::dirtyLineBoxes(bool fullLayout)
 {
     if (fullLayout)
-        m_lineBoxes.deleteAll();
+        deleteLineBoxes();
     else if (!m_linesDirty)
         m_lineBoxes.dirtyAll();
     m_linesDirty = false;
 }
 
+void RenderText::deleteLineBoxes()
+{
+    m_lineBoxes.deleteAll();
+}
+
 std::unique_ptr<InlineTextBox> RenderText::createTextBox()
 {
     return makeUnique<InlineTextBox>(*this);

Modified: trunk/Source/WebCore/rendering/RenderText.h (259610 => 259611)


--- trunk/Source/WebCore/rendering/RenderText.h	2020-04-06 23:25:58 UTC (rev 259610)
+++ trunk/Source/WebCore/rendering/RenderText.h	2020-04-06 23:34:51 UTC (rev 259611)
@@ -71,6 +71,7 @@
 
     InlineTextBox* createInlineTextBox() { return m_lineBoxes.createAndAppendLineBox(*this); }
     void dirtyLineBoxes(bool fullLayout);
+    void deleteLineBoxes();
 
     void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) const final;
     Vector<IntRect> absoluteRectsForRange(unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false, bool* wasFixed = nullptr) const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to