Skip to content

REGRESSION (iOS 17.4, macOS 14.4, 270890@main): Animating element with display: none still remain visible#25814

Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
anttijk:animation-mutation-none
Mar 13, 2024
Merged

REGRESSION (iOS 17.4, macOS 14.4, 270890@main): Animating element with display: none still remain visible#25814
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
anttijk:animation-mutation-none

Conversation

@anttijk
Copy link
Contributor

@anttijk anttijk commented Mar 13, 2024

d83537a

REGRESSION (iOS 17.4, macOS 14.4, 270890@main): Animating element with display: none still remain visible
https://bugs.webkit.org/show_bug.cgi?id=270697
rdar://124289418

Reviewed by Antoine Quint and Darin Adler.

The page sets the root of the overlay containing tree to display:none and immediately (before style recall) reinserts
it into another position in the document, causing render tree teardown. When we recompute the style (applying display:none)
we don't consider it a style change since there was no existing style due to the earlier teardown.
In this case we fail to clear lastStyleChangeEventStyle which has been set by an animation on the element.

Another animation triggered style recalc comes along, takes the optimized AnimationOnly code path and picks up
the lastStyleChangeEventStyle (which doesn't have display:none) bringing the element back alive.

* LayoutTests/fast/animation/animation-with-DOM-mutation-and-display-none-expected.html: Added.
* LayoutTests/fast/animation/animation-with-DOM-mutation-and-display-none.html: Added.
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolveElement):

Fix by clearing lastStyleChangeEventStyle also when we have a style change to display:none without existing renderer.

Canonical link: https://commits.webkit.org/276035@main

5914ae1

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 wincairo
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug 🧪 wpe-wk2
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🛠 wpe-skia
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 tv ✅ 🧪 mac-AS-debug-wk2 🧪 gtk-wk2
✅ 🛠 tv-sim ✅ 🧪 mac-wk2-stress ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🛠 watch
✅ 🛠 watch-sim

@anttijk anttijk self-assigned this Mar 13, 2024
@anttijk anttijk added the Layout and Rendering For bugs with layout and rendering of Web pages. label Mar 13, 2024
@anttijk anttijk force-pushed the animation-mutation-none branch from 39cf6ec to 5914ae1 Compare March 13, 2024 14:31
@anttijk anttijk added the merge-queue Applied to send a pull request to merge-queue label Mar 13, 2024
…h display: none still remain visible

https://bugs.webkit.org/show_bug.cgi?id=270697
rdar://124289418

Reviewed by Antoine Quint and Darin Adler.

The page sets the root of the overlay containing tree to display:none and immediately (before style recall) reinserts
it into another position in the document, causing render tree teardown. When we recompute the style (applying display:none)
we don't consider it a style change since there was no existing style due to the earlier teardown.
In this case we fail to clear lastStyleChangeEventStyle which has been set by an animation on the element.

Another animation triggered style recalc comes along, takes the optimized AnimationOnly code path and picks up
the lastStyleChangeEventStyle (which doesn't have display:none) bringing the element back alive.

* LayoutTests/fast/animation/animation-with-DOM-mutation-and-display-none-expected.html: Added.
* LayoutTests/fast/animation/animation-with-DOM-mutation-and-display-none.html: Added.
* Source/WebCore/style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolveElement):

Fix by clearing lastStyleChangeEventStyle also when we have a style change to display:none without existing renderer.

Canonical link: https://commits.webkit.org/276035@main
@webkit-commit-queue
Copy link
Collaborator

Committed 276035@main (d83537a): https://commits.webkit.org/276035@main

Reviewed commits have been landed. Closing PR #25814 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit d83537a into WebKit:main Mar 13, 2024
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Mar 13, 2024
@anttijk anttijk deleted the animation-mutation-none branch March 15, 2024 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Layout and Rendering For bugs with layout and rendering of Web pages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants