Truly independent web browser
LibWeb: Test the class a lane hovers past an update that paints nothing
Andreas Kling8eaa20abda40
diff --git a/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-hovers-the-class-a-task-wrote-before-an-update-that-paints-nothing.txt b/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-hovers-the-class-a-task-wrote-before-an-update-that-paints-nothing.txtnew file mode 100644index 00000000000..3f6764c593d--- /dev/null+++ b/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-hovers-the-class-a-task-wrote-before-an-update-that-paints-nothing.txt@@ -0,0 +1,4 @@+computed width in the task: 100px+width on screen: 200+last frame presented by: clock+computed width: 300pxdiff --git a/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-hovers-the-class-of-an-update-beside-its-flying-frame.txt b/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-hovers-the-class-of-an-update-beside-its-flying-frame.txtnew file mode 100644index 00000000000..663c6c9de77--- /dev/null+++ b/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-hovers-the-class-of-an-update-beside-its-flying-frame.txt@@ -0,0 +1,5 @@+lane of the flying frame is coming: true+after the update beside it: true+width on screen: 200+last frame presented by: clock+computed width: 300pxdiff --git a/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-hovers-the-class-written-beside-its-flying-frame.txt b/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-hovers-the-class-written-beside-its-flying-frame.txtnew file mode 100644index 00000000000..636077c67e6--- /dev/null+++ b/Tests/LibWeb/Text/expected/HTML/frame-in-flight/hover-lane-hovers-the-class-written-beside-its-flying-frame.txt@@ -0,0 +1,5 @@+lane of the flying frame is coming: true+computed width beside the frame: 100px+width on screen: 200+last frame presented by: clock+computed width: 300pxdiff --git a/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-hovers-the-class-a-task-wrote-before-an-update-that-paints-nothing.html b/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-hovers-the-class-a-task-wrote-before-an-update-that-paints-nothing.htmlnew file mode 100644index 00000000000..95180ec532b--- /dev/null+++ b/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-hovers-the-class-a-task-wrote-before-an-update-that-paints-nothing.html@@ -0,0 +1,32 @@+<!DOCTYPE html>+<script src="../../include.js"></script>+<script src="frame-in-flight.js"></script>+<style>+ body { margin: 0; }+ div { width: 100px; height: 100px; }+ .old:hover { width: 200px; }+ .new:hover { width: 300px; }+</style>+<div id="target" class="old"></div>+<script>+ // A task moves a class that only shows under :hover, and the first write forks the state as the presented frame left+ // it, for the lane to hover beside the task. The rendering update after it paints nothing, so the lane of that frame+ // goes on, and it hovers the document as the update left it, not as it was before the task.+ asyncTest(async done => {+ const result = await whileLaneHovers(async frameTime => {+ target.className = "new";+ const computedWidth = getComputedStyle(target).width;+ internals.injectRenderingOpportunity(frameTime + 16);+ do await nextTask();+ while (internals.frameSchedulerState() !== "idle" || internals.clockLaneIsComing(document));+ internals.injectHoverPointer(50, 50, frameTime + 32);+ return { computedWidth, onScreen: internals.presentedBorderBox(target)?.width, presentedBy: internals.lastFramePresentedBy(document) };+ });+ println(`computed width in the task: ${result.computedWidth}`);+ println(`width on screen: ${result.onScreen}`);+ println(`last frame presented by: ${result.presentedBy}`);+ await twoFrames();+ println(`computed width: ${getComputedStyle(target).width}`);+ done();+ });+</script>diff --git a/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-hovers-the-class-of-an-update-beside-its-flying-frame.html b/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-hovers-the-class-of-an-update-beside-its-flying-frame.htmlnew file mode 100644index 00000000000..606d2820f43--- /dev/null+++ b/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-hovers-the-class-of-an-update-beside-its-flying-frame.html@@ -0,0 +1,47 @@+<!DOCTYPE html>+<script src="../../include.js"></script>+<script src="frame-in-flight.js"></script>+<style>+ body { margin: 0; }+ div { width: 100px; height: 100px; }+ .old:hover { width: 200px; }+ .new:hover { width: 300px; }+</style>+<div id="target" class="old"></div>+<div id="other"></div>+<div style="content-visibility: auto"></div>+<script>+ // A rendering update that paints nothing runs while the recording of the frame before it flies, and moves a class that+ // only shows under :hover. Its plan reaches the lane of that frame before the rest of its pieces, and the lane hovers+ // the document as the update left it, not as the flying frame showed it.+ asyncTest(async done => {+ const lane = await whileRecordingInFlight(+ () => {+ other.style.width = "50px";+ },+ async () => {+ const coming = internals.clockLaneIsComing(document);+ // NB: The class write forks the state for the lane of the flying frame.+ target.className = "new";+ getComputedStyle(target).width;+ await new Promise(resolve => {+ requestAnimationFrame(resolve);+ internals.injectRenderingOpportunity(performance.now());+ });+ await nextTask();+ return { coming, comingAfterUpdate: internals.clockLaneIsComing(document) };+ }+ );+ const result = await whileLaneHovers(frameTime => {+ internals.injectHoverPointer(50, 50, frameTime + 16);+ return { onScreen: internals.presentedBorderBox(target)?.width, presentedBy: internals.lastFramePresentedBy(document) };+ });+ println(`lane of the flying frame is coming: ${lane.coming}`);+ println(`after the update beside it: ${lane.comingAfterUpdate}`);+ println(`width on screen: ${result.onScreen}`);+ println(`last frame presented by: ${result.presentedBy}`);+ await twoFrames();+ println(`computed width: ${getComputedStyle(target).width}`);+ done();+ });+</script>diff --git a/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-hovers-the-class-written-beside-its-flying-frame.html b/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-hovers-the-class-written-beside-its-flying-frame.htmlnew file mode 100644index 00000000000..bc2a6a081c7--- /dev/null+++ b/Tests/LibWeb/Text/input/HTML/frame-in-flight/hover-lane-hovers-the-class-written-beside-its-flying-frame.html@@ -0,0 +1,40 @@+<!DOCTYPE html>+<script src="../../include.js"></script>+<script src="frame-in-flight.js"></script>+<style>+ body { margin: 0; }+ div { width: 100px; height: 100px; }+ .old:hover { width: 200px; }+ .new:hover { width: 300px; }+</style>+<div id="target" class="old"></div>+<div id="other"></div>+<div style="content-visibility: auto"></div>+<script>+ // A class that only shows under :hover moves while the recording of the frame before it flies. The first write forks+ // the state for the lane of that frame, whose pieces are still coming. The rendering update after it paints nothing,+ // so that lane goes on, and it hovers the document as the update left it, not as the flying frame showed it.+ asyncTest(async done => {+ const flight = await whileRecordingInFlight(+ () => {+ other.style.width = "50px";+ },+ () => {+ const coming = internals.clockLaneIsComing(document);+ target.className = "new";+ return { coming, computedWidth: getComputedStyle(target).width };+ }+ );+ const result = await whileLaneHovers(frameTime => {+ internals.injectHoverPointer(50, 50, frameTime + 16);+ return { onScreen: internals.presentedBorderBox(target)?.width, presentedBy: internals.lastFramePresentedBy(document) };+ });+ println(`lane of the flying frame is coming: ${flight.coming}`);+ println(`computed width beside the frame: ${flight.computedWidth}`);+ println(`width on screen: ${result.onScreen}`);+ println(`last frame presented by: ${result.presentedBy}`);+ await twoFrames();+ println(`computed width: ${getComputedStyle(target).width}`);+ done();+ });+</script>