Title: [261512] branches/safari-609-branch/Source/WebCore
Revision
261512
Author
[email protected]
Date
2020-05-11 17:21:30 -0700 (Mon, 11 May 2020)

Log Message

Cherry-pick r259611. rdar://problem/62978871

    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: https://svn.webkit.org/repository/webkit/trunk@259611 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-609-branch/Source/WebCore/ChangeLog (261511 => 261512)


--- branches/safari-609-branch/Source/WebCore/ChangeLog	2020-05-12 00:21:27 UTC (rev 261511)
+++ branches/safari-609-branch/Source/WebCore/ChangeLog	2020-05-12 00:21:30 UTC (rev 261512)
@@ -1,5 +1,49 @@
 2020-05-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r259611. rdar://problem/62978871
+
+    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: https://svn.webkit.org/repository/webkit/trunk@259611 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-05-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r259525. rdar://problem/62978878
 
     Protect contentFrame in SubframeLoader::loadOrRedirectSubframe with RefPtr.

Modified: branches/safari-609-branch/Source/WebCore/rendering/RenderBlockFlow.cpp (261511 => 261512)


--- branches/safari-609-branch/Source/WebCore/rendering/RenderBlockFlow.cpp	2020-05-12 00:21:27 UTC (rev 261511)
+++ branches/safari-609-branch/Source/WebCore/rendering/RenderBlockFlow.cpp	2020-05-12 00:21:30 UTC (rev 261512)
@@ -3681,8 +3681,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();
@@ -3699,8 +3702,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: branches/safari-609-branch/Source/WebCore/rendering/RenderText.cpp (261511 => 261512)


--- branches/safari-609-branch/Source/WebCore/rendering/RenderText.cpp	2020-05-12 00:21:27 UTC (rev 261511)
+++ branches/safari-609-branch/Source/WebCore/rendering/RenderText.cpp	2020-05-12 00:21:30 UTC (rev 261512)
@@ -290,7 +290,7 @@
     else
         m_lineBoxes.invalidateParentChildLists();
 #endif
-    m_lineBoxes.deleteAll();
+    deleteLineBoxes();
 }
 
 void RenderText::willBeDestroyed()
@@ -1297,12 +1297,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: branches/safari-609-branch/Source/WebCore/rendering/RenderText.h (261511 => 261512)


--- branches/safari-609-branch/Source/WebCore/rendering/RenderText.h	2020-05-12 00:21:27 UTC (rev 261511)
+++ branches/safari-609-branch/Source/WebCore/rendering/RenderText.h	2020-05-12 00:21:30 UTC (rev 261512)
@@ -67,6 +67,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