New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fire events at elements by default, falling back to documents #90
Conversation
Should these be composed? I guess not? We sort of decided to only do that for UI events iirc. |
If not then the events won't reach the document, right? |
When dispatched inside a shadow tree, yes. @scheib you might also be interested in this change proposal as Pointer Lock mimics Fullscreen quite a bit. cc @hayatoito |
@annevk, is there a generic reason to prefer not using composed events? And cc @TakayoshiKochi who's done work in Blink to make fullscreen work with shadow trees. |
I don't think we ever arrived at a hard-and-fast rule that works. It might actually make sense here to "escape" the shadow tree though as it affects the whole document. It's not signifying a local change. That does mean you need to change the PR, as by default composed is false. |
cecc3e8
to
228cbef
Compare
I've pushed a new commit that gives both events the same treatment. I'll now see about tests for that. |
228cbef
to
5ac2091
Compare
This and the tests are ready for review. I was going to add I went with only adding them to |
Should we note that this is intentionally different from DocumentAndElementEventHandlers? Perhaps in a comment in the source? |
If we want to do this, we should pull back hierarchy restriction first. Before we do this, I'd like to ask if anyone recalls why it is currently fired on the document? It seems to me the initial proposal from roc was to dispatch it to the element, and I don't find any mention of why Gecko doesn't follow that way in the bug of the initial impl of this API. Probably the current spec largely follows how Gecko is implemented, and it was just a history mistake to fire on document? |
Sure, I can do that.
I imagine @rocallahan is busy debugging, but maybe he still remembers? |
I don't remember. Chris Pearce might know. It might have just been to simplify things by avoiding the special-casing for elements not in a document. |
@cpearce, do you have any additional insights here? I think that even with the original reasoning shrouded in mystery, we should be able to move forward here, as long as @upsuper things a new model could work out for Gecko. (No guarantees possible, if things break left and right we could go back to targeting the document again.) |
That's #91, but does it need to block this change? I think that with or without hierarchy restrictions, fullscreenchange events can bubble through elements that both are and are not in top layer, so one has to look at the event target. I'm in no hurry to get rid of the hierarchy restrictions in Blink, but would it be unworkable to not have them? (As you can tell, I'm conflicted.) |
Given your change here, probably no. I was thinking about firing an event for each fullscreen element in top layer for exiting fullscreen, which would be a breaking change. But it seems your change here only fires event for the top fullscreen element, which is fine with or without hierarchy restriction, although without hierarchy restriction, you would not be able to guarantee to have all fullscreen elements get the event. |
I think it's as @rocallahan mentions; we exit fullscreen when the fullscreen element is removed from the document, and if the target for fullscreenchange is the fullscreen element then the event can't bubble, so you need to special case (as I see you have in your PR). |
f0b7d5c
to
c186c6e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
I especially wanted to check whether it would work when we are removing element, and it seems even if an element is being removed, it can still be the fullscreen element of the document until the window gets unfullscreened, which is probably fine, so that the rest steps of unfullscreen document would work as normal.
@annevk do you see any other issue in this change?
Thanks for pinging me re: Pointer Lock, @annevk . I don't see a problem with this change, and agree that Pointer Lock should follow. I've filed an issue to pointer lock w3c/pointerlock#21 |
I have another PR that's based on this, so I'll go ahead and merge, and make sure tests are merged soonish as well. |
… the spec" This relands https://codereview.chromium.org/2573773002/, which was reverted in https://codereview.chromium.org/2654083006/. Relevant spec changes since December 2016: * whatwg/fullscreen#68 * whatwg/fullscreen#72 * whatwg/fullscreen#85 * whatwg/fullscreen#87 * whatwg/fullscreen#90 * whatwg/fullscreen#92 Updated tests for whatwg/fullscreen#92: * document-exit-fullscreen-nested-manual.html asserts that fullscreenElement changes are not synchronous. * document-exit-fullscreen-timing-manual.html and element-request-fullscreen-timing-manual.html assert that fullscreenElement changes before the resize event. (They still fail in content_shell because there is no resize, but pass in chromium if run manually.) * element-request-fullscreen-and-exit-iframe-manual.html asserts that the order of "run the fullscreen steps" (firing events) is now frame tree order. Bug: 402376 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Change-Id: I9c01b237ecfd7d74b28e3dbafcacdefe43416cdf Reviewed-on: https://chromium-review.googlesource.com/521162 Reviewed-by: Mounir Lamouri <mlamouri@chromium.org> Reviewed-by: John Mellor <johnme@chromium.org> Reviewed-by: Alex Moshchuk <alexmos@chromium.org> Reviewed-by: Emil A Eklund <eae@chromium.org> Cr-Commit-Position: refs/heads/master@{#480702} WPT-Export-Revision: 26d298d134b1407ffb035481dea00e95e66a4de9
… the spec" This relands https://codereview.chromium.org/2573773002/, which was reverted in https://codereview.chromium.org/2654083006/. Relevant spec changes since December 2016: * whatwg/fullscreen#68 * whatwg/fullscreen#72 * whatwg/fullscreen#85 * whatwg/fullscreen#87 * whatwg/fullscreen#90 * whatwg/fullscreen#92 Updated tests for whatwg/fullscreen#92: * document-exit-fullscreen-nested-manual.html asserts that fullscreenElement changes are not synchronous. * document-exit-fullscreen-timing-manual.html and element-request-fullscreen-timing-manual.html assert that fullscreenElement changes before the resize event. (They still fail in content_shell because there is no resize, but pass in chromium if run manually.) * element-request-fullscreen-and-exit-iframe-manual.html asserts that the order of "run the fullscreen steps" (firing events) is now frame tree order. Bug: 402376 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Change-Id: I9c01b237ecfd7d74b28e3dbafcacdefe43416cdf Reviewed-on: https://chromium-review.googlesource.com/521162 Reviewed-by: Mounir Lamouri <mlamouri@chromium.org> Reviewed-by: John Mellor <johnme@chromium.org> Reviewed-by: Alex Moshchuk <alexmos@chromium.org> Reviewed-by: Emil A Eklund <eae@chromium.org> Cr-Commit-Position: refs/heads/master@{#480702} WPT-Export-Revision: 26d298d134b1407ffb035481dea00e95e66a4de9
… the spec" This relands https://codereview.chromium.org/2573773002/, which was reverted in https://codereview.chromium.org/2654083006/. Relevant spec changes since December 2016: * whatwg/fullscreen#68 * whatwg/fullscreen#72 * whatwg/fullscreen#85 * whatwg/fullscreen#87 * whatwg/fullscreen#90 * whatwg/fullscreen#92 Updated tests for whatwg/fullscreen#92: * document-exit-fullscreen-nested-manual.html asserts that fullscreenElement changes are not synchronous. * document-exit-fullscreen-timing-manual.html and element-request-fullscreen-timing-manual.html assert that fullscreenElement changes before the resize event. (They still fail in content_shell because there is no resize, but pass in chromium if run manually.) * element-request-fullscreen-and-exit-iframe-manual.html asserts that the order of "run the fullscreen steps" (firing events) is now frame tree order. Bug: 402376 Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Change-Id: I9c01b237ecfd7d74b28e3dbafcacdefe43416cdf Reviewed-on: https://chromium-review.googlesource.com/521162 Commit-Queue: Philip Jägenstedt <foolip@chromium.org> Reviewed-by: Mounir Lamouri <mlamouri@chromium.org> Reviewed-by: John Mellor <johnme@chromium.org> Reviewed-by: Alex Moshchuk <alexmos@chromium.org> Reviewed-by: Emil A Eklund <eae@chromium.org> Cr-Commit-Position: refs/heads/master@{#480862}
Fixes #89.
Tests: web-platform-tests/wpt#6017
Preview | Diff