mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
LibWeb: Start transitions when affected properties change
Co-authored-by: Matthew Olsson <matthewcolsson@gmail.com>
This commit is contained in:
parent
e544166977
commit
a1fca1a7f3
Notes:
github-actions[bot]
2024-09-22 04:42:46 +00:00
Author: https://github.com/AtkinsSJ
Commit: a1fca1a7f3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1442
8 changed files with 380 additions and 11 deletions
48
Tests/LibWeb/Text/input/css/transition-basics.html
Normal file
48
Tests/LibWeb/Text/input/css/transition-basics.html
Normal file
|
@ -0,0 +1,48 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<script src="../include.js"></script>
|
||||
<style>
|
||||
#box {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background-color: red;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
|
||||
transition: left 1s linear;
|
||||
}
|
||||
|
||||
#box.move {
|
||||
left: 200px;
|
||||
}
|
||||
</style>
|
||||
<div id="box"></div>
|
||||
<script>
|
||||
asyncTest(async done => {
|
||||
let box = document.getElementById("box");
|
||||
println(`left starts at: ${getComputedStyle(box).left}`);
|
||||
box.classList.add("move");
|
||||
setTimeout(() => {
|
||||
let left = parseFloat(getComputedStyle(box).left);
|
||||
println(`shortly after starting, left is >= 0px? ${left >= 0} and < 200px? ${left < 200}`);
|
||||
}, 1);
|
||||
setTimeout(() => {
|
||||
let left = parseFloat(getComputedStyle(box).left);
|
||||
println(`half-way through, left is > 0px? ${left > 0} and < 200px? ${left < 200}`);
|
||||
}, 500);
|
||||
setTimeout(() => {
|
||||
let left = parseFloat(getComputedStyle(box).left);
|
||||
println(`near the end, left is > 0px? ${left > 0} and < 200px? ${left < 200}`);
|
||||
}, 950);
|
||||
setTimeout(() => {
|
||||
// FIXME: This is a hack to make it recompute the style, otherwise we get 0px for the left value.
|
||||
// Figure out why!
|
||||
box.style.top = "0px";
|
||||
|
||||
println(`after the transition, left is: ${getComputedStyle(box).left}`);
|
||||
done();
|
||||
}, 1050);
|
||||
});
|
||||
</script>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue