Give "exit fullscreen" a fully flag and define "fully exit fullscreen" using it#65
Give "exit fullscreen" a fully flag and define "fully exit fullscreen" using it#65foolip wants to merge 1 commit into
Conversation
|
This is a big rough, but the structure matches exactly what I found myself having to do in https://codereview.chromium.org/2573773002/ in order to make sense of fully exit fullscreen with the timing changes to modify the fullscreen element stack (soon top layer) at animation frame timing. I have doubts about whether to expose this in the API or not. It would be great for testing and I even have the tests, but is it also useful for web authors? |
|
I guess it might be useful if you "own" the entire application stack. But what would this do inside an |
|
You changed https://fullscreen.spec.whatwg.org/#fully-exit-fullscreen to only fully exit in the document for which it's called in 3243119. I assumed that was intentional? Do you think people would expect |
|
It does seem like that was intentional. I guess as long as you're same-origin you can grab the same document as UX would when fully exiting. |
|
|
||
| <p>To <dfn>exit fullscreen</dfn> a <a for=/>document</a> <var>doc</var>, run these steps: | ||
| <p>To <dfn>exit fullscreen</dfn> a <a for=/>document</a> <var>doc</var> with an optional | ||
| <var>fully flag</var>, run these steps: |
There was a problem hiding this comment.
Wording suggestion appreciated here. The flag isn't really optional, and might as well just be a boolean value, but the wording "To exit fullscreen a document with fully, run these steps" wasn't great I thought.
| <!-- cross-process --> | ||
|
|
||
| <li><p>For each <var>exitDoc</var> in <var>exitDocs</var>, in order, | ||
| <li><p>For each <var>exitDoc</var> in <var>exitDocs</var>, in order: If <var>exitDoc</var> is |
There was a problem hiding this comment.
Suggestions also welcome here. Would it be better have exitDocs contain only the documents that should fully exit, and then handle the document above separately? (That is currently "If exitDocs’s last document has a browsing context container, append that browsing context container’s node document to exitDocs.")
There was a problem hiding this comment.
Not sure, whatever matches the code. But I would use a sublist after "in order" to deal with the if/otherwise situation in two list items rather than jamming it all together.
7aa47da to
fd7d56d
Compare
If exposing it is not central of this change, could we split this into a separate issue? It seems to me this could be more controversial than fixing the timing issue. |
fd7d56d to
d12a7a7
Compare
|
I've now finished the changes and think they are ready for review. There is one existing problem that I'll comment on. |
| <a>node document</a> to <var>exitDocs</var>. | ||
| <!-- cross-process --> | ||
|
|
||
| <li><p>Let <var>descendantDocs</var> be an ordered set consisting of <var>doc</var>'s |
There was a problem hiding this comment.
Using doc here seems like a problem before and after this change. Before, the fullscreen element in one of exitDocs may have been another iframe, since we have no hierarchy restrictions now. The wrong part of the frame tree is then going to get its fullscreen state cleared.
With this change, there's the additional problem that if fully flag is set, we'll exit fully in all those documents, and there may be a bunch of frames that need state cleared that don't get it.
I'm thinking that maybe the synchronous intro of "exit fullscreen" should instead determine a single exitDoc, from which one or all fullscreen top layer elements will be removed depending on the fully flag. Then there will be no "collecting documents to unfullscreen" in the animation frame task, only an attempt to make it so. Would that kind of model work? Should I work it into this PR or not?
There was a problem hiding this comment.
@upsuper can probably answer the model question much better than I can.
There was a problem hiding this comment.
I don't see how any doc in exitDocs may have any other iframe at all. If a document has more than one fullscreen element in the top layer, it shouldn't be included in the result from collect documents to unfullscreen. If a document has changed its fullscreen element to another single element, this document should have exited fullscreen state, so these steps should early return in the first substep you added. Since everything is invoked synchronously, I don't see what the problem is here.
Am I missing something?
| <ol> | ||
| <li><p>If <var>node</var> is its <a>node document</a>'s <a>fullscreen element</a>, | ||
| <a>exit fullscreen</a> that <a for=/>document</a>. | ||
| <a>exit fullscreen</a> that <a for=/>document</a> with the <var>fully flag</var> unset. |
There was a problem hiding this comment.
I would prefer fullyFlag throughout.
| <li><p>For each <var>exitDoc</var> in <var>exitDocs</var>, in order, | ||
| <a lt="unfullscreen an element">unfullscreen</a> <var>exitDoc</var>'s <a>fullscreen element</a>. | ||
| <li> | ||
| <p>For each <var>exitDoc</var> in <var>exitDocs</var>, in order: |
There was a problem hiding this comment.
We could make this use https://infra.spec.whatwg.org/#list-iterate and no longer have to say "in order", but could also do that later on.
| <a>node document</a> to <var>exitDocs</var>. | ||
| <!-- cross-process --> | ||
|
|
||
| <li><p>Let <var>descendantDocs</var> be an ordered set consisting of <var>doc</var>'s |
There was a problem hiding this comment.
I don't see how any doc in exitDocs may have any other iframe at all. If a document has more than one fullscreen element in the top layer, it shouldn't be included in the result from collect documents to unfullscreen. If a document has changed its fullscreen element to another single element, this document should have exited fullscreen state, so these steps should early return in the first substep you added. Since everything is invoked synchronously, I don't see what the problem is here.
Am I missing something?
|
|
||
| <li><p>If <var>resize</var> is true, then: while <var>exitDocs</var>'s last <a for=/>document</a> | ||
| has a <a>browsing context container</a>, append that <a>browsing context container</a>'s | ||
| <a>node document</a> to <var>exitDocs</var>. |
There was a problem hiding this comment.
This would not work, because we only call unfullscreen an element on documents in exitDocs.
|
Sorry for leaving this sitting for so long, I was fighting fullscreen regressions and being distracted. This will probably need some tweaking after we agree on some change (or not) in #74 so I'll leave this sitting and ping again when it's ready for review again. |
d12a7a7 to
ad3fa8e
Compare
|
I have reworked and rebased this on top of #81, which gets rid of some of the changes I had. It's not really possible to write tests for "fully exit fullscreen" with web-exposed APIs currently AFAIK, I have two tests in Blink that depend on something funny about window.open that I don't think is per spec. So, I think testing the algorithm is blocked on #70 and will file a wpt issue about missing test coverage. |
|
@upsuper, can you give this another look? On top of this I have a WIP change to revamp how animation frame tasks are used to solve #74, which I need to resolve in order to try relanding https://crbug.com/402376. |
|
(Only review the second commit, and I'll rebase once #81 is merged.) |
ad3fa8e to
56ed645
Compare
Partial test for whatwg/fullscreen#65. Other "fully exit" cases are tracked by #5883.
|
|
||
| <p>Whenever the <a>unloading document cleanup steps</a> run with a <var>document</var>, | ||
| <a>fully exit fullscreen</a> <var>document</var>. | ||
| <a>exit fullscreen</a> <var>document</var> with <var>fullyFlag</var> set. |
There was a problem hiding this comment.
I've realized this is actually a bit broken. Exit fullscreen is async and recursive, and
- The async bit means that things should happen to the document after the resize, when it's (probably) already not the active document. In particular, events should be fired, that aren't fired in at least Firefox in Add a test for fully exiting fullscreen due to navigation web-platform-tests/wpt#5887
- https://html.spec.whatwg.org/multipage/browsers.html#unload-a-document itself recurses into descendant browsing contexts, so there would be more exiting going on than necessary.
I think it would actually be best to just unfullcreen the document with no events at all here, and will change the PR to do that.
There was a problem hiding this comment.
Sigh, no, that doesn't work either. I've filed #82 and ask to declare this out of scope for this refactoring.
The previous definition of fully exit fullscreen could unfullscreen elements in top layer synchronously. If those elements were iframes, the contentDocument would get handled in a following animation frame task, leaving everything in an odd state in the interim. Exposing the concept of fully exiting to scripts is a separate issue: #70
|
This issue would actually become moot with #91, because then it's impossible for an iframe to be anything except the topmost fullscreen element in top layer. |
56ed645 to
9330439
Compare
|
Closing, after #128 and related discussion I don't think we'll do this. |
The previous definition of fully exit fullscreen could unfullscreen
elements in top layer synchronously. If those elements were iframes,
the contentDocument would get handled in a following animation frame
task, leaving everything in an odd state in the interim.
Exposing the concept of fully exiting to scripts is #70.
Preview | Diff