Bug 579323. Part 1.4: Switch nsIFrameFrame users to use nsSubDocumentFrame.h. r=tnikkel
authorRobert O'Callahan <robert@ocallahan.org>
Tue, 31 Aug 2010 12:49:07 +1200
changeset 51754 248e40d56e0bf4c64b8386702f888f9fae37d268
parent 51753 6e0627df88ba0a2bd866cb7bd0c03d3404b2433a
child 51755 b002a8eb529f574d4ab07790510a15e5071c8cd2
push idunknown
push userunknown
push dateunknown
reviewerstnikkel
bugs579323
milestone2.0b5pre
Bug 579323. Part 1.4: Switch nsIFrameFrame users to use nsSubDocumentFrame.h. r=tnikkel
content/base/src/nsFrameLoader.cpp
content/base/src/nsFrameLoader.h
content/events/src/nsEventStateManager.cpp
layout/base/FrameLayerBuilder.cpp
layout/generic/Makefile.in
layout/generic/nsFrameFrame.cpp
layout/generic/nsSubDocumentFrame.h
layout/xul/base/src/nsContainerBoxObject.cpp
--- a/content/base/src/nsFrameLoader.cpp
+++ b/content/base/src/nsFrameLoader.cpp
@@ -79,17 +79,17 @@
 #include "nsIJSContextStack.h"
 #include "nsUnicharUtils.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIScrollable.h"
 #include "nsFrameLoader.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIFrame.h"
-#include "nsIFrameFrame.h"
+#include "nsSubDocumentFrame.h"
 #include "nsDOMError.h"
 #include "nsGUIEvent.h"
 #include "nsEventDispatcher.h"
 #include "nsISHistory.h"
 #include "nsISHistoryInternal.h"
 #include "nsIDocShellHistory.h"
 #include "nsIDOMNSHTMLDocument.h"
 #include "nsIXULWindow.h"
@@ -640,17 +640,17 @@ class NS_STACK_CLASS AutoResetInShow {
     }
     ~AutoResetInShow() { mFrameLoader->mInShow = PR_FALSE; }
 };
 
 
 PRBool
 nsFrameLoader::Show(PRInt32 marginWidth, PRInt32 marginHeight,
                     PRInt32 scrollbarPrefX, PRInt32 scrollbarPrefY,
-                    nsIFrameFrame* frame)
+                    nsSubDocumentFrame* frame)
 {
   if (mInShow) {
     return PR_FALSE;
   }
   // Reset mInShow if we exit early.
   AutoResetInShow resetInShow(this);
   mInShow = PR_TRUE;
 
@@ -749,30 +749,30 @@ nsFrameLoader::Show(PRInt32 marginWidth,
     Hide();
     return PR_FALSE;
   }
   return PR_TRUE;
 }
 
 #ifdef MOZ_IPC
 bool
-nsFrameLoader::ShowRemoteFrame(nsIFrameFrame* frame, nsIView* view)
+nsFrameLoader::ShowRemoteFrame(nsSubDocumentFrame* frame, nsIView* view)
 {
   NS_ASSERTION(mRemoteFrame, "ShowRemote only makes sense on remote frames.");
 
   if (!mRemoteBrowser) {
     TryNewProcess();
   }
 
   if (!mRemoteBrowser) {
     NS_ERROR("Couldn't create child process.");
     return false;
   }
 
-  nsIntSize size = GetSubDocumentSize(frame->GetFrame());
+  nsIntSize size = GetSubDocumentSize(frame);
 
   // Painting with shared memory
   if (!mRemoteBrowser->SendCreateWidget(0))
     return false;
 
   mRemoteBrowser->Move(0, 0, size.width, size.height);
   mRemoteWidgetCreated = PR_TRUE;
   nsCOMPtr<nsIChromeFrameMessageManager> dummy;
@@ -980,17 +980,17 @@ nsFrameLoader::SwapWithOtherLoader(nsFra
   nsIFrame* otherFrame = otherContent->GetPrimaryFrame();
   if (!ourFrame || !otherFrame) {
     mInSwap = aOther->mInSwap = PR_FALSE;
     FirePageShowEvent(ourTreeItem, ourChromeEventHandler, PR_TRUE);
     FirePageShowEvent(otherTreeItem, otherChromeEventHandler, PR_TRUE);
     return NS_ERROR_NOT_IMPLEMENTED;
   }
 
-  nsIFrameFrame* ourFrameFrame = do_QueryFrame(ourFrame);
+  nsSubDocumentFrame* ourFrameFrame = do_QueryFrame(ourFrame);
   if (!ourFrameFrame) {
     mInSwap = aOther->mInSwap = PR_FALSE;
     FirePageShowEvent(ourTreeItem, ourChromeEventHandler, PR_TRUE);
     FirePageShowEvent(otherTreeItem, otherChromeEventHandler, PR_TRUE);
     return NS_ERROR_NOT_IMPLEMENTED;
   }
 
   // OK.  First begin to swap the docshells in the two nsIFrames
--- a/content/base/src/nsFrameLoader.h
+++ b/content/base/src/nsFrameLoader.h
@@ -49,17 +49,17 @@
 #include "nsIFrameLoader.h"
 #include "nsSize.h"
 #include "nsIURI.h"
 #include "nsAutoPtr.h"
 #include "nsFrameMessageManager.h"
 
 class nsIContent;
 class nsIURI;
-class nsIFrameFrame;
+class nsSubDocumentFrame;
 class nsIView;
 class nsIInProcessContentFrameMessageManager;
 class AutoResetInShow;
 
 #ifdef MOZ_IPC
 namespace mozilla {
 namespace dom {
 class PBrowserParent;
@@ -127,17 +127,17 @@ public:
   nsresult CreateStaticClone(nsIFrameLoader* aDest);
 
   /**
    * Called from the layout frame associated with this frame loader;
    * this notifies us to hook up with the widget and view.
    */
   PRBool Show(PRInt32 marginWidth, PRInt32 marginHeight,
               PRInt32 scrollbarPrefX, PRInt32 scrollbarPrefY,
-              nsIFrameFrame* frame);
+              nsSubDocumentFrame* frame);
 
   /**
    * Called from the layout frame associated with this frame loader, when
    * the frame is being torn down; this notifies us that out widget and view
    * are going away and we should unhook from them.
    */
   void Hide();
 
@@ -199,17 +199,17 @@ private:
   nsresult ReallyStartLoadingInternal();
 
 #ifdef MOZ_IPC
   // True means new process started; nothing else to do
   bool TryNewProcess();
 
   // Do the hookup necessary to actually show a remote frame once the view and
   // widget are available.
-  bool ShowRemoteFrame(nsIFrameFrame* frame, nsIView* view);
+  bool ShowRemoteFrame(nsSubDocumentFrame* frame, nsIView* view);
 #endif
 
   nsCOMPtr<nsIDocShell> mDocShell;
   nsCOMPtr<nsIURI> mURIToLoad;
   nsIContent *mOwnerContent; // WEAK
 public:
   // public because a callback needs these.
   nsRefPtr<nsFrameMessageManager> mMessageManager;
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -128,17 +128,17 @@
 #include "nsDOMDragEvent.h"
 #include "nsIDOMNSEditableElement.h"
 
 #include "nsIDOMRange.h"
 #include "nsCaret.h"
 #include "nsILookAndFeel.h"
 #include "nsWidgetsCID.h"
 
-#include "nsIFrameFrame.h"
+#include "nsSubDocumentFrame.h"
 #include "nsIFrameTraversal.h"
 #include "nsLayoutCID.h"
 #include "nsLayoutUtils.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsUnicharUtils.h"
 #include "nsContentUtils.h"
 
 #include "imgIContainer.h"
@@ -3644,17 +3644,17 @@ nsEventStateManager::NotifyMouseOut(nsGU
     return;
   // Before firing mouseout, check for recursion
   if (mLastMouseOverElement == mFirstMouseOutEventElement)
     return;
 
   if (mLastMouseOverFrame) {
     // if the frame is associated with a subdocument,
     // tell the subdocument that we're moving out of it
-    nsIFrameFrame* subdocFrame = do_QueryFrame(mLastMouseOverFrame.GetFrame());
+    nsSubDocumentFrame* subdocFrame = do_QueryFrame(mLastMouseOverFrame.GetFrame());
     if (subdocFrame) {
       nsCOMPtr<nsIDocShell> docshell;
       subdocFrame->GetDocShell(getter_AddRefs(docshell));
       if (docshell) {
         nsRefPtr<nsPresContext> presContext;
         docshell->GetPresContext(getter_AddRefs(presContext));
 
         if (presContext) {
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -37,17 +37,17 @@
 
 #include "FrameLayerBuilder.h"
 
 #include "nsDisplayList.h"
 #include "nsPresContext.h"
 #include "nsLayoutUtils.h"
 #include "Layers.h"
 #include "BasicLayers.h"
-#include "nsIFrameFrame.h"
+#include "nsSubDocumentFrame.h"
 
 #ifdef DEBUG
 #include <stdio.h>
 #endif
 
 using namespace mozilla::layers;
 
 namespace mozilla {
@@ -1310,17 +1310,17 @@ InternalInvalidateThebesLayersInSubtree(
     foundContainerLayer = PR_TRUE;
   }
 
   PRInt32 listIndex = 0;
   nsIAtom* childList = nsnull;
   do {
     nsIFrame* child = aFrame->GetFirstChild(childList);
     if (!child && !childList) {
-      nsIFrameFrame* subdocumentFrame = do_QueryFrame(aFrame);
+      nsSubDocumentFrame* subdocumentFrame = do_QueryFrame(aFrame);
       if (subdocumentFrame) {
         // Descend into the subdocument
         child = subdocumentFrame->GetSubdocumentRootFrame();
       }
     }
     while (child) {
       if (InternalInvalidateThebesLayersInSubtree(child)) {
         foundContainerLayer = PR_TRUE;
--- a/layout/generic/Makefile.in
+++ b/layout/generic/Makefile.in
@@ -55,25 +55,25 @@ EXPORTS		= \
 		nsQueryFrame.h \
 		nsFrameList.h \
 		nsCanvasFrame.h \
 		nsHTMLParts.h \
 		nsHTMLReflowMetrics.h \
 		nsHTMLReflowState.h \
 		nsIAnonymousContentCreator.h \
 		nsIFrame.h \
-		nsIFrameFrame.h \
 		nsIFrameUtil.h \
 		nsIImageFrame.h \
 		nsILineIterator.h \
 		nsIObjectFrame.h \
 		nsIPageSequenceFrame.h \
 		nsIScrollableFrame.h \
 		nsIStatefulFrame.h \
 		nsFrameSelection.h \
+		nsSubDocumentFrame.h \
 		$(NULL)
 
 ifdef IBMBIDI
 EXPORTS		+= \
 		nsBidiFrames.h      \
 		$(NULL)
 endif
 
--- a/layout/generic/nsFrameFrame.cpp
+++ b/layout/generic/nsFrameFrame.cpp
@@ -116,17 +116,17 @@ nsSubDocumentFrame::CreateAccessible()
   nsCOMPtr<nsIAccessibilityService> accService = do_GetService("@mozilla.org/accessibilityService;1");
   return accService ?
     accService->CreateOuterDocAccessible(mContent, PresContext()->PresShell()) :
     nsnull;
 }
 #endif
 
 NS_QUERYFRAME_HEAD(nsSubDocumentFrame)
-  NS_QUERYFRAME_ENTRY(nsIFrameFrame)
+  NS_QUERYFRAME_ENTRY(nsSubDocumentFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsLeafFrame)
 
 class AsyncFrameInit : public nsRunnable
 {
 public:
   AsyncFrameInit(nsIFrame* aFrame) : mFrame(aFrame) {}
   NS_IMETHOD Run()
   {
--- a/layout/generic/nsSubDocumentFrame.h
+++ b/layout/generic/nsSubDocumentFrame.h
@@ -34,28 +34,27 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef NSSUBDOCUMENTFRAME_H_
 #define NSSUBDOCUMENTFRAME_H_
 
 #include "nsLeafFrame.h"
-#include "nsIFrameFrame.h"
 #include "nsIReflowCallback.h"
 #include "nsFrameLoader.h"
 
 /******************************************************************************
  * nsSubDocumentFrame
  *****************************************************************************/
 class nsSubDocumentFrame : public nsLeafFrame,
-                           public nsIFrameFrame,
                            public nsIReflowCallback
 {
 public:
+  NS_DECL_QUERYFRAME_TARGET(nsSubDocumentFrame)
   NS_DECL_FRAMEARENA_HELPERS
 
   nsSubDocumentFrame(nsStyleContext* aContext);
 
 #ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const;
 #endif
 
@@ -110,37 +109,35 @@ public:
   // the child content ourselves, since it belongs to a different
   // document and CSS doesn't inherit in there.
   virtual PRBool SupportsVisibilityHidden() { return PR_FALSE; }
 
 #ifdef ACCESSIBILITY
   virtual already_AddRefed<nsAccessible> CreateAccessible();
 #endif
 
-  // nsIFrameFrame
   NS_IMETHOD GetDocShell(nsIDocShell **aDocShell);
   NS_IMETHOD BeginSwapDocShells(nsIFrame* aOther);
   virtual void EndSwapDocShells(nsIFrame* aOther);
-  virtual nsIFrame* GetFrame() { return this; }
+  nsIView* CreateViewAndWidget(nsContentType aContentType);
   virtual nsIFrame* GetSubdocumentRootFrame();
 
   // nsIReflowCallback
   virtual PRBool ReflowFinished();
   virtual void ReflowCallbackCanceled();
 
 protected:
   friend class AsyncFrameInit;
 
   // Helper method to look up the HTML marginwidth & marginheight attributes
   nsIntSize GetMarginAttributes();
 
   nsFrameLoader* FrameLoader();
 
   PRBool IsInline() { return mIsInline; }
-  nsIView* CreateViewAndWidget(nsContentType aContentType);
 
   virtual nscoord GetIntrinsicWidth();
   virtual nscoord GetIntrinsicHeight();
 
   virtual PRIntn GetSkipSides() const;
 
   // Hide or show our document viewer
   void HideViewer();
--- a/layout/xul/base/src/nsContainerBoxObject.cpp
+++ b/layout/xul/base/src/nsContainerBoxObject.cpp
@@ -40,17 +40,17 @@
 #include "nsIBrowserBoxObject.h"
 #include "nsIEditorBoxObject.h"
 #include "nsIIFrameBoxObject.h"
 #include "nsBoxObject.h"
 #include "nsIDocShell.h"
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsIFrame.h"
-#include "nsIFrameFrame.h"
+#include "nsSubDocumentFrame.h"
 
 /**
  * nsContainerBoxObject implements deprecated nsIBrowserBoxObject,
  * nsIEditorBoxObject and nsIIFrameBoxObject interfaces only because of the
  * backward compatibility.
  */
 
 class nsContainerBoxObject : public nsBoxObject,
@@ -78,30 +78,30 @@ NS_IMPL_RELEASE_INHERITED(nsContainerBox
 
 NS_IMETHODIMP nsContainerBoxObject::GetDocShell(nsIDocShell** aResult)
 {
   *aResult = nsnull;
 
   nsIFrame *frame = GetFrame(PR_FALSE);
 
   if (frame) {
-    nsIFrameFrame *frame_frame = do_QueryFrame(frame);
-    if (frame_frame) {
-      // Ok, the frame for mContent is a nsIFrameFrame, it knows how
+    nsSubDocumentFrame *subDocFrame = do_QueryFrame(frame);
+    if (subDocFrame) {
+      // Ok, the frame for mContent is an nsSubDocumentFrame, it knows how
       // to reach the docshell, so ask it...
 
-      return frame_frame->GetDocShell(aResult);
+      return subDocFrame->GetDocShell(aResult);
     }
   }
 
   if (!mContent) {
     return NS_OK;
   }
   
-  // No nsIFrameFrame available for mContent, try if there's a mapping
+  // No nsSubDocumentFrame available for mContent, try if there's a mapping
   // between mContent's document to mContent's subdocument.
 
   // XXXbz sXBL/XBL2 issue -- ownerDocument or currentDocument?
   nsIDocument *doc = mContent->GetDocument();
 
   if (!doc) {
     return NS_OK;
   }