Skip to content

Truly independent web browser

1.4 KB
Raw Blame
<!DOCTYPE html>
<script src="../../include.js"></script>
<script src="frame-in-flight.js"></script>
<style>
    body { margin: 0; }
    #box { width: 100px; height: 100px; outline: 1px solid rgb(0, 0, 255); }
    #box:hover { width: 150px; outline-color: rgb(0, 128, 0); }
</style>
<div id="box"></div>
<script>
    // A task that reads the layout of the document writes nothing the screen does not show: the lane of the presented
    // frame goes on following the pointer beside it, and beside the tasks after it, and hovers.
    asyncTest(async done => {
        const result = await whileLaneHovers(async frameTime => {
            const before = internals.clockLaneState(document);
            const width = box.offsetWidth;
            const afterRead = internals.clockLaneState(document);
            await nextTask();
            const nextTaskBegins = internals.clockLaneState(document);
            internals.injectHoverPointer(50, 50, frameTime + 16);
            return { before, width, afterRead, nextTaskBegins, onScreen: internals.presentedBorderBox(box)?.width };
        });
        println(`lane as the first task begins: ${result.before}`);
        println(`box width read: ${result.width}`);
        println(`lane after the read: ${result.afterRead}`);
        println(`lane as the next task begins: ${result.nextTaskBegins}`);
        println(`box width on screen: ${result.onScreen}`);
        done();
    });
</script>