Skip to content

Give "exit fullscreen" a fully flag and define "fully exit fullscreen" using it#65

Closed
foolip wants to merge 1 commit into
masterfrom
fully-exit-fullscreen
Closed

Give "exit fullscreen" a fully flag and define "fully exit fullscreen" using it#65
foolip wants to merge 1 commit into
masterfrom
fully-exit-fullscreen

Conversation

@foolip

@foolip foolip commented Dec 14, 2016

Copy link
Copy Markdown
Member

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

@foolip

foolip commented Dec 14, 2016

Copy link
Copy Markdown
Member Author

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?

@annevk

annevk commented Dec 16, 2016

Copy link
Copy Markdown
Member

I guess it might be useful if you "own" the entire application stack. But what would this do inside an <iframe>? Would it actually fully exit?

@foolip

foolip commented Dec 16, 2016

Copy link
Copy Markdown
Member Author

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 iframe.contentDocument.exitFullscreen({ fully: true }) to exit all the way up?

@annevk

annevk commented Dec 16, 2016

Copy link
Copy Markdown
Member

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.

@foolip foolip requested review from annevk and upsuper December 16, 2016 09:19
Comment thread fullscreen.bs Outdated

<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:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remove "optional"?

Comment thread fullscreen.bs Outdated
<!-- 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

@foolip foolip Dec 16, 2016

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@foolip foolip force-pushed the fully-exit-fullscreen branch from 7aa47da to fd7d56d Compare December 16, 2016 11:38
@upsuper

upsuper commented Dec 19, 2016

Copy link
Copy Markdown
Member

Exposing the concept of fully exiting to scripts makes it easier to test, although this is not central to the change itself.

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.

@foolip foolip changed the title Define fully exit fullscreen in terms of exitFullscreen({ fully: true }) Give "exit fullscreen" a fully flag and define "fully exit fullscreen" using it Dec 19, 2016
@foolip foolip force-pushed the fully-exit-fullscreen branch from fd7d56d to d12a7a7 Compare January 4, 2017 14:16
@foolip

foolip commented Jan 4, 2017

Copy link
Copy Markdown
Member Author

I've now finished the changes and think they are ready for review. There is one existing problem that I'll comment on.

Comment thread fullscreen.bs Outdated
<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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@upsuper can probably answer the model question much better than I can.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The algorithm was changed in #72 and in #81 I've tried to make it clear what the return value of collect documents to unfullscreen means.

So, given no hierarchy restrictions I think that the problem remains, but I'm not going to try to tackle it in this PR.

Comment thread fullscreen.bs Outdated
<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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer fullyFlag throughout.

Comment thread fullscreen.bs Outdated
<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:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread fullscreen.bs Outdated
<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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Comment thread fullscreen.bs Outdated

<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>.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would not work, because we only call unfullscreen an element on documents in exitDocs.

@foolip

foolip commented Jan 27, 2017

Copy link
Copy Markdown
Member Author

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.

@foolip

foolip commented May 10, 2017

Copy link
Copy Markdown
Member Author

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.

@foolip

foolip commented May 10, 2017

Copy link
Copy Markdown
Member Author

@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.

@foolip

foolip commented May 10, 2017

Copy link
Copy Markdown
Member Author

(Only review the second commit, and I'll rebase once #81 is merged.)

@foolip foolip force-pushed the fully-exit-fullscreen branch from ad3fa8e to 56ed645 Compare May 11, 2017 08:06
foolip added a commit to web-platform-tests/wpt that referenced this pull request May 11, 2017
Partial test for whatwg/fullscreen#65.

Other "fully exit" cases are tracked by #5883.
Comment thread fullscreen.bs

<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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've realized this is actually a bit broken. Exit fullscreen is async and recursive, and

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@foolip

foolip commented May 24, 2017

Copy link
Copy Markdown
Member Author

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.

@foolip

foolip commented Aug 29, 2018

Copy link
Copy Markdown
Member Author

Closing, after #128 and related discussion I don't think we'll do this.

@foolip foolip closed this Aug 29, 2018
@foolip foolip deleted the fully-exit-fullscreen branch August 29, 2018 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants