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

Changeset 245158 in webkit


Ignore:
Timestamp:
May 9, 2019, 2:37:56 PM (7 years ago)
Author:
Alan Bujtas
Message:

Do not mix inline and block level boxes.
https://bugs.webkit.org/show_bug.cgi?id=197462
<rdar://problem/50369362>

Reviewed by Antti Koivisto.

Source/WebCore:

This patch tightens the remove-anonymous-wrappers logic by checking if the removal would
produce an inline-block sibling mix.
When a block level box is removed from the tree, we check if after the removal the anonymous sibling block
boxes are still needed or whether we can removed them as well (and have only inline level child boxes).
In addition to checking if the container is anonymous and is part of a continuation, we also need to check
if collapsing it (and by that moving its children one level up) would cause a inline-block box mix.

Test: fast/ruby/continuation-and-column-spanner-crash.html

  • rendering/updating/RenderTreeBuilder.cpp:

(WebCore::RenderTreeBuilder::removeAnonymousWrappersForInlineChildrenIfNeeded):

  • rendering/updating/RenderTreeBuilderContinuation.cpp:

(WebCore::RenderTreeBuilder::Continuation::cleanupOnDestroy):

LayoutTests:

  • fast/ruby/continuation-and-column-spanner-crash-expected.txt: Added.
  • fast/ruby/continuation-and-column-spanner-crash.html: Added.
Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r245157 r245158  
     12019-05-08  Zalan Bujtas  <zalan@apple.com>
     2
     3        Do not mix inline and block level boxes.
     4        https://bugs.webkit.org/show_bug.cgi?id=197462
     5        <rdar://problem/50369362>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        * fast/ruby/continuation-and-column-spanner-crash-expected.txt: Added.
     10        * fast/ruby/continuation-and-column-spanner-crash.html: Added.
     11
    1122019-05-09  Ryan Haddad  <ryanhaddad@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r245156 r245158  
     12019-05-09  Zalan Bujtas  <zalan@apple.com>
     2
     3        Do not mix inline and block level boxes.
     4        https://bugs.webkit.org/show_bug.cgi?id=197462
     5        <rdar://problem/50369362>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        This patch tightens the remove-anonymous-wrappers logic by checking if the removal would
     10        produce an inline-block sibling mix.
     11        When a block level box is removed from the tree, we check if after the removal the anonymous sibling block
     12        boxes are still needed or whether we can removed them as well (and have only inline level child boxes).
     13        In addition to checking if the container is anonymous and is part of a continuation, we also need to check
     14        if collapsing it (and by that moving its children one level up) would cause a inline-block box mix.
     15
     16        Test: fast/ruby/continuation-and-column-spanner-crash.html
     17
     18        * rendering/updating/RenderTreeBuilder.cpp:
     19        (WebCore::RenderTreeBuilder::removeAnonymousWrappersForInlineChildrenIfNeeded):
     20        * rendering/updating/RenderTreeBuilderContinuation.cpp:
     21        (WebCore::RenderTreeBuilder::Continuation::cleanupOnDestroy):
     22
    1232019-05-09  Eric Carlson  <eric.carlson@apple.com>
    224
  • trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp

    r244115 r245158  
    685685    // FIXME: We should also handle split inlines here - we exclude them at the moment by returning
    686686    // if we find a continuation.
    687     auto* current = blockParent.firstChild();
    688     while (current && ((current->isAnonymousBlock() && !downcast<RenderBlock>(*current).isContinuation()) || current->style().isFloating() || current->style().hasOutOfFlowPosition()))
    689         current = current->nextSibling();
    690 
    691     if (current)
    692         return;
    693 
    694     RenderObject* next;
    695     for (current = blockParent.firstChild(); current; current = next) {
     687    Optional<bool> shouldAllChildrenBeInline;
     688    for (auto* current = blockParent.firstChild(); current; current = current->nextSibling()) {
     689        if (current->style().isFloating() || current->style().hasOutOfFlowPosition())
     690            continue;
     691        if (!current->isAnonymousBlock() || downcast<RenderBlock>(*current).isContinuation())
     692            return;
     693        // Anonymous block not in continuation. Check if it holds a set of inline or block children and try not to mix them.
     694        auto* firstChild = current->firstChildSlow();
     695        if (!firstChild)
     696            continue;
     697        auto isInlineLevelBox = firstChild->isInline();
     698        if (!shouldAllChildrenBeInline.hasValue()) {
     699            shouldAllChildrenBeInline = isInlineLevelBox;
     700            continue;
     701        }
     702        // Mixing inline and block level boxes?
     703        if (*shouldAllChildrenBeInline != isInlineLevelBox)
     704            return;
     705    }
     706
     707    RenderObject* next = nullptr;
     708    for (auto* current = blockParent.firstChild(); current; current = next) {
    696709        next = current->nextSibling();
    697710        if (current->isAnonymousBlock())
  • trunk/Source/WebCore/rendering/updating/RenderTreeBuilderContinuation.cpp

    r228938 r245158  
    3838void RenderTreeBuilder::Continuation::cleanupOnDestroy(RenderBoxModelObject& renderer)
    3939{
    40     if (!renderer.continuation() || renderer.isContinuation())
     40    if (!renderer.continuation() || renderer.isContinuation()) {
     41        if (renderer.hasContinuationChainNode())
     42            renderer.removeFromContinuationChain();
    4143        return;
     44    }
    4245
    4346    ASSERT(renderer.hasContinuationChainNode());
Note: See TracChangeset for help on using the changeset viewer.