Bug 1466897 - Rename nsIRootBox to nsIPopupContainer. r=mats draft
authorBrendan Dahl <brendan.dahl@gmail.com>
Tue, 26 Jun 2018 17:29:55 -0700
changeset 814587 d12bb5c2e5db081ba5333567a9d97a9942ba853b
parent 814586 13210c774e66b3153f92a789bc9e6d2ad3f89b67
push id115269
push userbmo:bdahl@mozilla.com
push dateThu, 05 Jul 2018 17:57:49 +0000
reviewersmats
bugs1466897
milestone63.0a1
Bug 1466897 - Rename nsIRootBox to nsIPopupContainer. r=mats MozReview-Commit-ID: D4GgReAEelG
dom/xul/XULPopupElement.cpp
layout/base/nsCSSFrameConstructor.cpp
layout/generic/nsCanvasFrame.cpp
layout/generic/nsCanvasFrame.h
layout/generic/nsFrameIdList.h
layout/xul/nsIPopupContainer.h
layout/xul/nsIRootBox.h
layout/xul/nsMenuPopupFrame.cpp
layout/xul/nsPopupSetFrame.cpp
layout/xul/nsRootBoxFrame.cpp
layout/xul/nsXULTooltipListener.cpp
--- a/dom/xul/XULPopupElement.cpp
+++ b/dom/xul/XULPopupElement.cpp
@@ -1,16 +1,15 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsCOMPtr.h"
-#include "nsIRootBox.h"
 #include "nsIPresShell.h"
 #include "nsIContent.h"
 #include "nsNameSpaceManager.h"
 #include "nsGkAtoms.h"
 #include "nsMenuPopupFrame.h"
 #include "nsView.h"
 #include "mozilla/AppUnits.h"
 #include "mozilla/dom/DOMRect.h"
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -101,17 +101,17 @@
 #include "nsTableWrapperFrame.h"
 #include "nsIScrollableFrame.h"
 #include "nsBackdropFrame.h"
 #include "nsTransitionManager.h"
 #include "DetailsFrame.h"
 #include "nsThemeConstants.h"
 
 #ifdef MOZ_XUL
-#include "nsIRootBox.h"
+#include "nsIPopupContainer.h"
 #endif
 #ifdef ACCESSIBILITY
 #include "nsAccessibilityService.h"
 #endif
 
 #include "nsXBLService.h"
 
 #undef NOISY_FIRST_LETTER
@@ -1049,19 +1049,20 @@ nsFrameConstructorState::nsFrameConstruc
     // block, use the abs-pos containing block's abs-pos list for fixed-pos
     // frames.
     mFixedPosIsAbsPos(aFixedContainingBlock == aAbsoluteContainingBlock),
     mHavePendingPopupgroup(false),
     mCreatingExtraFrames(false),
     mCurrentPendingBindingInsertionPoint(nullptr)
 {
 #ifdef MOZ_XUL
-  nsIRootBox* rootBox = nsIRootBox::GetRootBox(aPresShell);
-  if (rootBox) {
-    mPopupItems.containingBlock = rootBox->GetPopupSetFrame();
+  nsIPopupContainer* popupContainer =
+    nsIPopupContainer::GetPopupContainer(aPresShell);
+  if (popupContainer) {
+    mPopupItems.containingBlock = popupContainer->GetPopupSetFrame();
   }
 #endif
   MOZ_COUNT_CTOR(nsFrameConstructorState);
 }
 
 nsFrameConstructorState::nsFrameConstructorState(nsIPresShell* aPresShell,
                                                  nsContainerFrame* aFixedContainingBlock,
                                                  nsContainerFrame* aAbsoluteContainingBlock,
@@ -3982,19 +3983,19 @@ nsCSSFrameConstructor::ConstructFrameFro
                     allowOutOfFlow, allowOutOfFlow, isPopup);
 
     nsContainerFrame* newFrameAsContainer = do_QueryFrame(newFrame);
     if (newFrameAsContainer) {
 #ifdef MOZ_XUL
       // Icky XUL stuff, sadly
 
       if (aItem.mIsRootPopupgroup) {
-        NS_ASSERTION(nsIRootBox::GetRootBox(mPresShell) &&
-                     nsIRootBox::GetRootBox(mPresShell)->GetPopupSetFrame() ==
-                     newFrame,
+        NS_ASSERTION(nsIPopupContainer::GetPopupContainer(mPresShell) &&
+                     nsIPopupContainer::GetPopupContainer(mPresShell)->
+                      GetPopupSetFrame() == newFrame,
                      "Unexpected PopupSetFrame");
         aState.mPopupItems.containingBlock = newFrameAsContainer;
         aState.mHavePendingPopupgroup = false;
       }
 #endif /* MOZ_XUL */
 
       // Process the child content if requested
       nsFrameItems childItems;
@@ -9015,18 +9016,19 @@ nsCSSFrameConstructor::MaybeRecreateCont
     // Recreate frames for the flex container (the removed frame's grandparent)
     RecreateFramesForContent(parent->GetParent()->GetContent(),
                              InsertionKind::Async);
     return true;
   }
 
 #ifdef MOZ_XUL
   if (aFrame->IsPopupSetFrame()) {
-    nsIRootBox* rootBox = nsIRootBox::GetRootBox(mPresShell);
-    if (rootBox && rootBox->GetPopupSetFrame() == aFrame) {
+    nsIPopupContainer* popupContainer =
+      nsIPopupContainer::GetPopupContainer(mPresShell);
+    if (popupContainer && popupContainer->GetPopupSetFrame() == aFrame) {
       ReconstructDocElementHierarchy(InsertionKind::Async);
       return true;
     }
   }
 #endif
 
   // Reconstruct if inflowFrame is parent's only child, and parent is, or has,
   // a non-fluid continuation, i.e. it was split by bidi resolution
--- a/layout/generic/nsCanvasFrame.cpp
+++ b/layout/generic/nsCanvasFrame.cpp
@@ -48,17 +48,17 @@ NS_NewCanvasFrame(nsIPresShell* aPresShe
   return new (aPresShell) nsCanvasFrame(aStyle);
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsCanvasFrame)
 
 NS_QUERYFRAME_HEAD(nsCanvasFrame)
   NS_QUERYFRAME_ENTRY(nsCanvasFrame)
   NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
-  NS_QUERYFRAME_ENTRY(nsIRootBox)
+  NS_QUERYFRAME_ENTRY(nsIPopupContainer)
 NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
 
 void
 nsCanvasFrame::ShowCustomContentContainer()
 {
   if (mCustomContentContainer) {
     mCustomContentContainer->UnsetAttr(kNameSpaceID_None, nsGkAtoms::hidden, true);
   }
--- a/layout/generic/nsCanvasFrame.h
+++ b/layout/generic/nsCanvasFrame.h
@@ -8,17 +8,17 @@
 
 #ifndef nsCanvasFrame_h___
 #define nsCanvasFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "mozilla/EventForwards.h"
 #include "nsContainerFrame.h"
 #include "nsIScrollPositionListener.h"
-#include "nsIRootBox.h"
+#include "nsIPopupContainer.h"
 #include "nsDisplayList.h"
 #include "nsIAnonymousContentCreator.h"
 #include "gfxPrefs.h"
 
 class nsPresContext;
 class gfxContext;
 class nsPopupSetFrame;
 
@@ -29,17 +29,17 @@ class nsPopupSetFrame;
  * It only supports having a single child frame which must be an area
  * frame.
  * @note nsCanvasFrame keeps overflow container continuations of its child
  * frame in the main child list.
  */
 class nsCanvasFrame final : public nsContainerFrame,
                             public nsIScrollPositionListener,
                             public nsIAnonymousContentCreator,
-                            public nsIRootBox
+                            public nsIPopupContainer
 {
 public:
   explicit nsCanvasFrame(ComputedStyle* aStyle)
     : nsContainerFrame(aStyle, kClassID)
     , mDoPaintFocus(false)
     , mAddedScrollPositionListener(false)
     , mPopupSetFrame(nullptr)
   {}
--- a/layout/generic/nsFrameIdList.h
+++ b/layout/generic/nsFrameIdList.h
@@ -169,17 +169,17 @@ ABSTRACT_FRAME_ID(nsIComboboxControlFram
 ABSTRACT_FRAME_ID(nsIFormControlFrame)
 ABSTRACT_FRAME_ID(nsIFrameFrame)
 ABSTRACT_FRAME_ID(nsIListControlFrame)
 ABSTRACT_FRAME_ID(nsIMathMLFrame)
 ABSTRACT_FRAME_ID(nsIMenuFrame)
 ABSTRACT_FRAME_ID(nsIObjectFrame)
 ABSTRACT_FRAME_ID(nsIPageSequenceFrame)
 ABSTRACT_FRAME_ID(nsIPercentBSizeObserver)
-ABSTRACT_FRAME_ID(nsIRootBox)
+ABSTRACT_FRAME_ID(nsIPopupContainer)
 ABSTRACT_FRAME_ID(nsIScrollableFrame)
 ABSTRACT_FRAME_ID(nsIScrollbarMediator)
 ABSTRACT_FRAME_ID(nsISelectControlFrame)
 ABSTRACT_FRAME_ID(nsISVGSVGFrame)
 ABSTRACT_FRAME_ID(nsIStatefulFrame)
 ABSTRACT_FRAME_ID(nsITableCellLayout)
 ABSTRACT_FRAME_ID(nsITableLayout)
 ABSTRACT_FRAME_ID(nsITextControlFrame)
rename from layout/xul/nsIRootBox.h
rename to layout/xul/nsIPopupContainer.h
--- a/layout/xul/nsIRootBox.h
+++ b/layout/xul/nsIPopupContainer.h
@@ -1,37 +1,37 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 
-#ifndef nsIRootBox_h___
-#define nsIRootBox_h___
+#ifndef nsIPopupContainer_h___
+#define nsIPopupContainer_h___
 
 #include "nsQueryFrame.h"
 class nsPopupSetFrame;
 class nsIPresShell;
 class nsIContent;
 
 namespace mozilla {
 namespace dom {
 class Element;
 }
 }
 
-class nsIRootBox
+class nsIPopupContainer
 {
 public:
-  NS_DECL_QUERYFRAME_TARGET(nsIRootBox)
+  NS_DECL_QUERYFRAME_TARGET(nsIPopupContainer)
 
   virtual nsPopupSetFrame* GetPopupSetFrame() = 0;
   virtual void SetPopupSetFrame(nsPopupSetFrame* aPopupSet) = 0;
 
   virtual mozilla::dom::Element* GetDefaultTooltip() = 0;
   virtual void SetDefaultTooltip(mozilla::dom::Element* aTooltip) = 0;
 
-  static nsIRootBox* GetRootBox(nsIPresShell* aShell);
+  static nsIPopupContainer* GetPopupContainer(nsIPresShell* aShell);
 };
 
 #endif
 
--- a/layout/xul/nsMenuPopupFrame.cpp
+++ b/layout/xul/nsMenuPopupFrame.cpp
@@ -21,17 +21,17 @@
 #include "nsIDOMXULMenuListElement.h"
 #include "nsIPresShell.h"
 #include "nsFrameManager.h"
 #include "nsIDocument.h"
 #include "nsRect.h"
 #include "nsIComponentManager.h"
 #include "nsBoxLayoutState.h"
 #include "nsIScrollableFrame.h"
-#include "nsIRootBox.h"
+#include "nsIPopupContainer.h"
 #include "nsIDocShell.h"
 #include "nsReadableUtils.h"
 #include "nsUnicharUtils.h"
 #include "nsLayoutUtils.h"
 #include "nsContentUtils.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsPIWindowRoot.h"
 #include "nsIReflowCallback.h"
@@ -171,20 +171,20 @@ nsMenuPopupFrame::Init(nsIContent*      
   // the popup opens.
   if (!IsLeaf() && !ourView->HasWidget()) {
     CreateWidgetForView(ourView);
   }
 
   if (aContent->NodeInfo()->Equals(nsGkAtoms::tooltip, kNameSpaceID_XUL) &&
       aContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::_default,
                                          nsGkAtoms::_true, eIgnoreCase)) {
-    nsIRootBox* rootBox =
-      nsIRootBox::GetRootBox(PresContext()->GetPresShell());
-    if (rootBox) {
-      rootBox->SetDefaultTooltip(aContent->AsElement());
+    nsIPopupContainer* popupContainer =
+      nsIPopupContainer::GetPopupContainer(PresContext()->GetPresShell());
+    if (popupContainer) {
+      popupContainer->SetDefaultTooltip(aContent->AsElement());
     }
   }
 
   AddStateBits(NS_FRAME_IN_POPUP);
 }
 
 bool
 nsMenuPopupFrame::HasRemoteContent() const
@@ -2314,20 +2314,20 @@ nsMenuPopupFrame::DestroyFrom(nsIFrame* 
   }
 
   ClearPopupShownDispatcher();
 
   nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
   if (pm)
     pm->PopupDestroyed(this);
 
-  nsIRootBox* rootBox =
-    nsIRootBox::GetRootBox(PresContext()->GetPresShell());
-  if (rootBox && rootBox->GetDefaultTooltip() == mContent) {
-    rootBox->SetDefaultTooltip(nullptr);
+  nsIPopupContainer* popupContainer =
+    nsIPopupContainer::GetPopupContainer(PresContext()->GetPresShell());
+  if (popupContainer && popupContainer->GetDefaultTooltip() == mContent) {
+    popupContainer->SetDefaultTooltip(nullptr);
   }
 
   nsBoxFrame::DestroyFrom(aDestructRoot, aPostDestroyData);
 }
 
 
 void
 nsMenuPopupFrame::MoveTo(const CSSIntPoint& aPos, bool aUpdateAttrs)
--- a/layout/xul/nsPopupSetFrame.cpp
+++ b/layout/xul/nsPopupSetFrame.cpp
@@ -7,17 +7,17 @@
 #include "nsPopupSetFrame.h"
 #include "nsGkAtoms.h"
 #include "nsCOMPtr.h"
 #include "nsIContent.h"
 #include "nsPresContext.h"
 #include "mozilla/ComputedStyle.h"
 #include "nsBoxLayoutState.h"
 #include "nsIScrollableFrame.h"
-#include "nsIRootBox.h"
+#include "nsIPopupContainer.h"
 #include "nsMenuPopupFrame.h"
 
 nsIFrame*
 NS_NewPopupSetFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
 {
   return new (aPresShell) nsPopupSetFrame(aStyle);
 }
 
@@ -27,19 +27,20 @@ void
 nsPopupSetFrame::Init(nsIContent*       aContent,
                       nsContainerFrame* aParent,
                       nsIFrame*         aPrevInFlow)
 {
   nsBoxFrame::Init(aContent, aParent, aPrevInFlow);
 
   // Normally the root box is our grandparent, but in case of wrapping
   // it can be our great-grandparent.
-  nsIRootBox *rootBox = nsIRootBox::GetRootBox(PresContext()->GetPresShell());
-  if (rootBox) {
-    rootBox->SetPopupSetFrame(this);
+  nsIPopupContainer *popupContainer =
+    nsIPopupContainer::GetPopupContainer(PresContext()->GetPresShell());
+  if (popupContainer) {
+    popupContainer->SetPopupSetFrame(this);
   }
 }
 
 void
 nsPopupSetFrame::AppendFrames(ChildListID     aListID,
                               nsFrameList&    aFrameList)
 {
   if (aListID == kPopupList) {
@@ -103,19 +104,20 @@ nsPopupSetFrame::GetChildLists(nsTArray<
 
 void
 nsPopupSetFrame::DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData)
 {
   mPopupList.DestroyFramesFrom(aDestructRoot, aPostDestroyData);
 
   // Normally the root box is our grandparent, but in case of wrapping
   // it can be our great-grandparent.
-  nsIRootBox *rootBox = nsIRootBox::GetRootBox(PresContext()->GetPresShell());
-  if (rootBox) {
-    rootBox->SetPopupSetFrame(nullptr);
+  nsIPopupContainer *popupContainer =
+    nsIPopupContainer::GetPopupContainer(PresContext()->GetPresShell());
+  if (popupContainer) {
+    popupContainer->SetPopupSetFrame(nullptr);
   }
 
   nsBoxFrame::DestroyFrom(aDestructRoot, aPostDestroyData);
 }
 
 NS_IMETHODIMP
 nsPopupSetFrame::DoXULLayout(nsBoxLayoutState& aState)
 {
--- a/layout/xul/nsRootBoxFrame.cpp
+++ b/layout/xul/nsRootBoxFrame.cpp
@@ -5,57 +5,57 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsHTMLParts.h"
 #include "nsStyleConsts.h"
 #include "nsGkAtoms.h"
 #include "nsIPresShell.h"
 #include "nsBoxFrame.h"
 #include "nsStackLayout.h"
-#include "nsIRootBox.h"
+#include "nsIPopupContainer.h"
 #include "nsIContent.h"
 #include "nsFrameManager.h"
 #include "mozilla/BasicEvents.h"
 
 using namespace mozilla;
 
 // Interface IDs
 
 //#define DEBUG_REFLOW
 
 // static
-nsIRootBox*
-nsIRootBox::GetRootBox(nsIPresShell* aShell)
+nsIPopupContainer*
+nsIPopupContainer::GetPopupContainer(nsIPresShell* aShell)
 {
   if (!aShell) {
     return nullptr;
   }
   nsIFrame* rootFrame = aShell->GetRootFrame();
   if (!rootFrame) {
     return nullptr;
   }
 
   if (rootFrame) {
     rootFrame = rootFrame->PrincipalChildList().FirstChild();
   }
 
-  nsIRootBox* rootBox = do_QueryFrame(rootFrame);
+  nsIPopupContainer* rootBox = do_QueryFrame(rootFrame);
 
   // If the rootBox was not found yet this may be a top level non-XUL document.
   if (rootFrame && !rootBox) {
     // In a non-XUL document the rootFrame here will be a nsHTMLScrollFrame,
     // get the nsCanvasFrame (which is the popup container) from it.
     rootFrame = rootFrame->GetContentInsertionFrame();
     rootBox = do_QueryFrame(rootFrame);
   }
 
   return rootBox;
 }
 
-class nsRootBoxFrame final : public nsBoxFrame, public nsIRootBox
+class nsRootBoxFrame final : public nsBoxFrame, public nsIPopupContainer
 {
 public:
 
   friend nsIFrame* NS_NewBoxFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle);
 
   explicit nsRootBoxFrame(ComputedStyle* aStyle);
 
   NS_DECL_QUERYFRAME
@@ -243,17 +243,17 @@ nsRootBoxFrame::GetDefaultTooltip()
 
 void
 nsRootBoxFrame::SetDefaultTooltip(Element* aTooltip)
 {
   mDefaultTooltip = aTooltip;
 }
 
 NS_QUERYFRAME_HEAD(nsRootBoxFrame)
-  NS_QUERYFRAME_ENTRY(nsIRootBox)
+  NS_QUERYFRAME_ENTRY(nsIPopupContainer)
 NS_QUERYFRAME_TAIL_INHERITING(nsBoxFrame)
 
 #ifdef DEBUG_FRAME_DUMP
 nsresult
 nsRootBoxFrame::GetFrameName(nsAString& aResult) const
 {
   return MakeFrameName(NS_LITERAL_STRING("RootBox"), aResult);
 }
--- a/layout/xul/nsXULTooltipListener.cpp
+++ b/layout/xul/nsXULTooltipListener.cpp
@@ -16,17 +16,17 @@
 #ifdef MOZ_XUL
 #include "nsITreeView.h"
 #endif
 #include "nsIScriptContext.h"
 #include "nsPIDOMWindow.h"
 #ifdef MOZ_XUL
 #include "nsXULPopupManager.h"
 #endif
-#include "nsIRootBox.h"
+#include "nsIPopupContainer.h"
 #include "nsIBoxObject.h"
 #include "nsTreeColumns.h"
 #include "mozilla/ErrorResult.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/Event.h" // for Event
 #include "mozilla/dom/BoxObject.h"
@@ -579,19 +579,20 @@ nsXULTooltipListener::FindTooltip(nsICon
   }
 
   nsAutoString tooltipText;
   if (aTarget->IsElement()) {
     aTarget->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext, tooltipText);
   }
   if (!tooltipText.IsEmpty()) {
     // specifying tooltiptext means we will always use the default tooltip
-    nsIRootBox* rootBox = nsIRootBox::GetRootBox(document->GetShell());
-    NS_ENSURE_STATE(rootBox);
-    if (RefPtr<Element> tooltip = rootBox->GetDefaultTooltip()) {
+    nsIPopupContainer* popupContainer =
+      nsIPopupContainer::GetPopupContainer(document->GetShell());
+    NS_ENSURE_STATE(popupContainer);
+    if (RefPtr<Element> tooltip = popupContainer->GetDefaultTooltip()) {
       tooltip->SetAttr(kNameSpaceID_None, nsGkAtoms::label, tooltipText, true);
       tooltip.forget(aTooltip);
     }
     return NS_OK;
   }
 
   nsAutoString tooltipId;
   if (aTarget->IsElement()) {
@@ -620,19 +621,20 @@ nsXULTooltipListener::FindTooltip(nsICon
         return NS_OK;
       }
     }
   }
 
 #ifdef MOZ_XUL
   // titletips should just use the default tooltip
   if (mIsSourceTree && mNeedTitletip) {
-    nsIRootBox* rootBox = nsIRootBox::GetRootBox(document->GetShell());
-    NS_ENSURE_STATE(rootBox);
-    NS_IF_ADDREF(*aTooltip = rootBox->GetDefaultTooltip());
+    nsIPopupContainer* popupContainer =
+      nsIPopupContainer::GetPopupContainer(document->GetShell());
+    NS_ENSURE_STATE(popupContainer);
+    NS_IF_ADDREF(*aTooltip = popupContainer->GetDefaultTooltip());
   }
 #endif
 
   return NS_OK;
 }
 
 
 nsresult