Bug 261020

Summary: Contain intrinsic size doesn't get updated during some DOM node removals
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: DOMAssignee: Rob Buis <rbuis>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: cathiechen, cdumez, pgriffis, rbuis, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   

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 ***