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

Changeset 282506 in webkit


Ignore:
Timestamp:
Sep 16, 2021, 1:31:45 AM (5 years ago)
Author:
Adrian Perez de Castro
Message:

Merge r276014 - [RenderTreeBuilder] Cleanup the inline tree when moving subtrees
​https://bugs.webkit.org/show_bug.cgi?id=224342
<rdar://76349279>

Reviewed by Antti Koivisto.

When an inline box is moved over to a different BFC (<span>), any inline level descendant (<span><img></span>) should be invalidated. The safest way to do this is
to destroy the inline tree (the "subtree moving" will eventually be replaced by "destroy followed by construct" activity).

  • rendering/updating/RenderTreeBuilder.cpp:

(WebCore::RenderTreeBuilder::move):

Location:
releases/WebKitGTK/webkit-2.32/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • releases/WebKitGTK/webkit-2.32/Source/WebCore/ChangeLog

    r282505 r282506  
     12021-04-15  Zalan Bujtas  <zalan@apple.com>
     2
     3        [RenderTreeBuilder] Cleanup the inline tree when moving subtrees
     4        https://bugs.webkit.org/show_bug.cgi?id=224342
     5        <rdar://76349279>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        When an inline box is moved over to a different BFC (<span>), any inline level descendant (<span><img></span>) should be invalidated. The safest way to do this is
     10        to destroy the inline tree (the "subtree moving" will eventually be replaced by "destroy followed by construct" activity).
     11
     12        * rendering/updating/RenderTreeBuilder.cpp:
     13        (WebCore::RenderTreeBuilder::move):
     14
    1152021-04-15  Carlos Garcia Campos  <cgarcia@igalia.com>
    216
  • releases/WebKitGTK/webkit-2.32/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp

    r280906 r282506  
    485485        attachToRenderElementInternal(to, WTFMove(childToMove), beforeChild, ReinsertAfterMove::Yes);
    486486    }
     487
     488    auto findBFCRootAndDestroyInlineTree = [&] {
     489        auto* containingBlock = &from;
     490        while (containingBlock) {
     491            containingBlock->setNeedsLayout();
     492            if (is<RenderBlockFlow>(*containingBlock)) {
     493                downcast<RenderBlockFlow>(*containingBlock).deleteLines();
     494                break;
     495            }
     496            containingBlock = containingBlock->containingBlock();
     497        }
     498    };
     499    // When moving a subtree out of a BFC we need to make sure that the line boxes generated for the inline tree are not accessible anymore from the renderers.
     500    // Let's find the BFC root and nuke the inline tree (At some point we are going to destroy the subtree instead of moving these renderers around.)
     501    if (is<RenderInline>(child))
     502        findBFCRootAndDestroyInlineTree();
    487503}
    488504
Note: See TracChangeset for help on using the changeset viewer.