mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
Instead of immediately firing fullscreenchange, defer that until WebContent's client has confirmed that it is in fullscreen for the content. The fullscreenchange is fired by the viewport change, so in cases where the fullscreen transition is instantaneous (i.e. the fullscreen state is entered at the exact moment the viewport expands), the resize event should precede the fullscreenchange event, as the spec requires. This fixes the WPT element-request-fullscreen-timing.html test, which was previously succeeding by accident because we were immediately fullscreenchange upon requestFullscreen() being called, instead of following spec and doing the viewport (window) resize in parallel. The WPT test was actually initially intended to assert that the fullscreenchange event follows the resize event, but the WPT runner didn't actually have a different resolution for normal vs fullscreen viewports, so the resize event doesn't actually fire in their setup. In our headless mode, the default viewport is 800x600, and the fullscreen viewport is 1920x1080, so we do fire a resize event when entering fullscreen. Therefore, that imported test is reverted to assert that the resize precedes the fullscreenchange.
34 lines
923 B
HTML
34 lines
923 B
HTML
<!DOCTYPE html>
|
|
<style>
|
|
body { margin: 0; }
|
|
#target { width: 100px; height: 100px; }
|
|
</style>
|
|
<div id="target"></div>
|
|
<script src="../include.js"></script>
|
|
<script>
|
|
asyncTest(done => {
|
|
const target = document.getElementById("target");
|
|
|
|
window.addEventListener("resize", () => {
|
|
println(`resize ${window.innerWidth}x${window.innerHeight}`);
|
|
});
|
|
|
|
document.addEventListener("fullscreenchange", () => {
|
|
println("fullscreenchange");
|
|
});
|
|
|
|
target.addEventListener("click", () => {
|
|
target.requestFullscreen().then(() => {
|
|
requestAnimationFrame(() => {
|
|
document.exitFullscreen().then(() => done());
|
|
});
|
|
}, (err) => {
|
|
println(`promise rejected: ${err}`);
|
|
done();
|
|
});
|
|
});
|
|
|
|
internals.click(5, 5);
|
|
});
|
|
</script>
|