Gecko:Fullscreen API: Difference between revisions
Jump to navigation
Jump to search
(update content for e10s) |
(→Exiting Fullscreen by Content: fixup) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 15: | Line 15: | ||
# insert fullscreen transition there. | # insert fullscreen transition there. | ||
The flow is different for non-e10s, e10s, and the browser element, because we need to go across the process boundary in later cases. | |||
Most of this part is implemented in [https://bugzilla.mozilla.org/show_bug.cgi?id=1161802 Bug 1161802]. | |||
=== Non-E10S === | === Non-E10S === | ||
Line 93: | Line 95: | ||
## calls nsIDocument::ExitFullscreenInDocTree() which changes the document state | ## calls nsIDocument::ExitFullscreenInDocTree() which changes the document state | ||
##* this step also dispatches '''MozDOMFullscreen:Exited''' to the chrome | ##* this step also dispatches '''MozDOMFullscreen:Exited''' to the chrome | ||
## browser- | ## browser-fullScreenAndPointerLock.js sends async message "DOMFullscreen:CleanUp" | ||
# in the content process | # in the content process | ||
## tab-content.js calls nsIDocument::ExitFullscreenInDocTree() which changes the document state | ## tab-content.js calls nsIDocument::ExitFullscreenInDocTree() which changes the document state | ||
Line 113: | Line 115: | ||
##* for element removal, Element::UnbindFromTree() | ##* for element removal, Element::UnbindFromTree() | ||
## calls nsIDocument::ExitFullscreenInDocTree() which changes the document state | ## calls nsIDocument::ExitFullscreenInDocTree() which changes the document state | ||
##* this step also dispatches '''MozDOMFullscreen:Exited''' to the chrome | ##* ''(may async)'' this step also dispatches '''MozDOMFullscreen:Exited''' to the chrome | ||
## tab-content.js sends async message "DOMFullscreen:Exit" | ## tab-content.js sends async message "DOMFullscreen:Exit" | ||
# in the parent process: | # in the parent process: | ||
Line 123: | Line 125: | ||
=== Browser Element === | === Browser Element === | ||
== Transition == | |||
This part is implemented in [https://bugzilla.mozilla.org/show_bug.cgi?id=1160014 Bug 1160014]. |
Latest revision as of 05:13, 26 September 2018
(WIP)
This page is for documenting our Fullscreen API implementation.
Resources
- Fullscreen API spec
- Fullscreen design from :Verdi also includes some background info
Basic Control Flow
The flow of how Fullscreen API works is a bit complicated because we want to change the state of the document after the window enters or leaves fullscreen, so that we can:
- provide a stable viewport size when we notify the content, and
- insert fullscreen transition there.
The flow is different for non-e10s, e10s, and the browser element, because we need to go across the process boundary in later cases.
Most of this part is implemented in Bug 1161802.
Non-E10S
Entering Fullscreen
- the page calls Element.requestFullscreen() (Element::MozRequestFullScreen())
- (async) calls nsDocument::RequestFullscreen()
- calls nsGlobalWindow::SetFullScreenInternal()
- calls widget to enter fullscreen
- (async) triggers nsGlobalWindow::FinishFullscreenChange() when the window enters fullscreen
- calls nsIDocument::HandlePendingFullscreenRequests()
- change the document state in nsDocument::ApplyFullscreen()
Exiting Fullscreen by Content
- the page calls document.exitFullscreen() (nsDocument::MozCancelFullScreen())
- calls nsDocument::RestorePreviousFullScreenState()
- calls nsGlobalWindow::SetFullScreenInternal()
- calls widget to leave fullscreen
- (async) triggers nsGlobalWindow::FinishFullscreenChange() when the window exits fullscreen
- calls nsIDocument::ExitFullscreenInDocTree() which changes the document state
Exiting Fullscreen by User
(usually via escape key)
- in PresShell::HandleEventInternal()
- calls nsIDocument::AsyncExitFullscreen()
- (async) calls nsGlobalWindow::SetFullscreenInternal()
- then same as above...
Exiting Fullscreen Unexpectedly
(page closure / navigation / fullscreen element removal)
- two cases:
- for page closure and navigation, nsDocument::OnPageHide()
- for element removal, Element::UnbindFromTree()
- calls nsIDocument::ExitFullscreenInDocTree() which changes the document state
- (may async) calls nsGlobalWindow::SetFullscreenInternal()
- calls widget to leave fullscreen
E10S
Entering Fullscreen
- in the content process:
- the page calls Element.requestFullscreen() (Element::MozRequestFullScreen())
- (async) calls nsDocument::RequestFullscreen()
- dispatches MozDOMFullscreen:Request event to the chrome
- tab-content.js sends async message "DOMFullscreen:Request"
- in the parent process:
- browser-fullScreen.js calls nsDocument::RequestFullscreen()
- calls nsGlobalWindow::SetFullScreenInternal()
- calls widget to enter fullscreen
- (async) triggers nsGlobalWindow::FinishFullscreenChange() when the window enters fullscreen
- calls nsIDocument::HandlePendingFullscreenRequests()
- change the document state in nsDocument::ApplyFullscreen()
- this step also dispatches MozDOMFullscreen:Entered to the chrome
- browser-fullScreen.js sends async message "DOMFullscreen:Entered"
- in the content process
- tab-content.js calls nsIDocument::HandlePendingFullscreenRequests()
- change the document state in nsDocument::ApplyFullscreen()
Exiting Fullscreen by Content
- in the content process:
- the page calls document.exitFullscreen() (nsDocument::MozCancelFullScreen())
- dispatches MozDOMFullscreen:Exit event to the chrome
- tab-content.js sends async message "DOMFullscreen:Exit"
- in the parent process:
- browser-fullScreen.js calls nsDocument::RestorePreviousFullScreenState()
- calls nsGlobalWindow::SetFullScreenInternal()
- calls widget to leave fullscreen
- (async) triggers nsGlobalWindow::FinishFullscreenChange() when the window exits fullscreen
- calls nsIDocument::ExitFullscreenInDocTree() which changes the document state
- this step also dispatches MozDOMFullscreen:Exited to the chrome
- browser-fullScreenAndPointerLock.js sends async message "DOMFullscreen:CleanUp"
- in the content process
- tab-content.js calls nsIDocument::ExitFullscreenInDocTree() which changes the document state
Exiting Fullscreen by User
Since user always uses the chrome to exit fullscreen
- The parent process part is the same as Non-E10S / Exiting Fullscreen by User
- The content process only has the last step in E10S / Exiting Fullscreen by Content above
Exiting Fullscreen Unexpectedly
(navigation / fullscreen element removal)
- in the content process:
- two cases:
- for navigation, nsDocument::OnPageHide()
- for element removal, Element::UnbindFromTree()
- calls nsIDocument::ExitFullscreenInDocTree() which changes the document state
- (may async) this step also dispatches MozDOMFullscreen:Exited to the chrome
- tab-content.js sends async message "DOMFullscreen:Exit"
- two cases:
- in the parent process:
- browser-fullScreen.js calls nsDocument::RestorePreviousFullScreenState()
- calls nsGlobalWindow::SetFullScreenInternal()
- calls widget to leave fullscreen
- (async) triggers nsGlobalWindow::FinishFullscreenChange() when the window exits fullscreen
- calls nsIDocument::ExitFullscreenInDocTree() which changes the document state
Browser Element
Transition
This part is implemented in Bug 1160014.