Bug 1191148 - Don't count fullscreen request handled if we don't change the document state. r=smaug
authorXidorn Quan <quanxunzhen@gmail.com>
Thu, 06 Aug 2015 15:37:48 +1000
changeset 288149 dde1881bc8513bc5c81d3d5cdf09c76563b8b743
parent 288148 70a60348507ef8af0e6eee965cfc183b8ed0e2bf
child 288150 252814d5e628bdf69b1ecfd799fd94e44c1dd56f
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1191148
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1191148 - Don't count fullscreen request handled if we don't change the document state. r=smaug
dom/base/nsDocument.cpp
dom/base/nsDocument.h
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -11645,18 +11645,19 @@ nsIDocument::HandlePendingFullscreenRequ
     return true;
   }
   nsCOMPtr<nsIDocShellTreeItem> rootShell;
   shell->GetRootTreeItem(getter_AddRefs(rootShell));
   if (rootShell != aRootShell) {
     return false;
   }
 
-  doc->ApplyFullscreen(aRequest);
-  *aHandled = true;
+  if (doc->ApplyFullscreen(aRequest)) {
+    *aHandled = true;
+  }
   return true;
 }
 
 /* static */ bool
 nsIDocument::HandlePendingFullscreenRequests(nsIDocument* aDoc)
 {
   if (sPendingFullscreenRequests.isEmpty()) {
     return false;
@@ -11707,22 +11708,22 @@ ClearPendingFullscreenRequests(nsIDocume
       request = request->getNext();
       delete thisRequest;
     } else {
       request = request->getNext();
     }
   }
 }
 
-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
   // to detect if the origin which is fullscreen has changed.
   nsCOMPtr<nsIDocument> previousFullscreenDoc = GetFullscreenLeaf(this);
 
   // Stores a list of documents which we must dispatch "mozfullscreenchange"
   // too. We're required by the spec to dispatch the events in root-to-leaf
@@ -11808,16 +11809,17 @@ nsDocument::ApplyFullscreen(const Fullsc
   }
 
   // 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]);
   }
+  return true;
 }
 
 NS_IMETHODIMP
 nsDocument::GetMozFullScreenElement(nsIDOMElement **aFullScreenElement)
 {
   ErrorResult rv;
   Element* el = GetMozFullScreenElement(rv);
   if (rv.Failed()) {
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -1524,18 +1524,20 @@ protected:
 
   explicit nsDocument(const char* aContentType);
   virtual ~nsDocument();
 
   void EnsureOnloadBlocker();
 
   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<nsIObserver*> mCharSetObservers;
 
   PLDHashTable *mSubDocuments;
 
   // Array of owning references to all children
   nsAttrAndChildArray mChildren;