Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear ComputedStyle before detaching descendants. #24358

Merged
merged 1 commit into from Jun 29, 2020

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Jun 26, 2020

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}

Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

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}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants