Bug 261020 - Contain intrinsic size doesn't get updated during some DOM node removals
Summary: Contain intrinsic size doesn't get updated during some DOM node removals
Status: RESOLVED DUPLICATE of bug 270240
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Rob Buis
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-08-31 23:56 PDT by Ryosuke Niwa
Modified: 2024-03-02 01:42 PST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2023-08-31 23:56:15 PDT
The following code in ContainerNode::removeChild is bogus for a few reasons:
1. It happens after dispatchSubtreeModifiedEvent(). By that point, other scripts may have ran so it's too late.
2. This is not the only function that can remove DOM nodes from a tree.

    auto* element = dynamicDowncast<Element>(oldChild);
    if (element && (element->lastRememberedLogicalWidth() || element->lastRememberedLogicalHeight())) {
        // The disconnected element could be unobserved because of other properties, here we need to make sure it is observed,
        // so that deliver could be triggered and it would clear lastRememberedSize.
        document().observeForContainIntrinsicSize(*element);
        document().resetObservationSizeForContainIntrinsicSize(*element);
    }
Comment 1 Radar WebKit Bug Importer 2023-09-07 23:57:13 PDT
<rdar://problem/115157934>
Comment 2 Rob Buis 2023-09-29 06:36:09 PDT
Pull request: https://github.com/WebKit/WebKit/pull/18409
Comment 3 Rob Buis 2024-03-02 01:42:06 PST
Please re-open if anybody think it is not a dupe.

*** This bug has been marked as a duplicate of bug 270240 ***