Changeset 229474 in webkit


Ignore:
Timestamp:
Mar 9, 2018, 11:14:23 AM (7 years ago)
Author:
Alan Bujtas
Message:

RenderTreeBuilder::splitAnonymousBoxesAroundChild should take multicolumn spanners into account.
https://bugs.webkit.org/show_bug.cgi?id=183493
<rdar://problem/38030461>

Reviewed by Antti Koivisto.

Source/WebCore:

Multicolumn spanners are taken out of their original position and placed next
to a RenderMultiColumnSet. splitAnonymousBoxesAroundChild needs to know the original parent (in the render tree context).

Test: fast/multicol/adjust-beforeChild-for-spanner-crash.html

  • rendering/updating/RenderTreeBuilder.cpp:

(WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild):

  • rendering/updating/RenderTreeBuilder.h:
  • rendering/updating/RenderTreeBuilderBlock.cpp:

(WebCore::RenderTreeBuilder::Block::attachIgnoringContinuation):

  • rendering/updating/RenderTreeBuilderMultiColumn.cpp:

(WebCore::RenderTreeBuilder::MultiColumn::adjustBeforeChildForMultiColumnSpannerIfNeeded):

  • rendering/updating/RenderTreeBuilderMultiColumn.h:
  • rendering/updating/RenderTreeBuilderRuby.cpp:

(WebCore::RenderTreeBuilder::Ruby::moveChildrenInternal):

  • rendering/updating/RenderTreeBuilderTable.cpp:

(WebCore::RenderTreeBuilder::Table::attach):

LayoutTests:

  • fast/multicol/adjust-beforeChild-for-spanner-crash-expected.txt: Added.
  • fast/multicol/adjust-beforeChild-for-spanner-crash.html: Added.
Location:
trunk
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r229469 r229474  
     12018-03-09  Zalan Bujtas  <zalan@apple.com>
     2
     3        RenderTreeBuilder::splitAnonymousBoxesAroundChild should take multicolumn spanners into account.
     4        https://bugs.webkit.org/show_bug.cgi?id=183493
     5        <rdar://problem/38030461>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        * fast/multicol/adjust-beforeChild-for-spanner-crash-expected.txt: Added.
     10        * fast/multicol/adjust-beforeChild-for-spanner-crash.html: Added.
     11
    1122018-03-09  Basuke Suzuki  <Basuke.Suzuki@sony.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r229472 r229474  
     12018-03-09  Zalan Bujtas  <zalan@apple.com>
     2
     3        RenderTreeBuilder::splitAnonymousBoxesAroundChild should take multicolumn spanners into account.
     4        https://bugs.webkit.org/show_bug.cgi?id=183493
     5        <rdar://problem/38030461>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        Multicolumn spanners are taken out of their original position and placed next
     10        to a RenderMultiColumnSet. splitAnonymousBoxesAroundChild needs to know the original parent (in the render tree context).
     11
     12        Test: fast/multicol/adjust-beforeChild-for-spanner-crash.html
     13
     14        * rendering/updating/RenderTreeBuilder.cpp:
     15        (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild):
     16        * rendering/updating/RenderTreeBuilder.h:
     17        * rendering/updating/RenderTreeBuilderBlock.cpp:
     18        (WebCore::RenderTreeBuilder::Block::attachIgnoringContinuation):
     19        * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
     20        (WebCore::RenderTreeBuilder::MultiColumn::adjustBeforeChildForMultiColumnSpannerIfNeeded):
     21        * rendering/updating/RenderTreeBuilderMultiColumn.h:
     22        * rendering/updating/RenderTreeBuilderRuby.cpp:
     23        (WebCore::RenderTreeBuilder::Ruby::moveChildrenInternal):
     24        * rendering/updating/RenderTreeBuilderTable.cpp:
     25        (WebCore::RenderTreeBuilder::Table::attach):
     26
    1272018-03-09  Jer Noble  <jer.noble@apple.com>
    228
  • trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp

    r229200 r229474  
    3838#include "RenderMathMLFenced.h"
    3939#include "RenderMenuList.h"
     40#include "RenderMultiColumnFlow.h"
    4041#include "RenderRuby.h"
    4142#include "RenderRubyBase.h"
     
    600601}
    601602
    602 RenderObject* RenderTreeBuilder::splitAnonymousBoxesAroundChild(RenderBox& parent, RenderObject* beforeChild)
    603 {
     603RenderObject* RenderTreeBuilder::splitAnonymousBoxesAroundChild(RenderBox& parent, RenderObject& originalBeforeChild)
     604{
     605    // Adjust beforeChild if it is a column spanner and has been moved out of its original position.
     606    auto* beforeChild = RenderTreeBuilder::MultiColumn::adjustBeforeChildForMultiColumnSpannerIfNeeded(originalBeforeChild);
    604607    bool didSplitParentAnonymousBoxes = false;
    605608
  • trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.h

    r229200 r229474  
    8181    void moveAllChildren(RenderBoxModelObject& from, RenderBoxModelObject& to, RenderObject* beforeChild, NormalizeAfterInsertion);
    8282
    83     RenderObject* splitAnonymousBoxesAroundChild(RenderBox& parent, RenderObject* beforeChild);
     83    RenderObject* splitAnonymousBoxesAroundChild(RenderBox& parent, RenderObject& originalBeforeChild);
    8484    void makeChildrenNonInline(RenderBlock& parent, RenderObject* insertionPoint = nullptr);
    8585    void removeAnonymousWrappersForInlineChildrenIfNeeded(RenderElement& parent);
  • trunk/Source/WebCore/rendering/updating/RenderTreeBuilderBlock.cpp

    r228938 r229474  
    194194            }
    195195
    196             beforeChild = m_builder.splitAnonymousBoxesAroundChild(parent, beforeChild);
     196            beforeChild = m_builder.splitAnonymousBoxesAroundChild(parent, *beforeChild);
    197197
    198198            RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(beforeChild->parent() == &parent);
  • trunk/Source/WebCore/rendering/updating/RenderTreeBuilderMultiColumn.cpp

    r228938 r229474  
    408408}
    409409
    410 }
     410RenderObject* RenderTreeBuilder::MultiColumn::adjustBeforeChildForMultiColumnSpannerIfNeeded(RenderObject& beforeChild)
     411{
     412    if (!is<RenderBox>(beforeChild))
     413        return &beforeChild;
     414
     415    auto* nextSibling = beforeChild.nextSibling();
     416    if (!nextSibling)
     417        return &beforeChild;
     418
     419    if (!is<RenderMultiColumnSet>(*nextSibling))
     420        return &beforeChild;
     421
     422    auto* multiColumnFlow = downcast<RenderMultiColumnSet>(*nextSibling).multiColumnFlow();
     423    if (!multiColumnFlow)
     424        return &beforeChild;
     425
     426    return multiColumnFlow->findColumnSpannerPlaceholder(downcast<RenderBox>(&beforeChild));
     427}
     428
     429}
  • trunk/Source/WebCore/rendering/updating/RenderTreeBuilderMultiColumn.h

    r228954 r229474  
    4444    void multiColumnDescendantInserted(RenderMultiColumnFlow&, RenderObject& newDescendant);
    4545    void multiColumnRelativeWillBeRemoved(RenderMultiColumnFlow&, RenderObject& relative);
     46    static RenderObject* adjustBeforeChildForMultiColumnSpannerIfNeeded(RenderObject& beforeChild);
    4647
    4748private:
  • trunk/Source/WebCore/rendering/updating/RenderTreeBuilderRuby.cpp

    r228938 r229474  
    184184    // and appends them to toBase.
    185185    if (beforeChild && beforeChild->parent() != &from)
    186         beforeChild = m_builder.splitAnonymousBoxesAroundChild(from, beforeChild);
     186        beforeChild = m_builder.splitAnonymousBoxesAroundChild(from, *beforeChild);
    187187
    188188    if (from.childrenInline())
  • trunk/Source/WebCore/rendering/updating/RenderTreeBuilderTable.cpp

    r228938 r229474  
    165165{
    166166    if (beforeChild && beforeChild->parent() != &parent)
    167         beforeChild = m_builder.splitAnonymousBoxesAroundChild(parent, beforeChild);
     167        beforeChild = m_builder.splitAnonymousBoxesAroundChild(parent, *beforeChild);
    168168
    169169    auto& newChild = *child.get();
     
    178178{
    179179    if (beforeChild && beforeChild->parent() != &parent)
    180         beforeChild = m_builder.splitAnonymousBoxesAroundChild(parent, beforeChild);
     180        beforeChild = m_builder.splitAnonymousBoxesAroundChild(parent, *beforeChild);
    181181
    182182    // FIXME: child should always be a RenderTableRow at this point.
     
    190190{
    191191    if (beforeChild && beforeChild->parent() != &parent)
    192         beforeChild = m_builder.splitAnonymousBoxesAroundChild(parent, beforeChild);
     192        beforeChild = m_builder.splitAnonymousBoxesAroundChild(parent, *beforeChild);
    193193
    194194    auto& newChild = *child.get();
Note: See TracChangeset for help on using the changeset viewer.