From 0e522bae44251d9b205ba857e157228d5564bfcf Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Thu, 2 Jul 2015 19:12:31 +1000 Subject: [PATCH] Bug 1168705 part 2 - Move fullscreenchange event to be triggered after the related chrome events. r=smaug --HG-- extra : source : 0d125f8a263647ad6fdf4675d4f3ad8c511fc9f4 --- dom/base/nsDocument.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index ad32a6963fa8..f0ff1db887b2 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -11823,13 +11823,6 @@ nsDocument::ApplyFullscreen(const FullscreenRequest& aRequest) } } - // Dispatch "mozfullscreenchange" events. Note this loop is in reverse - // order so that the events for the root document arrives before the leaf - // document, as required by the spec. - for (uint32_t i = 0; i < changed.Length(); ++i) { - DispatchFullScreenChange(changed[changed.Length() - i - 1]); - } - // If this document hasn't already been approved in this session, // check to see if the user has granted the fullscreen access // to the document's principal's host, if it has one. Note that documents @@ -11842,6 +11835,8 @@ nsDocument::ApplyFullscreen(const FullscreenRequest& aRequest) nsContentUtils::IsSitePermAllow(NodePrincipal(), "fullscreen"); } + FullscreenRoots::Add(this); + // If it is the first entry of the fullscreen, trigger an event so // that the UI can response to this change, e.g. hide chrome, or // notifying parent process to enter fullscreen. Note that chrome @@ -11871,7 +11866,12 @@ nsDocument::ApplyFullscreen(const FullscreenRequest& aRequest) asyncDispatcher->PostDOMEvent(); } - FullscreenRoots::Add(this); + // Dispatch "mozfullscreenchange" events. Note this loop is in reverse + // order so that the events for the root document arrives before the leaf + // document, as required by the spec. + for (uint32_t i = 0; i < changed.Length(); ++i) { + DispatchFullScreenChange(changed[changed.Length() - i - 1]); + } } NS_IMETHODIMP