From bf52d07f9d43fe46bcb29dc782d9e5c53af067b0 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Thu, 6 Aug 2015 15:37:48 +1000 Subject: [PATCH] Bug 1191148 - Don't count fullscreen request handled if we don't change the document state. r=smaug --HG-- extra : source : 33ad58fdc763e3c6d647b6aec100d2ab9d893316 --- dom/base/nsDocument.cpp | 10 ++++++---- dom/base/nsDocument.h | 6 ++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index d2620b598a62..dc2629582943 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -11650,8 +11650,9 @@ nsIDocument::HandlePendingFullscreenRequest(const FullscreenRequest& aRequest, return false; } - doc->ApplyFullscreen(aRequest); - *aHandled = true; + if (doc->ApplyFullscreen(aRequest)) { + *aHandled = true; + } return true; } @@ -11712,12 +11713,12 @@ ClearPendingFullscreenRequests(nsIDocument* aDoc) } } -void +bool nsDocument::ApplyFullscreen(const FullscreenRequest& aRequest) { Element* elem = aRequest.GetElement(); if (!FullscreenElementReadyCheck(elem, aRequest.mIsCallerChrome)) { - return; + return false; } // Stash a reference to any existing fullscreen doc, we'll use this later @@ -11813,6 +11814,7 @@ nsDocument::ApplyFullscreen(const FullscreenRequest& aRequest) for (uint32_t i = 0; i < changed.Length(); ++i) { DispatchFullScreenChange(changed[changed.Length() - i - 1]); } + return true; } NS_IMETHODIMP diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h index 1e64d95be47b..70407924635a 100644 --- a/dom/base/nsDocument.h +++ b/dom/base/nsDocument.h @@ -1529,8 +1529,10 @@ protected: void NotifyStyleSheetApplicableStateChanged(); - // Apply the fullscreen state to the document, and trigger related events. - void ApplyFullscreen(const FullscreenRequest& aRequest); + // Apply the fullscreen state to the document, and trigger related + // events. It returns false if the fullscreen element ready check + // fails and nothing gets changed. + bool ApplyFullscreen(const FullscreenRequest& aRequest); nsTArray mCharSetObservers;