Ensure window size is correct on Linux when fullscreenchange event dispatches for Fullscreen API calls
Categories
(Core :: Widget: Gtk, defect, P3)
Tracking
()
People
(Reporter: xidorn, Assigned: xidorn)
References
(Blocks 3 open bugs)
Details
(Whiteboard: tpi:+)
Attachments
(2 files)
Comment 1•9 years ago
|
||
Assignee | ||
Comment 2•9 years ago
|
||
Updated•9 years ago
|
Assignee | ||
Comment 3•9 years ago
|
||
Assignee | ||
Comment 4•9 years ago
|
||
Assignee | ||
Comment 5•9 years ago
|
||
Assignee | ||
Comment 6•9 years ago
|
||
Assignee | ||
Comment 7•9 years ago
|
||
Assignee | ||
Comment 8•9 years ago
|
||
Updated•9 years ago
|
Comment 9•9 years ago
|
||
Assignee | ||
Updated•9 years ago
|
Assignee | ||
Comment 10•9 years ago
|
||
Comment 11•9 years ago
|
||
Assignee | ||
Comment 12•9 years ago
|
||
Assignee | ||
Comment 13•9 years ago
|
||
Assignee | ||
Comment 14•9 years ago
|
||
Comment 15•9 years ago
|
||
Assignee | ||
Comment 16•9 years ago
|
||
Assignee | ||
Comment 17•9 years ago
|
||
Assignee | ||
Comment 18•9 years ago
|
||
Assignee | ||
Comment 19•9 years ago
|
||
Assignee | ||
Comment 20•9 years ago
|
||
Comment 21•9 years ago
|
||
Assignee | ||
Comment 22•9 years ago
|
||
Assignee | ||
Comment 23•9 years ago
|
||
Updated•8 years ago
|
Assignee | ||
Updated•6 years ago
|
Updated•2 years ago
|
Comment 24•1 years ago
|
||
I'm not entirely sure if I just stumbled on this bug or if it's unrelated, but when using Element.requestFullscreen()
and having the developer tools open, the reported window size, e.g. Window.innerHeight
is incorrect.
I made a minimal example demonstrating this:
<!DOCTYPE html>
<html>
<head>
<script type="module">
let box = document.getElementById('box');
box.addEventListener('fullscreenchange', () => {
if (document.fullscreenElement == box) {
let height = window.innerHeight;
setTimeout(() => {
if (height != window.innerHeight) {
console.log(
'`fullscreenchange` reported the wrong size: ',
height,
' (incorrect) - ',
window.innerHeight,
' (correct)',
);
}
}, 250);
}
});
window.addEventListener('keydown', (e) => {
if (e.code == 'KeyF') {
if (document.fullscreenElement == box) {
document.exitFullscreen();
} else {
box.requestFullscreen();
}
}
});
</script>
<style>
#box {
width: 100px;
height: 100px;
background-color: red;
}
</style>
</head>
<body>
<div id="box"></div>
</body>
</html>
To test this you will have to have your developer tools embedded at the bottom or top of your browser window. Now if you press "F", the red box will be made fullscreen. But even though this will only partly cover your screen, because the developer cover the other part of the screen, it will report the full height in Window.innerHeight
during fullscreenchange
. But just 250ms Window.innerHeight
will report the correct size.
This is done on Linux X11. I also tried this in Firefox Nightly, same behavior.
Assignee | ||
Comment 25•1 year ago
|
||
(In reply to daxpedda from comment #24)
To test this you will have to have your developer tools embedded at the bottom or top of your browser window. Now if you press "F", the red box will be made fullscreen. But even though this will only partly cover your screen, because the developer cover the other part of the screen, it will report the full height in
Window.innerHeight
duringfullscreenchange
. But just 250msWindow.innerHeight
will report the correct size.
This is a separate thing.
We optimize fullscreen change by aggressively reporting the full screen dimensions in advance so that layout change can start early and doesn't need to kick in multiple times, even if the window hasn't really finished resizing. It was done in https://hg.mozilla.org/mozilla-central/rev/ef599e365a7b.
This is, however, based on the assumption that we are actually going to occupy the full screen, which is the most common cases. However, in your case, the content is not occupying the whole screen, and thus the assumption is wrong, and the correct dimensions come after we unblock the resize when the fullscreen state is settled.
I don't think we need to handle that case, as it's not something that matters to a normal user of fullscreen.
Description
•