[whatwg/fullscreen] Decide on wanted behavior for request+exit or exit+request together (#63)

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:

```HTML
<!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:
<table>
<tr>
 <th></th>
 <th>request+exit</th>
 <th>exit+request</th>
 <th>request then request+exit</th>
 <th>request then exit+request</th>
<tr>
 <th>Spec'd</th>
 <th>enter</th>
 <th>enter</th>
 <th>???</th>
 <th>???</th>
<tr>
 <th>Chrome 55</th>
 <th>enters+exits quickly</th>
 <th>enters</th>
 <th>exits</th>
 <th>exits</th>
<tr>
 <th>Edge 14</th>
 <th>enters+exits quickly</th>
 <th>enters</th>
 <th>exits</th>
 <th>exits+enters quickly</th>
<tr>
 <th>Firefox 51</th>
 <th>enters</th>
 <th>enters</th>
 <th>exits</th>
 <th>exits</th>
</table>

Safari 10 behaved strangely when testing in BrowserStack, seemingly hanging, so I don't trust what I saw.

[Exit fullscreen](https://fullscreen.spec.whatwg.org/#exit-fullscreen) has an early return in the spec, which makes the first two cases simple. For the second two, it's not obvious well defined, because two "resizes" are racing "in parallel."

@upsuper @jernoble

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fullscreen/issues/63

Received on Monday, 21 November 2016 13:41:54 UTC