Bug 385978: View cleanup. r+sr=roc
authorsharparrow1@yahoo.com
Wed, 27 Jun 2007 14:23:02 -0700
changeset 2877 5555e903061cf69002269761f2fd59d56ccd724b
parent 2876 3d5a816e4a247a2bd9281da3765bb92c892a821b
child 2878 54da536c76e3e0d653e30878a626306d82ff95e2
push idunknown
push userunknown
push dateunknown
bugs385978
milestone1.9a6pre
Bug 385978: View cleanup. r+sr=roc
view/public/Makefile.in
view/public/nsICompositeListener.h
view/public/nsIViewManager.h
view/src/nsScrollPortView.cpp
view/src/nsScrollPortView.h
view/src/nsView.cpp
view/src/nsView.h
view/src/nsViewManager.cpp
view/src/nsViewManager.h
--- a/view/public/Makefile.in
+++ b/view/public/Makefile.in
@@ -46,13 +46,12 @@ MODULE		= view
 
 EXPORTS		= \
 		nsIView.h \
 		nsIViewManager.h \
 		nsIScrollableView.h \
 		nsViewsCID.h \
 		nsIViewObserver.h \
 		nsIScrollPositionListener.h \
-		nsICompositeListener.h \
 		$(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
deleted file mode 100644
--- a/view/public/nsICompositeListener.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Communicator.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corp.
- * Portions created by the Initial Developer are Copyright (C) 1999
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Kin Blas
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef nsICompositeListener_h___
-#define nsICompositeListener_h___
-
-#include "nsISupports.h"
-
-// forward declarations
-class nsIView;
-class nsIViewManager;
-class nsIRenderingContext;
-class nsIRegion;
-struct nsRect;
-
-// IID for the nsICompositeListener interface
-// {5661ce55-7c42-11d3-009d-1d060b0f8baff}
-#define NS_ICOMPOSITELISTENER_IID \
-{ 0x5661ce55, 0x7c42, 0x11d3, { 0x9d, 0x1d, 0x0, 0x60, 0xb0, 0xf8, 0xba, 0xff } }
-
-/**
- * Provides a way for a client of an nsIViewManager to learn about composite
- * events.
- */
-class nsICompositeListener : public nsISupports {
-public:
-
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICOMPOSITELISTENER_IID)
-
-  /**
-   * Notification before a view is refreshed.
-   * @param aViewManager view manager that "owns" the view. The view does NOT
-   *        hold a reference to the view manager
-   * @param aView view to be refreshed.
-   * @param aContext rendering context to be used during the refresh.
-   * @param aRegion region of the view to be refreshed, IN DEVICE COORDINATES
-   * @param aUpdateFlags see bottom of nsIViewManager.h for description
-   * @result The result of the notification, NS_OK if no errors
-   */
-  NS_IMETHOD WillRefreshRegion(nsIViewManager *aViewManager,
-                               nsIView *aView,
-                               nsIRenderingContext *aContext,
-                               nsIRegion *aRegion,
-                               PRUint32 aUpdateFlags) = 0;
-
-  /**
-   * Notification after a view was refreshed.
-   * @param aViewManager view manager that "owns" the view. The view does NOT
-   *        hold a reference to the view manager
-   * @param aView view that was refreshed.
-   * @param aContext rendering context that was used during the refresh.
-   * @param aRegion region of the view that was refreshed, IN DEVICE COORDINATES
-   * @param aUpdateFlags see bottom of nsIViewManager.h for description
-   * @result The result of the notification, NS_OK if no errors
-   */
-  NS_IMETHOD DidRefreshRegion(nsIViewManager *aViewManager,
-                              nsIView *aView,
-                              nsIRenderingContext *aContext,
-                              nsIRegion *aRegion,
-                              PRUint32 aUpdateFlags) = 0;
-
-  /**
-   * Notification before a view is refreshed.
-   * @param aViewManager view manager that "owns" the view. The view does NOT
-   *        hold a reference to the view manager
-   * @param aView view to be refreshed.
-   * @param aContext rendering context to be used during the refresh.
-   * @param aRect rect region of the view to be refreshed.
-   * @param aUpdateFlags see bottom of nsIViewManager.h for description
-   * @result The result of the notification, NS_OK if no errors
-   */
-  NS_IMETHOD WillRefreshRect(nsIViewManager *aViewManager,
-                             nsIView *aView,
-                             nsIRenderingContext *aContext,
-                             const nsRect *aRect,
-                             PRUint32 aUpdateFlags) = 0;
-
-  /**
-   * Notification after a view was refreshed.
-   * @param aViewManager view manager that "owns" the view. The view does NOT
-   *        hold a reference to the view manager
-   * @param aView view that was refreshed.
-   * @param aContext rendering context that was used during the refresh.
-   * @param aRect rect region of the view that was refreshed.
-   * @param aUpdateFlags see bottom of nsIViewManager.h for description
-   * @result The result of the notification, NS_OK if no errors
-   */
-  NS_IMETHOD DidRefreshRect(nsIViewManager *aViewManager,
-                            nsIView *aView,
-                            nsIRenderingContext *aContext,
-                            const nsRect *aRect,
-                            PRUint32 aUpdateFlags) = 0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsICompositeListener, NS_ICOMPOSITELISTENER_IID)
-
-#endif /* nsICompositeListener_h___ */
-
--- a/view/public/nsIViewManager.h
+++ b/view/public/nsIViewManager.h
@@ -41,18 +41,16 @@
 #include "nscore.h"
 #include "nsIView.h"
 #include "nsColor.h"
 #include "nsEvent.h"
 #include "nsIRenderingContext.h"
 
 class nsIScrollableView;
 class nsIWidget;
-class nsIBlender;
-class nsICompositeListener;
 struct nsRect;
 class nsRegion;
 class nsIDeviceContext;
 class nsIViewObserver;
 
 enum nsRectVisibility { 
   nsRectVisibility_kVisible, 
   nsRectVisibility_kAboveViewport, 
@@ -213,28 +211,16 @@ public:
    * @param aChild child view
    * @param aSibling sibling view
    * @param aAfter after or before in the document order
    */
   NS_IMETHOD  InsertChild(nsIView *aParent, nsIView *aChild, nsIView *aSibling,
                           PRBool aAfter) = 0;
 
   /**
-   * Given a parent view, insert a placeholder for a view that logically
-   * belongs to this parent but has to be moved somewhere else for geometry
-   * reasons ("fixed" positioning).
-   * @param aParent parent view
-   * @param aChild child view
-   * @param aSibling sibling view
-   * @param aAfter after or before in the document order
-   */
-  NS_IMETHOD  InsertZPlaceholder(nsIView *aParent, nsIView *aChild, nsIView *aSibling,
-                                 PRBool aAfter) = 0;
-
-  /**
    * Remove a specific child view from its parent. This will NOT remove its placeholder
    * if there is one.
    * The view manager generates the appropriate dirty regions.
    * @param aParent parent view
    * @param aChild child view
    */
   NS_IMETHOD  RemoveChild(nsIView *aChild) = 0;
 
@@ -295,21 +281,16 @@ public:
    * which tells the compositor not to consider higher views in
    * the view hierarchy that would geometrically intersect with
    * this view. This is a hack, but it fixes some problems with
    * views that need to be drawn in front of all other views.
    */
   NS_IMETHOD  SetViewFloating(nsIView *aView, PRBool aFloatingView) = 0;
 
   /**
-   * Set whether the view's children should be searched during event processing.
-   */
-  NS_IMETHOD  SetViewCheckChildEvents(nsIView *aView, PRBool aEnable) = 0;
-
-  /**
    * Set the view observer associated with this manager
    * @param aObserver - new observer
    * @result error status
    */
   NS_IMETHOD SetViewObserver(nsIViewObserver *aObserver) = 0;
 
   /**
    * Get the view observer associated with this manager
--- a/view/src/nsScrollPortView.cpp
+++ b/view/src/nsScrollPortView.cpp
@@ -152,25 +152,16 @@ NS_IMETHODIMP nsScrollPortView::CreateSc
   initData.clipSiblings = PR_TRUE;
 
   CreateWidget(kWidgetCID, &initData,
                mWindow ? nsnull : aNative);
   
   return NS_OK;
 }
 
-NS_IMETHODIMP nsScrollPortView::SetWidget(nsIWidget *aWidget)
-{
-  if (nsnull != aWidget) {
-    NS_ASSERTION(PR_FALSE, "please don't try and set a widget here");
-    return NS_ERROR_FAILURE;
-  }
-  return NS_OK;
-}
-
 NS_IMETHODIMP nsScrollPortView::GetContainerSize(nscoord *aWidth, nscoord *aHeight) const
 {
   if (!aWidth || !aHeight)
     return NS_ERROR_NULL_POINTER;
 
   *aWidth  = 0;
   *aHeight = 0;
 
--- a/view/src/nsScrollPortView.h
+++ b/view/src/nsScrollPortView.h
@@ -54,18 +54,16 @@ class nsScrollPortView : public nsView, 
 public:
   nsScrollPortView(nsViewManager* aViewManager = nsnull);
 
   virtual nsIScrollableView* ToScrollableView() { return this; }
 
   NS_IMETHOD QueryInterface(REFNSIID aIID,
                             void** aInstancePtr);
 
-  NS_IMETHOD  SetWidget(nsIWidget *aWidget);
-
   //nsIScrollableView interface
   NS_IMETHOD  CreateScrollControls(nsNativeWidget aNative = nsnull);
   NS_IMETHOD  GetContainerSize(nscoord *aWidth, nscoord *aHeight) const;
   NS_IMETHOD  SetScrolledView(nsIView *aScrolledView);
   NS_IMETHOD  GetScrolledView(nsIView *&aScrolledView) const;
 
   NS_IMETHOD  GetScrollPosition(nscoord &aX, nscoord &aY) const;
   NS_IMETHOD  ScrollTo(nscoord aX, nscoord aY, PRUint32 aUpdateFlags);
--- a/view/src/nsView.cpp
+++ b/view/src/nsView.cpp
@@ -177,17 +177,16 @@ nsView::nsView(nsViewManager* aViewManag
 
   mVis = aVisibility;
   // Views should be transparent by default. Not being transparent is
   // a promise that the view will paint all its pixels opaquely. Views
   // should make this promise explicitly by calling
   // SetViewContentTransparency.
   mVFlags = 0;
   mViewManager = aViewManager;
-  mChildRemoved = PR_FALSE;
   mDirtyRegion = nsnull;
 }
 
 void nsView::DropMouseGrabbing() {
   // check to see if we are grabbing events
   if (mViewManager->GetMouseEventGrabber() == this) {
     // we are grabbing events. Move the grab to the parent if we can.
     PRBool boolResult; //not used
@@ -238,35 +237,28 @@ nsView::~nsView()
     
     mViewManager = nsnull;
   }
   else if (mParent)
   {
     mParent->RemoveChild(this);
   }
 
-  if (mZParent)
-  {
-    mZParent->RemoveReparentedView();
-    mZParent->Destroy();
-  }
-
   // Destroy and release the widget
   if (mWindow)
   {
     // Release memory for the view wrapper
     ViewWrapper* wrapper = GetWrapperFor(mWindow);
     NS_IF_RELEASE(wrapper);
 
     mWindow->SetClientData(nsnull);
     mWindow->Destroy();
     NS_RELEASE(mWindow);
   }
   delete mDirtyRegion;
-  delete mClipRect;
 }
 
 nsresult nsView::QueryInterface(const nsIID& aIID, void** aInstancePtr)
 {
   if (nsnull == aInstancePtr) {
     return NS_ERROR_NULL_POINTER;
   }
 
@@ -548,17 +540,16 @@ void nsView::RemoveChild(nsView *child)
         } else {
           mFirstChild = kid->GetNextSibling();
         }
         child->SetParent(nsnull);
         found = PR_TRUE;
         break;
       }
       prevKid = kid;
-      mChildRemoved = PR_TRUE;
 	    kid = kid->GetNextSibling();
     }
     NS_ASSERTION(found, "tried to remove non child");
 
     // If we just removed a root view, then update the RootViewManager
     // on all view managers in the removed subtree.
 
     nsViewManager *vm = child->GetViewManager();
@@ -697,41 +688,16 @@ void nsView::SetZIndex(PRBool aAuto, PRI
   mZIndex = aZIndex;
   SetTopMost(aTopMost);
   
   if (HasWidget() || !oldIsAuto || !aAuto) {
     UpdateNativeWidgetZIndexes(this, FindNonAutoZIndex(this));
   }
 }
 
-NS_IMETHODIMP nsView::SetWidget(nsIWidget *aWidget)
-{
-  ViewWrapper* wrapper = new ViewWrapper(this);
-  if (!wrapper)
-    return NS_ERROR_OUT_OF_MEMORY;
-  NS_ADDREF(wrapper); // Will be released in ~nsView or upon setting a new widget
-
-  // Destroy any old wrappers if there are any
-  ViewWrapper* oldWrapper = GetWrapperFor(aWidget);
-  NS_IF_RELEASE(oldWrapper);
-  NS_IF_RELEASE(mWindow);
-
-  mWindow = aWidget;
-
-  if (nsnull != mWindow)
-  {
-    NS_ADDREF(mWindow);
-    mWindow->SetClientData(wrapper);
-  }
-
-  UpdateNativeWidgetZIndexes(this, FindNonAutoZIndex(this));
-
-  return NS_OK;
-}
-
 //
 // internal window creation functions
 //
 nsresult nsView::LoadWidget(const nsCID &aClassIID)
 {
   ViewWrapper* wrapper = new ViewWrapper(this);
   if (!wrapper)
     return NS_ERROR_OUT_OF_MEMORY;
@@ -775,23 +741,16 @@ void nsIView::List(FILE* out, PRInt32 aI
             (void*)mWindow, widgetRefCnt, Z,
             nonclientBounds.x, nonclientBounds.y,
             windowBounds.width, windowBounds.height);
   }
   nsRect brect = GetBounds();
   fprintf(out, "{%d,%d,%d,%d}",
           brect.x, brect.y, brect.width, brect.height);
   const nsView* v = NS_STATIC_CAST(const nsView*, this);
-  if (v->IsZPlaceholderView()) {
-    fprintf(out, " z-placeholder(%p)",
-            (void*)NS_STATIC_CAST(const nsZPlaceholderView*, this)->GetReparentedView());
-  }
-  if (v->GetZParent()) {
-    fprintf(out, " zparent=%p", (void*)v->GetZParent());
-  }
   fprintf(out, " z=%d vis=%d clientData=%p <\n",
           mZIndex, mVis, mClientData);
   for (nsView* kid = mFirstChild; kid; kid = kid->GetNextSibling()) {
     NS_ASSERTION(kid->GetParent() == this, "incorrect parent");
     kid->List(out, aIndent + 1);
   }
   for (i = aIndent; --i >= 0; ) fputs("  ", out);
   fputs(">\n", out);
--- a/view/src/nsView.h
+++ b/view/src/nsView.h
@@ -39,33 +39,23 @@
 #define nsView_h___
 
 #include "nsIView.h"
 #include "nsIWidget.h"
 #include "nsRegion.h"
 #include "nsRect.h"
 #include "nsCRT.h"
 #include "nsIFactory.h"
-#include "nsIViewObserver.h"
 #include "nsEvent.h"
 #include <stdio.h>
 
 //mmptemp
 
-class nsIRegion;
-class nsIRenderingContext;
 class nsIViewManager;
 class nsViewManager;
-class nsZPlaceholderView;
-
-// View flags private to the view module
-
-// Flag to determine whether the view will check if events can be handled
-// by its children or just handle the events itself
-#define NS_VIEW_FLAG_DONT_CHECK_CHILDREN  0x0200
 
 class nsView : public nsIView
 {
 public:
   nsView(nsViewManager* aViewManager = nsnull,
          nsViewVisibility aVisibility = nsViewVisibility_kShow);
 
   NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
@@ -85,22 +75,16 @@ public:
    * or to the left of its origin position.
    */
   virtual void SetDimensions(const nsRect &aRect, PRBool aPaint = PR_TRUE,
                              PRBool aResizeWidget = PR_TRUE);
   void GetDimensions(nsRect &aRect) const { aRect = mDimBounds; aRect.x -= mPosX; aRect.y -= mPosY; }
   void GetDimensions(nsSize &aSize) const { aSize.width = mDimBounds.width; aSize.height = mDimBounds.height; }
 
   /**
-   * This checks whether the view is a placeholder for some view that has
-   * been reparented to a different geometric parent.
-   */
-  virtual PRBool IsZPlaceholderView() const { return PR_FALSE; }
-
-  /**
    * Called to indicate that the visibility of a view has been
    * changed.
    * @param visibility new visibility state
    */
   NS_IMETHOD  SetVisibility(nsViewVisibility visibility);
 
   /**
    * Called to indicate that the z-index of a view has been changed.
@@ -117,39 +101,28 @@ public:
    * Set/Get whether the view "floats" above all other views,
    * which tells the compositor not to consider higher views in
    * the view hierarchy that would geometrically intersect with
    * this view. This is a hack, but it fixes some problems with
    * views that need to be drawn in front of all other views.
    * @result PR_TRUE if the view floats, PR_FALSE otherwise.
    */
   NS_IMETHOD  SetFloating(PRBool aFloatingView);
-  /**
-   * Set the widget associated with this view.
-   * @param aWidget widget to associate with view. It is an error
-   *        to associate a widget with more than one view. To disassociate
-   *        a widget from a view, use nsnull. If there are no more references
-   *        to the widget that may have been associated with the view, it will
-   *        be destroyed.
-   * @return error status
-   */
-  NS_IMETHOD  SetWidget(nsIWidget *aWidget);
 
   // Helper function to get the view that's associated with a widget
   static nsView* GetViewFor(nsIWidget* aWidget) {
     return NS_STATIC_CAST(nsView*, nsIView::GetViewFor(aWidget));
   }
 
   // Helper function to get mouse grabbing off this view (by moving it to the
   // parent, if we can)
   void DropMouseGrabbing();
 
 public:
   // NOT in nsIView, so only available in view module
-  nsZPlaceholderView* GetZParent() const { return mZParent; }
   // These are also present in nsIView, but these versions return nsView and nsViewManager
   // instead of nsIView and nsIViewManager.
   nsView* GetFirstChild() const { return mFirstChild; }
   nsView* GetNextSibling() const { return mNextSibling; }
   nsView* GetParent() const { return mParent; }
   nsViewManager* GetViewManager() const { return mViewManager; }
   // These are superceded by a better interface in nsIView
   PRInt32 GetZIndex() const { return mZIndex; }
@@ -169,17 +142,16 @@ public:
     }
     return mDirtyRegion;
   }
 
   void InsertChild(nsView *aChild, nsView *aSibling);
   void RemoveChild(nsView *aChild);
 
   void SetParent(nsView *aParent) { mParent = aParent; }
-  void SetZParent(nsZPlaceholderView *aZParent) { mZParent = aZParent; }
   void SetNextSibling(nsView *aSibling) { mNextSibling = aSibling; }
 
   PRUint32 GetViewFlags() const { return mVFlags; }
   void SetViewFlags(PRUint32 aFlags) { mVFlags = aFlags; }
 
   void SetTopMost(PRBool aTopMost) { aTopMost ? mVFlags |= NS_VIEW_FLAG_TOPMOST : mVFlags &= ~NS_VIEW_FLAG_TOPMOST; }
   PRBool IsTopMost() { return((mVFlags & NS_VIEW_FLAG_TOPMOST) != 0); }
 
@@ -209,18 +181,13 @@ public:
 
   nsRect CalcWidgetBounds(nsWindowType aType);
 
 protected:
   // Do the actual work of ResetWidgetBounds, unconditionally.  Don't
   // call this method if we have no widget.
   void DoResetWidgetBounds(PRBool aMoveOnly, PRBool aInvalidateChangedSize);
 
-  nsZPlaceholderView* mZParent;
-
-  // mClipRect is relative to the view's origin.
-  nsRect*      mClipRect;
   nsRegion*    mDirtyRegion;
   nsPoint      mViewToWidgetOffset;
-  PRPackedBool mChildRemoved;
 };
 
 #endif
--- a/view/src/nsViewManager.cpp
+++ b/view/src/nsViewManager.cpp
@@ -46,17 +46,16 @@
 #include "nsViewManager.h"
 #include "nsUnitConversion.h"
 #include "nsIRenderingContext.h"
 #include "nsIDeviceContext.h"
 #include "nsGfxCIID.h"
 #include "nsIScrollableView.h"
 #include "nsView.h"
 #include "nsISupportsArray.h"
-#include "nsICompositeListener.h"
 #include "nsCOMPtr.h"
 #include "nsIServiceManager.h"
 #include "nsGUIEvent.h"
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
 #include "nsRegion.h"
 #include "nsInt64.h"
 #include "nsScrollPortView.h"
@@ -426,18 +425,16 @@ void nsViewManager::Refresh(nsView *aVie
 
   // damageRegion is the damaged area, in twips, relative to the view origin
   nsRegion damageRegion;
   // convert pixels-relative-to-widget-origin to twips-relative-to-widget-origin
   ConvertNativeRegionToAppRegion(aRegion, &damageRegion, mContext);
   // move it from widget coordinates into view coordinates
   damageRegion.MoveBy(viewRect.x, viewRect.y);
 
-  // Clip it to the view; shouldn't be necessary, but do it for sanity
-  damageRegion.And(damageRegion, viewRect);
   if (damageRegion.IsEmpty()) {
 #ifdef DEBUG_roc
     nsRect damageRect = damageRegion.GetBounds();
     printf("XXX Damage rectangle (%d,%d,%d,%d) does not intersect the widget's view (%d,%d,%d,%d)!\n",
            damageRect.x, damageRect.y, damageRect.width, damageRect.height,
            viewRect.x, viewRect.y, viewRect.width, viewRect.height);
 #endif
     return;
@@ -454,33 +451,32 @@ void nsViewManager::Refresh(nsView *aVie
   NS_ASSERTION(!IsPainting(), "recursive painting not permitted");
   if (IsPainting()) {
     RootViewManager()->mRecursiveRefreshPending = PR_TRUE;
     return;
   }  
   SetPainting(PR_TRUE);
 
   nsCOMPtr<nsIRenderingContext> localcx;
-
+  NS_ASSERTION(aView->GetWidget(),
+               "Must have a widget to calculate coordinates correctly");
   if (nsnull == aContext)
     {
       localcx = CreateRenderingContext(*aView);
 
       //couldn't get rendering context. this is ok at init time atleast
       if (nsnull == localcx) {
         SetPainting(PR_FALSE);
         return;
       }
     } else {
       // plain assignment grabs another reference.
       localcx = aContext;
     }
 
-  // damageRect is the clipped damage area bounds, in twips-relative-to-view-origin
-  nsRect damageRect = damageRegion.GetBounds();
   PRInt32 p2a = mContext->AppUnitsPerDevPixel();
 
   nsRefPtr<gfxContext> ctx =
     (gfxContext*) localcx->GetNativeGraphicData(nsIRenderingContext::NATIVE_THEBES_CONTEXT);
 
   ctx->Save();
 
   nsPoint vtowoffset = aView->ViewToWidgetOffset();
@@ -1455,35 +1451,16 @@ NS_IMETHODIMP nsViewManager::InsertChild
       //and mark this area as dirty if the view is visible...
 
       if (nsViewVisibility_kHide != child->GetVisibility())
         UpdateView(child, NS_VMREFRESH_NO_SYNC);
     }
   return NS_OK;
 }
 
-NS_IMETHODIMP nsViewManager::InsertZPlaceholder(nsIView *aParent, nsIView *aChild,
-                                                nsIView *aSibling, PRBool aAfter)
-{
-  nsView* parent = NS_STATIC_CAST(nsView*, aParent);
-  nsView* child = NS_STATIC_CAST(nsView*, aChild);
-
-  NS_PRECONDITION(nsnull != parent, "null ptr");
-  NS_PRECONDITION(nsnull != child, "null ptr");
-
-  nsZPlaceholderView* placeholder = new nsZPlaceholderView(this);
-  // mark the placeholder as "shown" so that it will be included in a built display list
-  placeholder->SetParent(parent);
-  placeholder->SetReparentedView(child);
-  placeholder->SetZIndex(child->GetZIndexIsAuto(), child->GetZIndex(), child->IsTopMost());
-  child->SetZParent(placeholder);
-  
-  return InsertChild(parent, placeholder, aSibling, aAfter);
-}
-
 NS_IMETHODIMP nsViewManager::InsertChild(nsIView *aParent, nsIView *aChild, PRInt32 aZIndex)
 {
   // no-one really calls this with anything other than aZIndex == 0 on a fresh view
   // XXX this method should simply be eliminated and its callers redirected to the real method
   SetViewZIndex(aChild, PR_FALSE, aZIndex, PR_FALSE);
   return InsertChild(aParent, aChild, nsnull, PR_TRUE);
 }
 
@@ -1630,31 +1607,16 @@ PRBool nsViewManager::CanScrollWithBitBl
 
 #ifdef MOZ_WIDGET_GTK2
   return aUpdateRegion->IsEmpty();
 #else
   return PR_TRUE;
 #endif
 }
 
-NS_IMETHODIMP nsViewManager::SetViewCheckChildEvents(nsIView *aView, PRBool aEnable)
-{
-  nsView* view = NS_STATIC_CAST(nsView*, aView);
-
-  NS_ASSERTION(!(nsnull == view), "no view");
-
-  if (aEnable) {
-    view->SetViewFlags(view->GetViewFlags() & ~NS_VIEW_FLAG_DONT_CHECK_CHILDREN);
-  } else {
-    view->SetViewFlags(view->GetViewFlags() | NS_VIEW_FLAG_DONT_CHECK_CHILDREN);
-  }
-
-  return NS_OK;
-}
-
 NS_IMETHODIMP nsViewManager::SetViewFloating(nsIView *aView, PRBool aFloating)
 {
   nsView* view = NS_STATIC_CAST(nsView*, aView);
 
   NS_ASSERTION(!(nsnull == view), "no view");
 
   view->SetFloating(aFloating);
 
@@ -1751,21 +1713,16 @@ NS_IMETHODIMP nsViewManager::SetViewZInd
   PRInt32 oldidx = view->GetZIndex();
   view->SetZIndex(aAutoZIndex, aZIndex, aTopMost);
 
   if (oldidx != aZIndex || oldTopMost != aTopMost ||
       oldIsAuto != aAutoZIndex) {
     UpdateView(view, NS_VMREFRESH_NO_SYNC);
   }
 
-  nsZPlaceholderView* zParentView = view->GetZParent();
-  if (nsnull != zParentView) {
-    SetViewZIndex(zParentView, aAutoZIndex, aZIndex, aTopMost);
-  }
-
   return rv;
 }
 
 NS_IMETHODIMP nsViewManager::SetViewObserver(nsIViewObserver *aObserver)
 {
   mObserver = aObserver;
   return NS_OK;
 }
--- a/view/src/nsViewManager.h
+++ b/view/src/nsViewManager.h
@@ -44,52 +44,28 @@
 #include "nsITimer.h"
 #include "prtime.h"
 #include "prinrval.h"
 #include "nsVoidArray.h"
 #include "nsThreadUtils.h"
 #include "nsIScrollableView.h"
 #include "nsIRegion.h"
 #include "nsView.h"
-
-class nsISupportsArray;
-class BlendingBuffers;
+#include "nsIViewObserver.h"
 
 //Uncomment the following line to enable generation of viewmanager performance data.
 #ifdef MOZ_PERF_METRICS
 //#define NS_VM_PERF_METRICS 1 
 #endif
 
 #ifdef NS_VM_PERF_METRICS
 #include "nsTimer.h"
 #endif
 
 /**
-   FIXED-POSITION FRAMES AND Z-ORDERING
-
-   Fixed-position frames are special. They have TWO views. There is the "real" view, which is
-   a child of the root view for the viewport (which is the root view of the view manager).
-   There is also a "placeholder" view (of class nsZPlaceholderView) which never really
-   participates in any view operations. It is a child of the view that would have contained
-   the fixed-position element if it had not been fixed-position. The real view keeps track
-   of the placeholder view and returns the placeholder view when you call GetZParent on the
-   real view.
-
-   (Although currently all views which have a placeholder view are themselves children of the
-   root view, we don't want to depend on this. Later we might want to support views that
-   are fixed relative to some container other than the viewport.)
-
-   As we build the display list in CreateDisplayList, once we've processed the parent of
-   real views (i.e., the root), we move those real views from their current position in the
-   display list over to where their placeholder views are in the display list. This ensures that
-   views get repainted in the order they would have been repainted in the absence of
-   fixed-position frames.
- */
-
-/**
    Invalidation model:
 
    1) Callers call into the view manager and ask it to update a view.
    
    2) The view manager finds the "right" widget for the view, henceforth called
       the root widget.
 
    3) The view manager traverses descendants of the root widget and for each
@@ -110,38 +86,16 @@ class BlendingBuffers;
    that those invalidates happen.
 
    To cope with this, invalidate event processing and view update batch
    handling should only happen on the root viewmanager.  This means the root
    view manager is the only thing keeping track of mUpdateCnt.  As a result,
    Composite() calls should also be forwarded to the root view manager.
 */
 
-class nsZPlaceholderView : public nsView
-{
-public:
-  nsZPlaceholderView(nsViewManager* aViewManager) : nsView(aViewManager) {}
-
-  void RemoveReparentedView() { mReparentedView = nsnull; }
-  void SetReparentedView(nsView* aView) { mReparentedView = aView; }
-  nsView* GetReparentedView() const { return mReparentedView; }
-
-  virtual PRBool IsZPlaceholderView() const { return PR_TRUE; }
-
-protected:
-  virtual ~nsZPlaceholderView() {
-    if (nsnull != mReparentedView) {
-      mReparentedView->SetZParent(nsnull);
-    }
-  }
-
-protected:
-  nsView   *mReparentedView;
-};
-
 class nsViewManagerEvent : public nsRunnable {
 public:
   nsViewManagerEvent(class nsViewManager *vm) : mViewManager(vm) {
     NS_ASSERTION(mViewManager, "null parameter");
   }
   void Revoke() { mViewManager = nsnull; }
 protected:
   class nsViewManager *mViewManager;
@@ -183,29 +137,24 @@ public:
   NS_IMETHOD  GetMouseEventGrabber(nsIView *&aView);
 
   NS_IMETHOD  InsertChild(nsIView *parent, nsIView *child, nsIView *sibling,
                           PRBool above);
 
   NS_IMETHOD  InsertChild(nsIView *parent, nsIView *child,
                           PRInt32 zindex);
 
-  NS_IMETHOD  InsertZPlaceholder(nsIView *parent, nsIView *child, nsIView *sibling,
-                                 PRBool above);
-
   NS_IMETHOD  RemoveChild(nsIView *parent);
 
   NS_IMETHOD  MoveViewBy(nsIView *aView, nscoord aX, nscoord aY);
 
   NS_IMETHOD  MoveViewTo(nsIView *aView, nscoord aX, nscoord aY);
 
   NS_IMETHOD  ResizeView(nsIView *aView, const nsRect &aRect, PRBool aRepaintExposedAreaOnly = PR_FALSE);
 
-  NS_IMETHOD  SetViewCheckChildEvents(nsIView *aView, PRBool aEnable);
-
   NS_IMETHOD  SetViewFloating(nsIView *aView, PRBool aFloating);
 
   NS_IMETHOD  SetViewVisibility(nsIView *aView, nsViewVisibility aVisible);
 
   NS_IMETHOD  SetViewZIndex(nsIView *aView, PRBool aAuto, PRInt32 aZIndex, PRBool aTopMost=PR_FALSE);
 
   NS_IMETHOD  SetViewObserver(nsIViewObserver *aObserver);
   NS_IMETHOD  GetViewObserver(nsIViewObserver *&aObserver);
@@ -437,17 +386,16 @@ private:
   nsIScrollableView *mRootScrollable;
   nscolor           mDefaultBackgroundColor;
   nsPoint           mMouseLocation; // device units, relative to mRootView
 
   // The size for a resize that we delayed until the root view becomes
   // visible again.
   nsSize            mDelayedResize;
 
-  nsISupportsArray  *mCompositeListeners;
   nsCOMPtr<nsIFactory> mRegionFactory;
   nsView            *mRootView;
   // mRootViewManager is a strong ref unless it equals |this|.  It's
   // never null (if we have no ancestors, it will be |this|).
   nsViewManager     *mRootViewManager;
 
   nsRevocableEventPtr<nsViewManagerEvent> mSynthMouseMoveEvent;
   nsRevocableEventPtr<nsViewManagerEvent> mInvalidateEvent;