Bug 1216049 part 2 - Remove Element::IsFullScreenAncestor() and replace its trivial callsites. r?smaug draft
authorXidorn Quan <me@upsuper.org>
Wed, 29 Jun 2016 16:12:21 +1000
changeset 382249 f15138055e80688ea8a1bd528374e1c8055b7633
parent 382248 283dc22bbd06507620bf50743ad25077156066f0
child 382250 1291fd5e5df9c2e16df196f09a50eef6337c6b49
push id21673
push userxquan@mozilla.com
push dateWed, 29 Jun 2016 12:14:27 +0000
reviewerssmaug
bugs1216049
milestone50.0a1
Bug 1216049 part 2 - Remove Element::IsFullScreenAncestor() and replace its trivial callsites. r?smaug MozReview-Commit-ID: F46GXziXTIR
dom/base/Element.h
dom/base/nsDocument.cpp
--- a/dom/base/Element.h
+++ b/dom/base/Element.h
@@ -188,25 +188,16 @@ public:
   void UpdateState(bool aNotify);
 
   /**
    * Method to update mState with link state information.  This does not notify.
    */
   void UpdateLinkState(EventStates aState);
 
   /**
-   * Returns true if this element is either a full-screen element or an
-   * ancestor of the full-screen element.
-   */
-  bool IsFullScreenAncestor() const {
-    return mState.HasAtLeastOneOfStates(NS_EVENT_STATE_FULL_SCREEN_ANCESTOR |
-                                        NS_EVENT_STATE_FULL_SCREEN);
-  }
-
-  /**
    * The style state of this element. This is the real state of the element
    * with any style locks applied for pseudo-class inspecting.
    */
   EventStates StyleState() const
   {
     if (!HasLockedStyleStates()) {
       return mState;
     }
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -11647,17 +11647,17 @@ nsDocument::FullScreenStackPop()
   mFullScreenStack.RemoveElementAt(last);
 
   // Pop from the stack null elements (references to elements which have
   // been GC'd since they were added to the stack) and elements which are
   // no longer in this document.
   while (!mFullScreenStack.IsEmpty()) {
     Element* element = FullScreenStackTop();
     if (!element || !element->IsInUncomposedDoc() || element->OwnerDoc() != this) {
-      NS_ASSERTION(!element->IsFullScreenAncestor(),
+      NS_ASSERTION(!element->State().HasState(NS_EVENT_STATE_FULL_SCREEN),
                    "Should have already removed full-screen styles");
       uint32_t last = mFullScreenStack.Length() - 1;
       mFullScreenStack.RemoveElementAt(last);
     } else {
       // The top element of the stack is now an in-doc element. Return here.
       break;
     }
   }
@@ -12209,17 +12209,17 @@ nsDocument::GetMozFullScreenElement(nsID
   return NS_OK;
 }
 
 Element*
 nsDocument::GetFullscreenElement()
 {
   Element* element = FullScreenStackTop();
   NS_ASSERTION(!element ||
-               element->IsFullScreenAncestor(),
+               element->State().HasState(NS_EVENT_STATE_FULL_SCREEN),
     "Fullscreen element should have fullscreen styles applied");
   return element;
 }
 
 NS_IMETHODIMP
 nsDocument::GetMozFullScreen(bool *aFullScreen)
 {
   *aFullScreen = Fullscreen();