Working on Fullscreen in Blink, the situation has come up where we're transition in or out of fullscreen when a call to go in the opposite direction happens. Test case:
<!doctype html>
<div>
<button>request</button>
<button>exit</button>
<button>request+exit</button>
<button>exit+request</button>
</div>
</div>
<script>
var div = document.querySelector('div');
div.addEventListener('click', function(event) {
if (event.target.localName != 'button')
return;
for (var action of event.target.textContent.split('+')) {
if (action == 'request') {
if (div.requestFullscreen) {
div.requestFullscreen();
} else if (div.webkitRequestFullscreen) {
div.webkitRequestFullscreen();
} else {
div.mozRequestFullScreen();
}
} else if (action == 'exit') {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
} else {
document.mozCancelFullScreen();
}
} else {
throw 'unknown action';
}
}
});
</script>
Current behavior:
|
request+exit |
exit+request |
request then request+exit |
request then exit+request |
| Spec'd |
enter |
enter |
??? |
??? |
| Chrome 55 |
enters+exits quickly |
enters |
exits |
exits |
| Edge 14 |
enters+exits quickly |
enters |
exits |
exits+enters quickly |
| Firefox 51 |
enters |
enters |
exits |
exits |
Safari 10 behaved strangely when testing in BrowserStack, seemingly hanging, so I don't trust what I saw.
Exit fullscreen has an early return in the spec, which makes the first two cases simple. For the last two, it's not obviously well defined, because two "resizes" are racing "in parallel."
@upsuper @jernoble
Working on Fullscreen in Blink, the situation has come up where we're transition in or out of fullscreen when a call to go in the opposite direction happens. Test case:
Current behavior:
Safari 10 behaved strangely when testing in BrowserStack, seemingly hanging, so I don't trust what I saw.
Exit fullscreen has an early return in the spec, which makes the first two cases simple. For the last two, it's not obviously well defined, because two "resizes" are racing "in parallel."
@upsuper @jernoble