mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-22 09:18:55 +00:00
LibWeb: Use correct style rule index in view transitions
This used to crash a lot of attempted view transitions, now it doesn't anymore.
This commit is contained in:
parent
5d9e51d675
commit
905e749575
Notes:
github-actions[bot]
2025-09-09 11:51:16 +00:00
Author: https://github.com/Psychpsyo
Commit: 905e749575
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6139
Reviewed-by: https://github.com/AtkinsSJ ✅
6 changed files with 101 additions and 1 deletions
|
@ -526,7 +526,7 @@ void ViewTransition::setup_transition_pseudo_elements()
|
|||
transition_name, "transform", width, height, "backdrop_filter")),
|
||||
stylesheet->rules().length()));
|
||||
// FIXME: all the strings above should be the identically named variables, serialized somehow.
|
||||
captured_element->group_keyframes = as<CSS::CSSKeyframesRule>(stylesheet->css_rules()->item(0));
|
||||
captured_element->group_keyframes = as<CSS::CSSKeyframesRule>(stylesheet->css_rules()->item(index));
|
||||
|
||||
// 6. Set capturedElement’s group animation name rule to a new CSSStyleRule representing the
|
||||
// following CSS, and append it to document’s dynamic view transition style sheet:
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<!doctype html>
|
||||
<html class="test-wait">
|
||||
<script>
|
||||
window.addEventListener("load", () => {
|
||||
const a = document.createElement("style")
|
||||
document.documentElement.appendChild(a)
|
||||
a.textContent = ":first-line{}"
|
||||
document.adoptNode(document.body)
|
||||
document.startViewTransition().ready.then(() => {
|
||||
document.documentElement.className = "";
|
||||
});
|
||||
})
|
||||
</script>
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="test-wait">
|
||||
<title>View transitions: list-style-position crash</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/">
|
||||
<link rel="author" href="mailto:bokan@chromium.org">
|
||||
|
||||
<script>
|
||||
onload = async () => {
|
||||
let vt = document.startViewTransition();
|
||||
await vt.ready;
|
||||
await new Promise(resolve => requestAnimationFrame(resolve));
|
||||
|
||||
document.documentElement.style.listStylePosition = 'inside';
|
||||
// Force style update.
|
||||
window.scrollX;
|
||||
|
||||
document.documentElement.classList.remove('test-wait');
|
||||
}
|
||||
</script>
|
||||
</html>
|
|
@ -0,0 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<title>View transitions: content-visibility:hidden on root element crash</title>
|
||||
<link rel="help" href="https://crbug.com/1429947">
|
||||
<style>
|
||||
html {
|
||||
content-visibility: hidden;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
document.startViewTransition();
|
||||
</script>
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<html class=test-wait>
|
||||
<title>View transitions: html display none</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/">
|
||||
<link rel="author" href="mailto:vmpstr@chromium.org">
|
||||
|
||||
<style>
|
||||
html {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
function finish() {
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
|
||||
async function runTest() {
|
||||
if (!document.startViewTransition) {
|
||||
document.body.textContent = "Precondition Failed: Missing document.startViewTransition";
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
document.startViewTransition().finished.then(finish, finish);
|
||||
}
|
||||
onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest));
|
||||
</script>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE html>
|
||||
<html class=test-wait>
|
||||
<title>View transitions: entry animation from root display none</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/">
|
||||
<link rel="author" href="mailto:vmpstr@chromium.org">
|
||||
|
||||
<style>
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
::view-transition-group(*) {
|
||||
animation-duration: 500s
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
async function runTest() {
|
||||
transition = document.startViewTransition();
|
||||
transition.ready.then(() => {
|
||||
requestAnimationFrame(() => {
|
||||
document.documentElement.classList.toggle("hidden");
|
||||
});
|
||||
});
|
||||
transition.finished.then(() => document.documentElement.classList.remove("test-wait"));
|
||||
}
|
||||
onload = () => requestAnimationFrame(() => requestAnimationFrame(runTest));
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue