LibWeb: Use a queue to process fullscreen request completions

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.
This commit is contained in:
Zaggy1024
2026-03-16 22:01:36 -05:00
committed by Gregory Bertilson
parent ae9537a53c
commit 2e54c18fb3
Notes: github-actions[bot] 2026-03-17 23:59:34 +00:00
10 changed files with 295 additions and 140 deletions

View File

@@ -22,8 +22,7 @@ promise_test(async t => {
if (event.type == 'fullscreenchange') {
step_timeout(t.unreached_func('timer callback'));
requestAnimationFrame(t.step_func_done(() => {
// Removed 'resize' expectation for now, see https://crbug.com/381127087.
assert_array_equals(events, ['fullscreenchange'], 'event order');
assert_array_equals(events, ['resize', 'fullscreenchange'], 'event order');
resolve();
}));
}