Gecko:Fullscreen API: Difference between revisions

add e10s content
(small fix)
(add e10s content)
Line 19: Line 19:
=== Non-E10S ===
=== Non-E10S ===


For entering fullscreen:
==== Entering Fullscreen ====


# the page calls [https://fullscreen.spec.whatwg.org/#dom-element-requestfullscreen Element.requestFullscreen()] (Element::MozRequestFullScreen())
# the page calls Element.requestFullscreen() (Element::MozRequestFullScreen())
# ''(async)'' calls nsDocument::RequestFullscreen()
# ''(async)'' calls nsDocument::RequestFullscreen()
# calls nsGlobalWindow::SetFullScreenInternal()
# calls nsGlobalWindow::SetFullScreenInternal()
# calls widget to enter fullscreen
# calls widget to enter fullscreen
# ''(async)'' calls nsGlobalWindow::FinishFullscreenChange() <-- triggers when the window enters fullscreen
# ''(async)'' triggers nsGlobalWindow::FinishFullscreenChange() when the window enters fullscreen
# calls nsIDocument::HandlePendingFullscreenRequests()
# calls nsIDocument::HandlePendingFullscreenRequests()
# change the document state in nsDocument::ApplyFullscreen()
# change the document state in nsDocument::ApplyFullscreen()


For exiting fullscreen by page:
==== Exiting Fullscreen by Content ====


# the page calls [https://fullscreen.spec.whatwg.org/#dom-document-exitfullscreen document.exitFullscreen()] (nsDocument::MozCancelFullScreen())
# the page calls document.exitFullscreen() (nsDocument::MozCancelFullScreen())
# calls nsDocument::RestorePreviousFullScreenState()
# calls nsGlobalWindow::SetFullScreenInternal()
# calls nsGlobalWindow::SetFullScreenInternal()
# calls widget to leave fullscreen
# calls widget to leave fullscreen
# ''(async)'' calls nsGlobalWindow::FinishFullscreenChange() <-- triggers when the window exits fullscreen
# ''(async)'' triggers nsGlobalWindow::FinishFullscreenChange() when the window exits fullscreen
# calls nsIDocument::ExitFullscreenInDocTree() which changes the document state
# calls nsIDocument::ExitFullscreenInDocTree() which changes the document state


For exiting fullscreen by user (via escape key):
==== Exiting Fullscreen by User ====
 
(usually via escape key)


# in PresShell::HandleEventInternal()
# in PresShell::HandleEventInternal()
Line 44: Line 47:
# then same as above...
# then same as above...


For exiting fullscreen unexpectedly (page closure / fullscreen element removal):
==== Exiting Fullscreen Unexpectedly ====
 
(page closure / fullscreen element removal):


# in nsDocument::OnPageHide() (for page closure) / Element::UnbindFromTree() (for element removal)
# two cases:
#* for page closure, nsDocument::OnPageHide()  
#* for element removal, Element::UnbindFromTree()
# calls nsIDocument::ExitFullscreenInDocTree() which changes the document state
# calls nsIDocument::ExitFullscreenInDocTree() which changes the document state
# ''(may async)'' calls nsGlobalWindow::SetFullscreenInternal()
# ''(may async)'' calls nsGlobalWindow::SetFullscreenInternal()
Line 53: Line 60:
=== E10S ===
=== 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-fullScreen.js sends async message "DOMFullscreen:Exited"
# in the content process
## tab-content.js calls nsIDocument::ExitFullscreenInDocTree() which changes the document state


=== Browser Element ===
=== Browser Element ===
14

edits