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

Changeset 276014 in webkit


Ignore:
Timestamp:
Apr 15, 2021, 3:07:42 AM (6 years ago)
Author:
Alan Bujtas
Message:

[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:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r276013 r276014  
     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  Youenn Fablet  <youenn@apple.com>
    216
  • trunk/Source/WebCore/rendering/updating/RenderTreeBuilder.cpp

    r275852 r276014  
    487487        attachToRenderElementInternal(to, WTFMove(childToMove), beforeChild, RenderObject::IsInternalMove::Yes);
    488488    }
     489
     490    auto findBFCRootAndDestroyInlineTree = [&] {
     491        auto* containingBlock = &from;
     492        while (containingBlock) {
     493            containingBlock->setNeedsLayout();
     494            if (is<RenderBlockFlow>(*containingBlock)) {
     495                downcast<RenderBlockFlow>(*containingBlock).deleteLines();
     496                break;
     497            }
     498            containingBlock = containingBlock->containingBlock();
     499        }
     500    };
     501    // 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.
     502    // 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.)
     503    if (is<RenderInline>(child))
     504        findBFCRootAndDestroyInlineTree();
    489505}
    490506
Note: See TracChangeset for help on using the changeset viewer.