Bug 617539. Remove nsIPresShell_MOZILLA_2_0_BRANCH(2). r=tnikkel
authorRobert O'Callahan <robert@ocallahan.org>
Fri, 01 Apr 2011 10:33:46 +1300
changeset 64531 0dc8fb9d0bc3bcd9891888dd0d36c234e6e3338f
parent 64530 c0564f7efcb94e15d8f8d1be33cbc95cbc61d270
child 64532 2622ae93dfe8b568a8bbcbd3016a43d28eccd9a5
push idunknown
push userunknown
push dateunknown
reviewerstnikkel
bugs617539
milestone2.2a1pre
Bug 617539. Remove nsIPresShell_MOZILLA_2_0_BRANCH(2). r=tnikkel
accessible/src/base/NotificationController.cpp
dom/base/nsGlobalWindow.cpp
layout/base/nsIPresShell.h
layout/base/nsPresShell.cpp
layout/generic/nsSubDocumentFrame.cpp
--- a/accessible/src/base/NotificationController.cpp
+++ b/accessible/src/base/NotificationController.cpp
@@ -176,19 +176,17 @@ NotificationController::ScheduleProcessi
     if (mPresShell->AddRefreshObserver(this, Flush_Display))
       mObservingState = eRefreshObserving;
   }
 }
 
 bool
 NotificationController::IsUpdatePending()
 {
-  nsCOMPtr<nsIPresShell_MOZILLA_2_0_BRANCH2> presShell =
-    do_QueryInterface(mPresShell);
-  return presShell->IsLayoutFlushObserver() ||
+  return mPresShell->IsLayoutFlushObserver() ||
     mObservingState == eRefreshProcessingForUpdate ||
     mContentInsertions.Length() != 0 || mNotifications.Length() != 0 ||
     mTextHash.Count() != 0;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // NotificationCollector: private
 
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -3616,20 +3616,18 @@ nsGlobalWindow::SetInnerWidth(PRInt32 aI
   }
 
   NS_ENSURE_SUCCESS(CheckSecurityWidthAndHeight(&aInnerWidth, nsnull),
                     NS_ERROR_FAILURE);
 
 
   nsRefPtr<nsIPresShell> presShell;
   mDocShell->GetPresShell(getter_AddRefs(presShell));
-  nsCOMPtr<nsIPresShell_MOZILLA_2_0_BRANCH> presShell20 =
-    do_QueryInterface(presShell);
-
-  if (presShell20 && presShell20->GetIsViewportOverridden())
+
+  if (presShell && presShell->GetIsViewportOverridden())
   {
     nscoord height = 0;
     nscoord width  = 0;
 
     nsRefPtr<nsPresContext> presContext;
     presContext = presShell->GetPresContext();
 
     nsRect shellArea = presContext->GetVisibleArea();
@@ -3685,20 +3683,18 @@ nsGlobalWindow::SetInnerHeight(PRInt32 a
     return NS_OK;
   }
 
   NS_ENSURE_SUCCESS(CheckSecurityWidthAndHeight(nsnull, &aInnerHeight),
                     NS_ERROR_FAILURE);
 
   nsRefPtr<nsIPresShell> presShell;
   mDocShell->GetPresShell(getter_AddRefs(presShell));
-  nsCOMPtr<nsIPresShell_MOZILLA_2_0_BRANCH> presShell20 =
-    do_QueryInterface(presShell);
-
-  if (presShell20 && presShell20->GetIsViewportOverridden())
+
+  if (presShell && presShell->GetIsViewportOverridden())
   {
     nscoord height = 0;
     nscoord width  = 0;
 
     nsRefPtr<nsPresContext> presContext;
     presContext = presShell->GetPresContext();
 
     nsRect shellArea = presContext->GetVisibleArea();
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -134,26 +134,18 @@ typedef struct CapturingContentInfo {
   // capture should only be allowed during a mousedown event
   PRPackedBool mAllowed;
   PRPackedBool mRetargetToElement;
   PRPackedBool mPreventDrag;
   nsIContent* mContent;
 } CapturingContentInfo;
 
 #define NS_IPRESSHELL_IID     \
- { 0xd1978bee, 0x43b9, 0x40de, \
-    { 0x95, 0x47, 0x85, 0x06, 0x5e, 0x02, 0xec, 0xb4 } }
-
-#define NS_IPRESSHELL_MOZILLA_2_0_BRANCH_IID     \
- { 0x4abb9970, 0xd7ce, 0x4c02, \
-    { 0x8a, 0xdb, 0x42, 0xc6, 0xbd, 0xa8, 0x95, 0xb7 } }
-
-#define NS_IPRESSHELL_MOZILLA_2_0_BRANCH2_IID     \
- { 0x5ff6fd00, 0x1ba9, 0x11e0, \
-    { 0xac, 0x64, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66 } }
+ { 0x3a8030b5, 0x8d2c, 0x4cb3, \
+    { 0xb5, 0xae, 0xb2, 0x43, 0xa9, 0x28, 0x02, 0x82 } }
 
 // Constants for ScrollContentIntoView() function
 #define NS_PRESSHELL_SCROLL_TOP      0
 #define NS_PRESSHELL_SCROLL_BOTTOM   100
 #define NS_PRESSHELL_SCROLL_LEFT     0
 #define NS_PRESSHELL_SCROLL_RIGHT    100
 #define NS_PRESSHELL_SCROLL_CENTER   50
 #define NS_PRESSHELL_SCROLL_ANYWHERE -1
@@ -173,59 +165,16 @@ typedef struct CapturingContentInfo {
 enum nsRectVisibility { 
   nsRectVisibility_kVisible, 
   nsRectVisibility_kAboveViewport, 
   nsRectVisibility_kBelowViewport, 
   nsRectVisibility_kLeftOfViewport, 
   nsRectVisibility_kRightOfViewport
 };
 
-class nsIPresShell_MOZILLA_2_0_BRANCH : public nsISupports {
-public:  
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPRESSHELL_MOZILLA_2_0_BRANCH_IID)
-
-  virtual PRBool GetIsViewportOverridden() = 0;
-
-  /**
-   * Add a solid color item to the bottom of aList with frame aFrame and bounds
-   * aBounds. Checks first if this needs to be done by checking if aFrame is a
-   * canvas frame (if the FORCE_DRAW flag is passed then this check is skipped).
-   * aBackstopColor is composed behind the background color of the canvas, it is
-   * transparent by default. The ROOT_CONTENT_DOC_BG flag indicates that this is
-   * the background for the root content document.
-   */
-  enum {
-    FORCE_DRAW = 0x01,
-    ROOT_CONTENT_DOC_BG = 0x02
-  };
-  virtual nsresult AddCanvasBackgroundColorItem2(nsDisplayListBuilder& aBuilder,
-                                                nsDisplayList& aList,
-                                                nsIFrame* aFrame,
-                                                const nsRect& aBounds,
-                                                nscolor aBackstopColor = NS_RGBA(0,0,0,0),
-                                                PRUint32 aFlags = 0) = 0;
-
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIPresShell_MOZILLA_2_0_BRANCH,
-                              NS_IPRESSHELL_MOZILLA_2_0_BRANCH_IID)
-
-class nsIPresShell_MOZILLA_2_0_BRANCH2 : public nsISupports {
-public:
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPRESSHELL_MOZILLA_2_0_BRANCH2_IID)
-
-  /**
-   * Return true if the presshell expects layout flush.
-   */
-  virtual PRBool IsLayoutFlushObserver() = 0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIPresShell_MOZILLA_2_0_BRANCH2,
-                              NS_IPRESSHELL_MOZILLA_2_0_BRANCH2_IID)
-
 /**
  * Presentation shell interface. Presentation shells are the
  * controlling point for managing the presentation of a document. The
  * presentation shell holds a live reference to the document, the
  * presentation context, the style manager, the style set and the root
  * frame. <p>
  *
  * When this object is Release'd, it will release the document, the
@@ -404,16 +353,26 @@ public:
   /**
    * Reflow, and also change presshell state so as to only permit
    * reflowing off calls to ResizeReflowOverride() in the future.
    * ResizeReflow() calls are ignored after ResizeReflowOverride().
    */
   virtual NS_HIDDEN_(nsresult) ResizeReflowOverride(nscoord aWidth, nscoord aHeight) = 0;
 
   /**
+   * Returns true if ResizeReflowOverride has been called.
+   */
+  virtual PRBool GetIsViewportOverridden() = 0;
+
+  /**
+   * Return true if the presshell expects layout flush.
+   */
+  virtual PRBool IsLayoutFlushObserver() = 0;
+
+  /**
    * Reflow the frame model with a reflow reason of eReflowReason_StyleChange
    */
   virtual NS_HIDDEN_(void) StyleChangeReflow() = 0;
 
   /**
    * This calls through to the frame manager to get the root frame.
    */
   virtual NS_HIDDEN_(nsIFrame*) GetRootFrameExternal() const;
@@ -1024,28 +983,34 @@ public:
 
   /**
    * Use the current frame tree (if it exists) to update the background
    * color of the most recently drawn canvas.
    */
   virtual void UpdateCanvasBackground() = 0;
 
   /**
-   * Add a solid color item to the bottom of aList with frame aFrame and
-   * bounds aBounds. Checks first if this needs to be done by checking if
-   * aFrame is a canvas frame (if aForceDraw is true then this check is
-   * skipped). aBackstopColor is composed behind the background color of
-   * the canvas, it is transparent by default.
+   * Add a solid color item to the bottom of aList with frame aFrame and bounds
+   * aBounds. Checks first if this needs to be done by checking if aFrame is a
+   * canvas frame (if the FORCE_DRAW flag is passed then this check is skipped).
+   * aBackstopColor is composed behind the background color of the canvas, it is
+   * transparent by default. The ROOT_CONTENT_DOC_BG flag indicates that this is
+   * the background for the root content document.
    */
+  enum {
+    FORCE_DRAW = 0x01,
+    ROOT_CONTENT_DOC_BG = 0x02
+  };
   virtual nsresult AddCanvasBackgroundColorItem(nsDisplayListBuilder& aBuilder,
                                                 nsDisplayList& aList,
                                                 nsIFrame* aFrame,
                                                 const nsRect& aBounds,
                                                 nscolor aBackstopColor = NS_RGBA(0,0,0,0),
-                                                PRBool aForceDraw = PR_FALSE) = 0;
+                                                PRUint32 aFlags = 0) = 0;
+
 
   /**
    * Add a solid color item to the bottom of aList with frame aFrame and
    * bounds aBounds representing the dark grey background behind the page of a
    * print preview presentation.
    */
   virtual nsresult AddPrintPreviewBackgroundItem(nsDisplayListBuilder& aBuilder,
                                                  nsDisplayList& aList,
@@ -1145,37 +1110,16 @@ public:
    * Track whether we're ignoring viewport scrolling for the purposes
    * of painting.  If we are ignoring, then layers aren't clipped to
    * the CSS viewport and scrollbars aren't drawn.
    */
   virtual void SetIgnoreViewportScrolling(PRBool aIgnore) = 0;
   PRBool IgnoringViewportScrolling() const
   { return mRenderFlags & STATE_IGNORING_VIEWPORT_SCROLLING; }
 
-  /**
-   * Set up a "displayport", which overrides what everything else thinks
-   * is the visible region of this document with the specified
-   * displayport rect.
-   * @DEPRECATED Use nsLayoutUtils displayport methods
-   */
-  virtual void SetDisplayPort(const nsRect& aDisplayPort) = 0;
-  PRBool UsingDisplayPort() const
-  { NS_ABORT_IF_FALSE(false, "UsingDisplayPort is deprecated"); return false; }
-
-  /**
-   * Return the displayport being used.  |UsingDisplayPort()| must be
-   * true.
-   * @DEPRECATED Use nsLayoutUtils displayport methods
-   */
-  nsRect GetDisplayPort()
-  {
-    NS_ABORT_IF_FALSE(false, "GetDisplayPort is deprecated");
-    return nsRect();
-  }
-
    /**
    * Set a "resolution" for the document, which if not 1.0 will
    * allocate more or fewer pixels for rescalable content by a factor
    * of |resolution| in both dimensions.  Return NS_OK iff the
    * resolution bounds are sane, and the resolution of this was
    * actually updated.
    *
    * The resolution defaults to 1.0.
@@ -1281,20 +1225,16 @@ protected:
   nscolor                   mCanvasBackgroundColor;
 
   // Flags controlling how our document is rendered.  These persist
   // between paints and so are tied with retained layer pixels.
   // PresShell flushes retained layers when the rendering state
   // changes in a way that prevents us from being able to (usefully)
   // re-use old pixels.
   PRUint32                  mRenderFlags;
-  // If displayport rendering has been requested, |UsingDisplayPort()|
-  // is true and |mDisplayPort| defines the "visible rect" we
-  // maintain.
-  nsRect                    mDisplayPort;
 
   // Used to force allocation and rendering of proportionally more or
   // less pixels in the given dimension.
   float                     mXResolution;
   float                     mYResolution;
 
   // Live pres shells, for memory and other tracking
   typedef nsPtrHashKey<nsIPresShell> PresShellPtrKey;
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -694,19 +694,17 @@ struct nsCallbackEventRequest
                    IsLayoutFlushObserver(this), "Unexpected state")
 
 class nsPresShellEventCB;
 class nsAutoCauseReflowNotifier;
 
 class PresShell : public nsIPresShell, public nsIViewObserver,
                   public nsStubDocumentObserver,
                   public nsISelectionController, public nsIObserver,
-                  public nsSupportsWeakReference,
-                  public nsIPresShell_MOZILLA_2_0_BRANCH,
-                  public nsIPresShell_MOZILLA_2_0_BRANCH2
+                  public nsSupportsWeakReference
 {
 public:
   PresShell();
 
   NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
 
   // nsISupports
   NS_DECL_ISUPPORTS
@@ -949,30 +947,23 @@ public:
 #ifdef PR_LOGGING
   static PRLogModuleInfo* gLog;
 #endif
 
   virtual NS_HIDDEN_(void) DisableNonTestMouseEvents(PRBool aDisable);
 
   virtual void UpdateCanvasBackground();
 
-  virtual nsresult AddCanvasBackgroundColorItem2(nsDisplayListBuilder& aBuilder,
+  virtual nsresult AddCanvasBackgroundColorItem(nsDisplayListBuilder& aBuilder,
                                                 nsDisplayList& aList,
                                                 nsIFrame* aFrame,
                                                 const nsRect& aBounds,
                                                 nscolor aBackstopColor,
                                                 PRUint32 aFlags);
 
-  virtual nsresult AddCanvasBackgroundColorItem(nsDisplayListBuilder& aBuilder,
-                                                nsDisplayList& aList,
-                                                nsIFrame* aFrame,
-                                                const nsRect& aBounds,
-                                                nscolor aBackstopColor,
-                                                PRBool aForceDraw);
-
   virtual nsresult AddPrintPreviewBackgroundItem(nsDisplayListBuilder& aBuilder,
                                                  nsDisplayList& aList,
                                                  nsIFrame* aFrame,
                                                  const nsRect& aBounds);
 
   virtual nscolor ComputeBackstopColor(nsIView* aDisplayRoot);
 
   virtual NS_HIDDEN_(nsresult) SetIsActive(PRBool aIsActive);
@@ -1693,21 +1684,20 @@ PresShell::PresShell()
     registeredReporter = true;
   }
 
   new (this) nsFrameManager();
 
   sLiveShells->PutEntry(this);
 }
 
-NS_IMPL_ISUPPORTS10(PresShell, nsIPresShell, nsIDocumentObserver,
+NS_IMPL_ISUPPORTS8(PresShell, nsIPresShell, nsIDocumentObserver,
                    nsIViewObserver, nsISelectionController,
                    nsISelectionDisplay, nsIObserver, nsISupportsWeakReference,
-                   nsIMutationObserver, nsIPresShell_MOZILLA_2_0_BRANCH,
-                   nsIPresShell_MOZILLA_2_0_BRANCH2)
+                   nsIMutationObserver)
 
 PresShell::~PresShell()
 {
   sLiveShells->RemoveEntry(this);
 
   if (!mHaveShutDown) {
     NS_NOTREACHED("Someone did not call nsIPresShell::destroy");
     Destroy();
@@ -5782,37 +5772,25 @@ AddCanvasBackgroundColor(const nsDisplay
   return PR_FALSE;
 }
 
 nsresult PresShell::AddCanvasBackgroundColorItem(nsDisplayListBuilder& aBuilder,
                                                  nsDisplayList&        aList,
                                                  nsIFrame*             aFrame,
                                                  const nsRect&         aBounds,
                                                  nscolor               aBackstopColor,
-                                                 PRBool                aForceDraw)
-{
-  return AddCanvasBackgroundColorItem2(aBuilder, aList, aFrame, aBounds,
-    aBackstopColor,
-    aForceDraw ? nsIPresShell_MOZILLA_2_0_BRANCH::FORCE_DRAW : 0);
-}
-
-nsresult PresShell::AddCanvasBackgroundColorItem2(nsDisplayListBuilder& aBuilder,
-                                                 nsDisplayList&        aList,
-                                                 nsIFrame*             aFrame,
-                                                 const nsRect&         aBounds,
-                                                 nscolor               aBackstopColor,
                                                  PRUint32              aFlags)
 {
   // We don't want to add an item for the canvas background color if the frame
   // (sub)tree we are painting doesn't include any canvas frames. There isn't
   // an easy way to check this directly, but if we check if the root of the
   // (sub)tree we are painting is a canvas frame that should cover us in all
   // cases (it will usually be a viewport frame when we have a canvas frame in
   // the (sub)tree).
-  if (!(aFlags & nsIPresShell_MOZILLA_2_0_BRANCH::FORCE_DRAW) &&
+  if (!(aFlags & nsIPresShell::FORCE_DRAW) &&
       !nsCSSRendering::IsCanvasFrame(aFrame)) {
     return NS_OK;
   }
 
   nscolor bgcolor = NS_ComposeColors(aBackstopColor, mCanvasBackgroundColor);
   if (NS_GET_A(bgcolor) == 0)
     return NS_OK;
 
@@ -5829,17 +5807,17 @@ nsresult PresShell::AddCanvasBackgroundC
         if (AddCanvasBackgroundColor(aList, canvasFrame, bgcolor))
           return NS_OK;
       }
     }
   }
 
   return aList.AppendNewToBottom(
       new (&aBuilder) nsDisplaySolidColor(&aBuilder, aFrame, aBounds, bgcolor,
-        !!(aFlags & nsIPresShell_MOZILLA_2_0_BRANCH::ROOT_CONTENT_DOC_BG)));
+        !!(aFlags & nsIPresShell::ROOT_CONTENT_DOC_BG)));
 }
 
 static PRBool IsTransparentContainerElement(nsPresContext* aPresContext)
 {
   nsCOMPtr<nsISupports> container = aPresContext->GetContainerInternal();
   nsCOMPtr<nsIDocShellTreeItem> docShellItem = do_QueryInterface(container);
   nsCOMPtr<nsPIDOMWindow> pwin(do_GetInterface(docShellItem));
   if (!pwin)
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -386,19 +386,19 @@ nsSubDocumentFrame::BuildDisplayList(nsD
     if (nsLayoutUtils::NeedsPrintPreviewBackground(presContext)) {
       rv = presShell->AddPrintPreviewBackgroundItem(
              *aBuilder, childItems, subdocRootFrame ? subdocRootFrame : this,
              bounds);
     } else {
       // Add the canvas background color to the bottom of the list. This
       // happens after we've built the list so that AddCanvasBackgroundColorItem
       // can monkey with the contents if necessary.
-      PRUint32 flags = nsIPresShell_MOZILLA_2_0_BRANCH::FORCE_DRAW;
+      PRUint32 flags = nsIPresShell::FORCE_DRAW;
       if (presContext->IsRootContentDocument()) {
-        flags |= nsIPresShell_MOZILLA_2_0_BRANCH::ROOT_CONTENT_DOC_BG;
+        flags |= nsIPresShell::ROOT_CONTENT_DOC_BG;
       }
       rv = presShell->AddCanvasBackgroundColorItem(
              *aBuilder, childItems, subdocRootFrame ? subdocRootFrame : this,
              bounds, NS_RGBA(0,0,0,0), flags);
     }
   }
 
   if (NS_SUCCEEDED(rv)) {