⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 259611 in webkit


Ignore:
Timestamp:
Apr 6, 2020, 4:34:51 PM (6 years ago)
Author:
Alan Bujtas
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:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r259606 r259611  
     12020-04-06  Zalan Bujtas  <zalan@apple.com>
     2
     3        Delete line boxes when moving text renderers between block flows
     4        https://bugs.webkit.org/show_bug.cgi?id=210000
     5
     6        Reviewed by Antti Koivisto.
     7
     8        After style and/or tree mutation the existing line boxes are destroyed during the subsequent layout.
     9        When the text renderer moves between block flows and the destination block flow initiates a different
     10        type of line layout, we need to make sure the previous line content is cleaned up properly.
     11
     12        * rendering/RenderBlockFlow.cpp:
     13        (WebCore::RenderBlockFlow::layoutSimpleLines):
     14        (WebCore::RenderBlockFlow::layoutLFCLines):
     15        * rendering/RenderText.cpp:
     16        (WebCore::RenderText::removeAndDestroyTextBoxes):
     17        (WebCore::RenderText::dirtyLineBoxes):
     18        (WebCore::RenderText::deleteLineBoxes):
     19        * rendering/RenderText.h:
     20
    1212020-04-06  Ross Kirsling  <ross.kirsling@sony.com>
    222
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r259455 r259611  
    37163716    }
    37173717
    3718     for (auto& renderer : childrenOfType<RenderObject>(*this))
     3718    for (auto& renderer : childrenOfType<RenderObject>(*this)) {
     3719        if (is<RenderText>(renderer))
     3720            downcast<RenderText>(renderer).deleteLineBoxes();
    37193721        renderer.clearNeedsLayout();
     3722    }
    37203723
    37213724    LayoutUnit lineLayoutHeight = SimpleLineLayout::computeFlowHeight(*this, simpleLineLayout);
     
    37343737    auto& layoutFormattingContextLineLayout = *this->layoutFormattingContextLineLayout();
    37353738
    3736     for (auto& renderer : childrenOfType<RenderObject>(*this))
     3739    for (auto& renderer : childrenOfType<RenderObject>(*this)) {
     3740        if (is<RenderText>(renderer))
     3741            downcast<RenderText>(renderer).deleteLineBoxes();
    37373742        renderer.clearNeedsLayout();
     3743    }
    37383744
    37393745    layoutFormattingContextLineLayout.layout();
  • trunk/Source/WebCore/rendering/RenderText.cpp

    r257899 r259611  
    281281        m_lineBoxes.invalidateParentChildLists();
    282282#endif
    283     m_lineBoxes.deleteAll();
     283    deleteLineBoxes();
    284284}
    285285
     
    12991299{
    13001300    if (fullLayout)
    1301         m_lineBoxes.deleteAll();
     1301        deleteLineBoxes();
    13021302    else if (!m_linesDirty)
    13031303        m_lineBoxes.dirtyAll();
    13041304    m_linesDirty = false;
     1305}
     1306
     1307void RenderText::deleteLineBoxes()
     1308{
     1309    m_lineBoxes.deleteAll();
    13051310}
    13061311
  • trunk/Source/WebCore/rendering/RenderText.h

    r256196 r259611  
    7272    InlineTextBox* createInlineTextBox() { return m_lineBoxes.createAndAppendLineBox(*this); }
    7373    void dirtyLineBoxes(bool fullLayout);
     74    void deleteLineBoxes();
    7475
    7576    void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) const final;
Note: See TracChangeset for help on using the changeset viewer.