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; }
    .item { width: 200px; background: rgb(0, 0, 255); }
    .label { height: 50px; }
    .menu { display: none; height: 100px; }
    .item:hover .menu { display: block; }
    @keyframes grow { from { width: 50px; } to { width: 60px; } }
    #after { width: 50px; height: 50px; animation: grow 100s linear infinite; }
</style>
<div class="item" id="item"><div class="label"></div><div class="menu" id="menu"><span>first</span> <span>second</span></div></div>
<div id="after"></div>
<script>
    // A hover beside the task that reveals a menu no style update ever reached below its root builds its boxes beside
    // the task, from the records the elements below it compute to against it. The main thread styles the elements and
    // builds the boxes again as it takes the hover in.
    asyncTest(async done => {
        const y = await whileLaneHovers(frameTime => {
            internals.injectHoverPointer(100, 25, frameTime + 16);
            return internals.presentedBorderBox(after)?.y;
        });
        println(`after on screen at y: ${y}`);
        await nextFrame();
        println(`menu display: ${getComputedStyle(menu).display}`);
        println(`after at y: ${after.getBoundingClientRect().y}`);
        println(`span color: ${getComputedStyle(menu.firstElementChild).color}`);
        done();
    });
</script>