Bug 1648750 [wpt PR 24358] - Clear ComputedStyle before detaching descendants., a...
commitf3e72901e076a7d263b129747f3c0ae4f2da4e16
authorRune Lillesveen <futhark@chromium.org>
Thu, 2 Jul 2020 19:19:16 +0000 (2 19:19 +0000)
committermoz-wptsync-bot <wptsync@mozilla.com>
Fri, 3 Jul 2020 09:38:37 +0000 (3 09:38 +0000)
tree44405688e3b164dd128527544911867f05ea04f5
parent613b3a6fcd515408569dbd82533276f0fb7a0b91
Bug 1648750 [wpt PR 24358] - Clear ComputedStyle before detaching descendants., a=testonly

Automatic update from web-platform-tests
Clear ComputedStyle before detaching descendants.

More importantly, make sure ComputedStyle is cleared before cancelling
animations. There is a problem with CSSAnimations::Cancel() marking for
style recalc during DetachLayoutTree() and updating the style recalc
root when DetachLayoutTree() was called due to an element being removed
from the flat tree during slot assignment.

At that time, the element is outside the flat tree for traversal, but
may have a ComputedStyle which is not IsEnsuredOutsideFlatTree().

The code to avoid having style recalc roots outside the flat tree in
MarkAncestorsWithChildNeedsStyleRecalc[1] relies on ComputedStyle being
null or IsEnsuredOutsideFlatTree().

An alternative approach to clearing the ComputedStyle early, would be to
pass an argument to Cancel() saying that the element is being removed
from the flat tree and make sure we don't try to mark for style recalc
in that case. Or, introduce a DetachLayoutTreeNotForReattachScope which
sets a flag to make sure we don't mark for style recalc or update the
recalc root.

[1] https://source.chromium.org/chromium/chromium/src/+/065224b3301f8e531a7fb750e5245891cd1a0e53:third_party/blink/renderer/core/dom/node.cc;l=1367-1381

Bug: 1093747
Change-Id: I7c133e6372a11bd0b87002f4eb54316588d05564
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2268938
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#783451}

--

wpt-commits: 1bfa47a13650c7c09ff40c57d1de6956d8d79dd4
wpt-pr: 24358
testing/web-platform/tests/css/css-animations/cancel-animation-shadow-slot-invalidation.html [new file with mode: 0644]