Skip to content
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

Merged
merged 1 commit into from May 31, 2017

Conversation

foolip
Copy link
Member

@foolip foolip commented May 18, 2017

@annevk
Copy link
Member

annevk commented May 18, 2017

Should these be composed? I guess not? We sort of decided to only do that for UI events iirc.

@foolip
Copy link
Member Author

foolip commented May 18, 2017

If not then the events won't reach the document, right?

@annevk
Copy link
Member

annevk commented May 19, 2017

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

@foolip
Copy link
Member Author

foolip commented May 19, 2017

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

@annevk
Copy link
Member

annevk commented May 19, 2017

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.

@foolip foolip force-pushed the fullscreenchange-event-target branch from cecc3e8 to 228cbef Compare May 19, 2017 15:08
@foolip foolip changed the title Fire fullscreenchange at elements by default, documents if necessary Fire events at elements by default, falling back to documents May 19, 2017
@foolip
Copy link
Member Author

foolip commented May 19, 2017

I've pushed a new commit that gives both events the same treatment. I'll now see about tests for that.

@foolip
Copy link
Member Author

foolip commented May 22, 2017

This and the tests are ready for review.

I was going to add onfullscreenchange and onfullscreenerror to GlobalEventHandlers, but that doesn't add them to ShadowRoot. Other such cases in HTML also have event handler content attribute, but requestFullscreen() isn't limited to HTML elements.

I went with only adding them to Element, which matches the webkit-prefixed ones.

@foolip foolip requested a review from upsuper May 22, 2017 11:43
@annevk
Copy link
Member

annevk commented May 22, 2017

Should we note that this is intentionally different from DocumentAndElementEventHandlers? Perhaps in a comment in the source?

@upsuper
Copy link
Member

upsuper commented May 22, 2017

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?

@foolip
Copy link
Member Author

foolip commented May 22, 2017

If we want to do this, we should pull back hierarchy restriction first.

Sure, I can do that.

Before we do this, I'd like to ask if anyone recalls why it is currently fired on the document?

I imagine @rocallahan is busy debugging, but maybe he still remembers?

@rocallahan
Copy link

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.

@foolip
Copy link
Member Author

foolip commented May 22, 2017

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

@foolip
Copy link
Member Author

foolip commented May 23, 2017

If we want to do this, we should pull back hierarchy restriction first.

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

@upsuper
Copy link
Member

upsuper commented May 24, 2017

That's #91, but does it need to block this change?

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.

@cpearce
Copy link

cpearce commented May 24, 2017

@cpearce, do you have any additional insights here?

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

@foolip
Copy link
Member Author

foolip commented May 24, 2017

Thanks @cpearce!

@upsuper @annevk, at your convenience, could you review this and the tests?

@foolip foolip force-pushed the fullscreenchange-event-target branch from f0b7d5c to c186c6e Compare May 24, 2017 08:12
foolip added a commit to web-platform-tests/wpt that referenced this pull request May 24, 2017
Copy link
Member

@upsuper upsuper left a 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?

@scheib
Copy link

scheib commented May 31, 2017

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

@foolip
Copy link
Member Author

foolip commented May 31, 2017

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.

@foolip foolip merged commit 1b2fac9 into master May 31, 2017
@foolip foolip deleted the fullscreenchange-event-target branch May 31, 2017 08:59
foolip added a commit to web-platform-tests/wpt that referenced this pull request Jun 1, 2017
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 20, 2017
… 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
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 20, 2017
… 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
MXEBot pushed a commit to mirror/chromium that referenced this pull request Jun 21, 2017
… 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}
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.

None yet

6 participants