Bug 826632. Part 5: nsViewManager methods do not need to be virtual and most of the ones that return nsresult don't need to. r=tnikkel
authorRobert O'Callahan <robert@ocallahan.org>
Sat, 05 Jan 2013 16:13:05 +1300
changeset 123286 3c2fc9e57bb5f7e0eb6981dae295b026ba8bcbcb
parent 123285 4f5d5f0c454c23bfb7c56e239c418b1e4223b725
child 123287 f9a6a2f984f9d835b6498247b2f87718d8474f86
push id3129
push userakeybl@mozilla.com
push dateMon, 07 Jan 2013 22:54:45 +0000
treeherdermozilla-aurora@090bc89ff6b4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs826632
milestone20.0a1
Bug 826632. Part 5: nsViewManager methods do not need to be virtual and most of the ones that return nsresult don't need to. r=tnikkel Also, just use GetRootView instead of GetRootViewImpl.
docshell/base/nsDocShell.cpp
dom/plugins/base/nsPluginInstanceOwner.cpp
view/public/nsViewManager.h
view/src/nsView.cpp
view/src/nsViewManager.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -5046,17 +5046,17 @@ NS_IMETHODIMP
 nsDocShell::Repaint(bool aForce)
 {
     nsCOMPtr<nsIPresShell> presShell =GetPresShell();
     NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
 
     nsViewManager* viewManager = presShell->GetViewManager();
     NS_ENSURE_TRUE(viewManager, NS_ERROR_FAILURE);
 
-    NS_ENSURE_SUCCESS(viewManager->InvalidateAllViews(), NS_ERROR_FAILURE);
+    viewManager->InvalidateAllViews();
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDocShell::GetParentWidget(nsIWidget ** parentWidget)
 {
     NS_ENSURE_ARG_POINTER(parentWidget);
 
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -738,24 +738,24 @@ NS_IMETHODIMP nsPluginInstanceOwner::Get
         if (*pvalue)
           return NS_OK;
       }
     }
   }
 #endif
   // simply return the topmost document window
   nsCOMPtr<nsIWidget> widget;
-  nsresult rv = vm->GetRootWidget(getter_AddRefs(widget));            
+  vm->GetRootWidget(getter_AddRefs(widget));
   if (widget) {
     *pvalue = (void*)widget->GetNativeData(NS_NATIVE_WINDOW);
   } else {
     NS_ASSERTION(widget, "couldn't get doc's widget in getting doc's window handle");
   }
 
-  return rv;
+  return NS_OK;
 #elif (defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)) && defined(MOZ_X11)
   // X11 window managers want the toplevel window for WM_TRANSIENT_FOR.
   nsIWidget* win = mObjectFrame->GetNearestWidget();
   if (!win)
     return NS_ERROR_FAILURE;
   *static_cast<Window*>(value) = (long unsigned int)win->GetNativeData(NS_NATIVE_SHAREABLE_WINDOW);
   return NS_OK;
 #else
--- a/view/public/nsViewManager.h
+++ b/view/public/nsViewManager.h
@@ -19,120 +19,119 @@
 #include "nsIPresShell.h"
 #include "nsDeviceContext.h"
 
 class nsIWidget;
 struct nsRect;
 class nsRegion;
 class nsDeviceContext;
 class nsIPresShell;
-class nsView;
 
-class nsViewManager
+class nsViewManager MOZ_FINAL
 {
 public:
   friend class nsView;
 
   NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
 
   NS_INLINE_DECL_REFCOUNTING(nsViewManager)
 
   nsViewManager();
-  virtual ~nsViewManager();
+  ~nsViewManager();
 
   /**
    * Initialize the ViewManager
    * Note: this instance does not hold a reference to the presshell
    * because it holds a reference to this instance.
    * @result The result of the initialization, NS_OK if no errors
    */
-  NS_IMETHOD  Init(nsDeviceContext* aContext);
+  nsresult Init(nsDeviceContext* aContext);
 
   /**
    * Create an ordinary view
    * @param aBounds initial bounds for view
    *        XXX We should eliminate this parameter; you can set the bounds after CreateView
    * @param aParent intended parent for view. this is not actually set in the
    *        nsView through this method. it is only used by the initialization
    *        code to walk up the view tree, if necessary, to find resources.
    *        XXX We should eliminate this parameter!
    * @param aVisibilityFlag initial visibility state of view
    *        XXX We should eliminate this parameter; you can set it after CreateView
    * @result The new view
    */
-  NS_IMETHOD_(nsView*) CreateView(const nsRect& aBounds,
-                                   const nsView* aParent,
-                                   nsViewVisibility aVisibilityFlag = nsViewVisibility_kShow);
+  nsView* CreateView(const nsRect& aBounds,
+                     const nsView* aParent,
+                     nsViewVisibility aVisibilityFlag = nsViewVisibility_kShow);
 
   /**
    * Get the root of the view tree.
    * @result the root view
    */
-  NS_IMETHOD_(nsView*) GetRootView() { return mRootView; }
+  nsView* GetRootView() { return mRootView; }
 
   /**
    * Set the root of the view tree. Does not destroy the current root view.
    * aView may have a parent view managed by a different view manager.
    * aView may have a widget (anything but printing) or may not (printing).
    * @param aView view to set as root
    */
-  NS_IMETHOD  SetRootView(nsView *aView);
+  void SetRootView(nsView *aView);
 
   /**
    * Get the dimensions of the root window. The dimensions are in
    * twips
    * @param aWidth out parameter for width of window in twips
    * @param aHeight out parameter for height of window in twips
    */
-  NS_IMETHOD  GetWindowDimensions(nscoord *aWidth, nscoord *aHeight);
+  void GetWindowDimensions(nscoord *aWidth, nscoord *aHeight);
 
   /**
    * Set the dimensions of the root window.
    * Called if the root window is resized. The dimensions are in
    * twips
    * @param aWidth of window in twips
    * @param aHeight of window in twips
    */
-  NS_IMETHOD  SetWindowDimensions(nscoord aWidth, nscoord aHeight);
+  void SetWindowDimensions(nscoord aWidth, nscoord aHeight);
 
   /**
    * Do any resizes that are pending.
    */
-  NS_IMETHOD  FlushDelayedResize(bool aDoReflow);
+  void FlushDelayedResize(bool aDoReflow);
 
   /**
    * Called to inform the view manager that the entire area of a view
    * is dirty and needs to be redrawn.
    * @param aView view to paint. should be root view
    */
-  NS_IMETHOD  InvalidateView(nsView *aView);
+  void InvalidateView(nsView *aView);
 
   /**
    * Called to inform the view manager that some portion of a view is dirty and
    * needs to be redrawn. The rect passed in should be in the view's coordinate
    * space. Does not check for paint suppression.
    * @param aView view to paint. should be root view
    * @param rect rect to mark as damaged
    */
-  NS_IMETHOD  InvalidateViewNoSuppression(nsView *aView, const nsRect &aRect);
+  void InvalidateViewNoSuppression(nsView *aView, const nsRect &aRect);
 
   /**
    * Called to inform the view manager that it should invalidate all views.
    */
-  NS_IMETHOD  InvalidateAllViews();
+  void InvalidateAllViews();
 
   /**
    * Called to dispatch an event to the appropriate view. Often called
    * as a result of receiving a mouse or keyboard event from the widget
    * event system.
    * @param aEvent event to dispatch
    * @param aViewTarget dispatch the event to this view
    * @param aStatus event handling status
    */
-  NS_IMETHOD  DispatchEvent(nsGUIEvent *aEvent,
+  void DispatchEvent(nsGUIEvent *aEvent,
       nsView* aViewTarget, nsEventStatus* aStatus);
 
   /**
    * Given a parent view, insert another view as its child.
    * aSibling and aAbove control the "document order" for the insertion.
    * If aSibling is null, the view is inserted at the end of the document order
    * if aAfter is true, otherwise it is inserted at the beginning.
    * If aSibling is non-null, then if aAfter is true, the view is inserted
@@ -140,68 +139,68 @@ public:
    * overriden by z-order).
    * If it is false, the view is inserted before the sibling.
    * The view manager generates the appopriate dirty regions.
    * @param aParent parent view
    * @param aChild child view
    * @param aSibling sibling view
    * @param aAfter after or before in the document order
    */
-  NS_IMETHOD  InsertChild(nsView *aParent, nsView *aChild, nsView *aSibling,
-                          bool aAfter);
+  void InsertChild(nsView *aParent, nsView *aChild, nsView *aSibling,
+                   bool aAfter);
 
-  NS_IMETHOD InsertChild(nsView *aParent, nsView *aChild, int32_t aZIndex);
+  void InsertChild(nsView *aParent, nsView *aChild, int32_t aZIndex);
 
   /**
    * 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(nsView *aChild);
+  void RemoveChild(nsView *aChild);
 
   /**
    * Move a view to the specified position, provided in parent coordinates.
    * The new position is the (0, 0) origin for the view's coordinate system.
    * The view's bounds may extend above or to the left of this point.
    * The view manager generates the appropriate dirty regions.
    * @param aView view to move
    * @param aX x value for new view position
    * @param aY y value for new view position
    */
-  NS_IMETHOD  MoveViewTo(nsView *aView, nscoord aX, nscoord aY);
+  void MoveViewTo(nsView *aView, nscoord aX, nscoord aY);
 
   /**
    * Resize a view. In addition to setting the width and height, you can
    * set the x and y of its bounds relative to its position. Negative x and y
    * will let the view extend above and to the left of the (0,0) point in its
    * coordinate system.
    * The view manager generates the appropriate dirty regions.
    * @param aView view to move
    * @param the new bounds relative to the current position
    * @param RepaintExposedAreaOnly
    *     if true Repaint only the expanded or contracted region,
    *     if false Repaint the union of the old and new rectangles.
    */
-  NS_IMETHOD  ResizeView(nsView *aView, const nsRect &aRect,
-                         bool aRepaintExposedAreaOnly = false);
+  void ResizeView(nsView *aView, const nsRect &aRect,
+                  bool aRepaintExposedAreaOnly = false);
 
   /**
    * Set the visibility of a view. Hidden views have the effect of hiding
    * their descendants as well. This does not affect painting, so layout
    * is responsible for ensuring that content in hidden views is not
    * painted nor handling events. It does affect the visibility of widgets;
    * if a view is hidden, descendant views with widgets have their widgets
    * hidden.
    * The view manager generates the appropriate dirty regions.
    * @param aView view to change visibility state of
    * @param visible new visibility state
    */
-  NS_IMETHOD  SetViewVisibility(nsView *aView, nsViewVisibility aVisible);
+  void SetViewVisibility(nsView *aView, nsViewVisibility aVisible);
 
   /**
    * Set the z-index of a view. Positive z-indices mean that a view
    * is above its parent in z-order. Negative z-indices mean that a
    * view is below its parent.
    * The view manager generates the appropriate dirty regions.
    * @param aAutoZIndex indicate that the z-index of a view is "auto". An "auto" z-index
    * means that the view does not define a new stacking context,
@@ -209,43 +208,43 @@ public:
    * relative to the view's siblings.
    * @param aView view to change z depth of
    * @param aZindex explicit z depth
    * @param aTopMost used when this view is z-index:auto to compare against 
    *        other z-index:auto views.
    *        true if the view should be topmost when compared with 
    *        other z-index:auto views.
    */
-  NS_IMETHOD  SetViewZIndex(nsView *aView, bool aAutoZIndex, int32_t aZindex, bool aTopMost = false);
+  void SetViewZIndex(nsView *aView, bool aAutoZIndex, int32_t aZindex, bool aTopMost = false);
 
   /**
    * Set 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.
    */
-  NS_IMETHOD  SetViewFloating(nsView *aView, bool aFloatingView);
+  void SetViewFloating(nsView *aView, bool aFloatingView);
 
   /**
    * Set the presshell associated with this manager
    * @param aPresShell - new presshell
    */
-  virtual void SetPresShell(nsIPresShell *aPresShell) { mPresShell = aPresShell; }
+  void SetPresShell(nsIPresShell *aPresShell) { mPresShell = aPresShell; }
 
   /**
    * Get the pres shell associated with this manager
    */
-  virtual nsIPresShell* GetPresShell() { return mPresShell; }
+  nsIPresShell* GetPresShell() { return mPresShell; }
 
   /**
    * Get the device context associated with this manager
    * @result device context
    */
-  NS_IMETHOD  GetDeviceContext(nsDeviceContext *&aContext);
+  void GetDeviceContext(nsDeviceContext *&aContext);
 
   /**
    * A stack class for disallowing changes that would enter painting. For
    * example, popup widgets shouldn't be resized during reflow, since doing so
    * might cause synchronous painting inside reflow which is forbidden.
    * While refresh is disabled, widget geometry changes are deferred and will
    * be handled later, either from the refresh driver or from an NS_WILL_PAINT
    * event.
@@ -271,65 +270,64 @@ public:
     const AutoDisableRefresh& operator=(const AutoDisableRefresh& aOther);
 
     nsRefPtr<nsViewManager> mRootVM;
   };
 
 private:
   friend class AutoDisableRefresh;
 
-  virtual nsViewManager* IncrementDisableRefreshCount();
-  virtual void DecrementDisableRefreshCount();
+  nsViewManager* IncrementDisableRefreshCount();
+  void DecrementDisableRefreshCount();
 
 public:
   /**
    * Retrieve the widget at the root of the nearest enclosing
    * view manager whose root view has a widget.
    */
-  NS_IMETHOD GetRootWidget(nsIWidget **aWidget);
+  void GetRootWidget(nsIWidget **aWidget);
 
   /**
    * Indicate whether the viewmanager is currently painting
    *
    * @param aPainting true if the viewmanager is painting
    *                  false otherwise
    */
-  NS_IMETHOD IsPainting(bool& aIsPainting);
+  void IsPainting(bool& aIsPainting);
 
   /**
    * Retrieve the time of the last user event. User events
    * include mouse and keyboard events. The viewmanager
    * saves the time of the last user event.
    *
    * @param aTime Last user event time in microseconds
    */
-  NS_IMETHOD GetLastUserEventTime(uint32_t& aTime);
+  void GetLastUserEventTime(uint32_t& aTime);
 
   /**
    * Find the nearest display root view for the view aView. This is the view for
    * the nearest enclosing popup or the root view for the root document.
    */
   static nsView* GetDisplayRootFor(nsView* aView);
 
   /**
    * Flush the accumulated dirty region to the widget and update widget
    * geometry.
    */
-  virtual void ProcessPendingUpdates();
+  void ProcessPendingUpdates();
 
   /**
    * Just update widget geometry without flushing the dirty region
    */
-  virtual void UpdateWidgetGeometry();
+  void UpdateWidgetGeometry();
 
   uint32_t AppUnitsPerDevPixel() const
   {
     return mContext->AppUnitsPerDevPixel();
   }
-  nsView* GetRootViewImpl() const { return mRootView; }
 
 private:
   static uint32_t gLastUserEventTime;
 
   /* Update the cached RootViewManager pointer on this view manager. */
   void InvalidateHierarchy();
   void FlushPendingInvalidates();
 
@@ -369,17 +367,17 @@ private:
   bool IsPainting() const {
     return RootViewManager()->mPainting;
   }
 
   void SetPainting(bool aPainting) {
     RootViewManager()->mPainting = aPainting;
   }
 
-  nsresult InvalidateView(nsView *aView, const nsRect &aRect);
+  void InvalidateView(nsView *aView, const nsRect &aRect);
 
   nsViewManager* RootViewManager() const { return mRootViewManager; }
   bool IsRootVM() const { return this == RootViewManager(); }
 
   // Whether synchronous painting is allowed at the moment. For example,
   // widget geometry changes can cause synchronous painting, so they need to
   // be deferred while refresh is disabled.
   bool IsPaintingAllowed() { return RootViewManager()->mRefreshDisableCount == 0; }
--- a/view/src/nsView.cpp
+++ b/view/src/nsView.cpp
@@ -58,17 +58,17 @@ nsView::~nsView()
       RemoveChild(child);
     }
   }
 
   if (mViewManager)
   {
     DropMouseGrabbing();
   
-    nsView *rootView = mViewManager->GetRootViewImpl();
+    nsView *rootView = mViewManager->GetRootView();
     
     if (rootView)
     {
       // Root views can have parents!
       if (mParent)
       {
         mViewManager->RemoveChild(this);
       }
@@ -220,17 +220,17 @@ nsIntRect nsView::CalcWidgetBounds(nsWin
 
   return newBounds;
 }
 
 void nsView::DoResetWidgetBounds(bool aMoveOnly,
                                  bool aInvalidateChangedSize) {
   // The geometry of a root view's widget is controlled externally,
   // NOT by sizing or positioning the view
-  if (mViewManager->GetRootViewImpl() == this) {
+  if (mViewManager->GetRootView() == this) {
     return;
   }
   
   nsIntRect curBounds;
   mWindow->GetClientBounds(curBounds);
 
   nsWindowType type;
   mWindow->GetWindowType(type);
@@ -342,17 +342,17 @@ void nsView::SetFloating(bool aFloatingV
 	if (aFloatingView)
 		mVFlags |= NS_VIEW_FLAG_FLOATING;
 	else
 		mVFlags &= ~NS_VIEW_FLAG_FLOATING;
 }
 
 void nsView::InvalidateHierarchy(nsViewManager *aViewManagerParent)
 {
-  if (mViewManager->GetRootViewImpl() == this)
+  if (mViewManager->GetRootView() == this)
     mViewManager->InvalidateHierarchy();
 
   for (nsView *child = mFirstChild; child; child = child->GetNextSibling())
     child->InvalidateHierarchy(aViewManagerParent);
 }
 
 void nsView::InsertChild(nsView *aChild, nsView *aSibling)
 {
@@ -375,17 +375,17 @@ void nsView::InsertChild(nsView *aChild,
       mFirstChild = aChild;
     }
     aChild->SetParent(this);
 
     // If we just inserted a root view, then update the RootViewManager
     // on all view managers in the new subtree.
 
     nsViewManager *vm = aChild->GetViewManagerInternal();
-    if (vm->GetRootViewImpl() == aChild)
+    if (vm->GetRootView() == aChild)
     {
       aChild->InvalidateHierarchy(nullptr); // don't care about releasing grabs
     }
   }
 }
 
 void nsView::RemoveChild(nsView *child)
 {
@@ -411,17 +411,17 @@ void nsView::RemoveChild(nsView *child)
 	    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->GetViewManagerInternal();
-    if (vm->GetRootViewImpl() == child)
+    if (vm->GetRootView() == child)
     {
       child->InvalidateHierarchy(GetViewManagerInternal());
     }
   }
 }
 
 // Native widgets ultimately just can't deal with the awesome power of
 // CSS2 z-index. However, we set the z-index on the widget anyway
@@ -851,25 +851,25 @@ nsIWidget* nsView::GetNearestWidget(nsPo
     *aOffset = pt;
   }
   return v->GetWidget();
 }
 
 bool nsView::IsRoot() const
 {
   NS_ASSERTION(mViewManager != nullptr," View manager is null in nsView::IsRoot()");
-  return mViewManager->GetRootViewImpl() == this;
+  return mViewManager->GetRootView() == this;
 }
 
 nsRect
 nsView::GetBoundsInParentUnits() const
 {
   nsView* parent = GetParent();
   nsViewManager* VM = GetViewManagerInternal();
-  if (this != VM->GetRootViewImpl() || !parent) {
+  if (this != VM->GetRootView() || !parent) {
     return mDimBounds;
   }
   int32_t ourAPD = VM->AppUnitsPerDevPixel();
   int32_t parentAPD = parent->GetViewManagerInternal()->AppUnitsPerDevPixel();
   return mDimBounds.ConvertAppUnitsRoundOut(ourAPD, parentAPD);
 }
 
 nsPoint
--- a/view/src/nsViewManager.cpp
+++ b/view/src/nsViewManager.cpp
@@ -119,47 +119,49 @@ nsViewManager::~nsViewManager()
     gViewManagers = nullptr;
   }
 
   mPresShell = nullptr;
 }
 
 // We don't hold a reference to the presentation context because it
 // holds a reference to us.
-NS_IMETHODIMP nsViewManager::Init(nsDeviceContext* aContext)
+nsresult
+nsViewManager::Init(nsDeviceContext* aContext)
 {
   NS_PRECONDITION(nullptr != aContext, "null ptr");
 
   if (nullptr == aContext) {
     return NS_ERROR_NULL_POINTER;
   }
   if (nullptr != mContext) {
     return NS_ERROR_ALREADY_INITIALIZED;
   }
   mContext = aContext;
 
   return NS_OK;
 }
 
-NS_IMETHODIMP_(nsView *)
+nsView*
 nsViewManager::CreateView(const nsRect& aBounds,
                           const nsView* aParent,
                           nsViewVisibility aVisibilityFlag)
 {
   nsView *v = new nsView(this, aVisibilityFlag);
   if (v) {
     v->SetParent(const_cast<nsView*>(aParent));
     v->SetPosition(aBounds.x, aBounds.y);
     nsRect dim(0, 0, aBounds.width, aBounds.height);
     v->SetDimensions(dim, false);
   }
   return v;
 }
 
-NS_IMETHODIMP nsViewManager::SetRootView(nsView *aView)
+void
+nsViewManager::SetRootView(nsView *aView)
 {
   NS_PRECONDITION(!aView || aView->GetViewManager() == this,
                   "Unexpected viewmanager on root view");
   
   // Do NOT destroy the current root view. It's the caller's responsibility
   // to destroy it
   mRootView = aView;
 
@@ -171,54 +173,53 @@ NS_IMETHODIMP nsViewManager::SetRootView
       parent->InsertChild(mRootView, nullptr);
     } else {
       InvalidateHierarchy();
     }
 
     mRootView->SetZIndex(false, 0, false);
   }
   // Else don't touch mRootViewManager
-
-  return NS_OK;
 }
 
-NS_IMETHODIMP nsViewManager::GetWindowDimensions(nscoord *aWidth, nscoord *aHeight)
+void
+nsViewManager::GetWindowDimensions(nscoord *aWidth, nscoord *aHeight)
 {
   if (nullptr != mRootView) {
     if (mDelayedResize == nsSize(NSCOORD_NONE, NSCOORD_NONE)) {
       nsRect dim = mRootView->GetDimensions();
       *aWidth = dim.width;
       *aHeight = dim.height;
     } else {
       *aWidth = mDelayedResize.width;
       *aHeight = mDelayedResize.height;
     }
   }
   else
     {
       *aWidth = 0;
       *aHeight = 0;
     }
-  return NS_OK;
 }
 
 void nsViewManager::DoSetWindowDimensions(nscoord aWidth, nscoord aHeight)
 {
   nsRect oldDim = mRootView->GetDimensions();
   nsRect newDim(0, 0, aWidth, aHeight);
   // We care about resizes even when one dimension is already zero.
   if (!oldDim.IsEqualEdges(newDim)) {
     // Don't resize the widget. It is already being set elsewhere.
     mRootView->SetDimensions(newDim, true, false);
     if (mPresShell)
       mPresShell->ResizeReflow(aWidth, aHeight);
   }
 }
 
-NS_IMETHODIMP nsViewManager::SetWindowDimensions(nscoord aWidth, nscoord aHeight)
+void
+nsViewManager::SetWindowDimensions(nscoord aWidth, nscoord aHeight)
 {
   if (mRootView) {
     if (mRootView->IsEffectivelyVisible() && mPresShell && mPresShell->IsVisible()) {
       if (mDelayedResize != nsSize(NSCOORD_NONE, NSCOORD_NONE) &&
           mDelayedResize != nsSize(aWidth, aHeight)) {
         // We have a delayed resize; that now obsolete size may already have
         // been flushed to the PresContext so we need to update the PresContext
         // with the new size because if the new size is exactly the same as the
@@ -231,34 +232,32 @@ NS_IMETHODIMP nsViewManager::SetWindowDi
       DoSetWindowDimensions(aWidth, aHeight);
     } else {
       mDelayedResize.SizeTo(aWidth, aHeight);
       if (mPresShell && mPresShell->GetDocument()) {
         mPresShell->GetDocument()->SetNeedStyleFlush();
       }
     }
   }
-
-  return NS_OK;
 }
 
-NS_IMETHODIMP nsViewManager::FlushDelayedResize(bool aDoReflow)
+void
+nsViewManager::FlushDelayedResize(bool aDoReflow)
 {
   if (mDelayedResize != nsSize(NSCOORD_NONE, NSCOORD_NONE)) {
     if (aDoReflow) {
       DoSetWindowDimensions(mDelayedResize.width, mDelayedResize.height);
       mDelayedResize.SizeTo(NSCOORD_NONE, NSCOORD_NONE);
     } else if (mPresShell) {
       nsPresContext* presContext = mPresShell->GetPresContext();
       if (presContext) {
         presContext->SetVisibleArea(nsRect(nsPoint(0, 0), mDelayedResize));
       }
     }
   }
-  return NS_OK;
 }
 
 // Convert aIn from being relative to and in appunits of aFromView, to being
 // relative to and in appunits of aToView.
 static nsRegion ConvertRegionBetweenViews(const nsRegion& aIn,
                                           nsView* aFromView,
                                           nsView* aToView)
 {
@@ -442,20 +441,21 @@ void nsViewManager::FlushDirtyRegionToWi
   }
   nsRegion r =
     ConvertRegionBetweenViews(*dirtyRegion, aView, nearestViewWithWidget);
   nsViewManager* widgetVM = nearestViewWithWidget->GetViewManagerInternal();
   widgetVM->InvalidateWidgetArea(nearestViewWithWidget, r);
   dirtyRegion->SetEmpty();
 }
 
-NS_IMETHODIMP nsViewManager::InvalidateView(nsView *aView)
+void
+nsViewManager::InvalidateView(nsView *aView)
 {
   // Mark the entire view as damaged
-  return InvalidateView(aView, aView->GetDimensions());
+  InvalidateView(aView, aView->GetDimensions());
 }
 
 static void
 AddDirtyRegion(nsView *aView, const nsRegion &aDamagedRegion)
 {
   nsRegion* dirtyRegion = aView->GetDirtyRegion();
   if (!dirtyRegion)
     return;
@@ -564,65 +564,65 @@ ShouldIgnoreInvalidation(nsViewManager* 
       return true;
     }
     nsView* view = aVM->GetRootView()->GetParent();
     aVM = view ? view->GetViewManagerInternal() : nullptr;
   }
   return false;
 }
 
-nsresult nsViewManager::InvalidateView(nsView *aView, const nsRect &aRect)
+void
+nsViewManager::InvalidateView(nsView *aView, const nsRect &aRect)
 {
   // If painting is suppressed in the presshell or an ancestor drop all
   // invalidates, it will invalidate everything when it unsuppresses.
   if (ShouldIgnoreInvalidation(this)) {
-    return NS_OK;
+    return;
   }
 
-  return InvalidateViewNoSuppression(aView, aRect);
+  InvalidateViewNoSuppression(aView, aRect);
 }
 
-NS_IMETHODIMP nsViewManager::InvalidateViewNoSuppression(nsView *aView,
-                                                         const nsRect &aRect)
+void
+nsViewManager::InvalidateViewNoSuppression(nsView *aView,
+                                           const nsRect &aRect)
 {
   NS_PRECONDITION(nullptr != aView, "null view");
 
   NS_ASSERTION(aView->GetViewManager() == this,
                "InvalidateViewNoSuppression called on view we don't own");
 
   nsRect damagedRect(aRect);
   if (damagedRect.IsEmpty()) {
-    return NS_OK;
+    return;
   }
 
   nsView* displayRoot = GetDisplayRootFor(aView);
   nsViewManager* displayRootVM = displayRoot->GetViewManagerInternal();
   // Propagate the update to the displayRoot, since iframes, for example,
   // can overlap each other and be translucent.  So we have to possibly
   // invalidate our rect in each of the widgets we have lying about.
   damagedRect.MoveBy(aView->GetOffsetTo(displayRoot));
   int32_t rootAPD = displayRootVM->AppUnitsPerDevPixel();
   int32_t APD = AppUnitsPerDevPixel();
   damagedRect = damagedRect.ConvertAppUnitsRoundOut(APD, rootAPD);
 
   // accumulate this rectangle in the view's dirty region, so we can
   // process it later.
   AddDirtyRegion(displayRoot, nsRegion(damagedRect));
-
-  return NS_OK;
 }
 
-NS_IMETHODIMP nsViewManager::InvalidateAllViews()
+void
+nsViewManager::InvalidateAllViews()
 {
   if (RootViewManager() != this) {
     return RootViewManager()->InvalidateAllViews();
   }
   
   InvalidateViews(mRootView);
-  return NS_OK;
 }
 
 void nsViewManager::InvalidateViews(nsView *aView)
 {
   // Invalidate this view.
   InvalidateView(aView);
 
   // Invalidate all children as well.
@@ -703,17 +703,18 @@ bool nsViewManager::PaintWindow(nsIWidge
 void nsViewManager::DidPaintWindow()
 {
   nsCOMPtr<nsIPresShell> shell = mPresShell;
   if (shell) {
     shell->DidPaintWindow();
   }
 }
 
-nsresult nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsView* aView, nsEventStatus* aStatus)
+void
+nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsView* aView, nsEventStatus* aStatus)
 {
   SAMPLE_LABEL("event", "nsViewManager::DispatchEvent");
 
   if ((NS_IS_MOUSE_EVENT(aEvent) &&
        // Ignore mouse events that we synthesize.
        static_cast<nsMouseEvent*>(aEvent)->reason == nsMouseEvent::eReal &&
        // Ignore mouse exit and enter (we'll get moves if the user
        // is really moving the mouse) since we get them when we
@@ -754,23 +755,21 @@ nsresult nsViewManager::DispatchEvent(ns
   }
 
   if (nullptr != frame) {
     // Hold a refcount to the presshell. The continued existence of the
     // presshell will delay deletion of this view hierarchy should the event
     // want to cause its destruction in, say, some JavaScript event handler.
     nsCOMPtr<nsIPresShell> shell = view->GetViewManager()->GetPresShell();
     if (shell) {
-      return shell->HandleEvent(frame, aEvent, false, aStatus);
+      shell->HandleEvent(frame, aEvent, false, aStatus);
     }
   }
 
   *aStatus = nsEventStatus_eIgnore;
-
-  return NS_OK;
 }
 
 // Recursively reparent widgets if necessary 
 
 void nsViewManager::ReparentChildWidgets(nsView* aView, nsIWidget *aNewWidget)
 {
   NS_PRECONDITION(aNewWidget, "");
 
@@ -824,18 +823,19 @@ void nsViewManager::ReparentWidgets(nsVi
     if (parentWidget) {
       ReparentChildWidgets(aView, parentWidget);
       return;
     }
     NS_WARNING("Can not find a widget for the parent view");
   }
 }
 
-NS_IMETHODIMP nsViewManager::InsertChild(nsView *aParent, nsView *aChild, nsView *aSibling,
-                                         bool aAfter)
+void
+nsViewManager::InsertChild(nsView *aParent, nsView *aChild, nsView *aSibling,
+                           bool aAfter)
 {
   NS_PRECONDITION(nullptr != aParent, "null ptr");
   NS_PRECONDITION(nullptr != aChild, "null ptr");
   NS_ASSERTION(aSibling == nullptr || aSibling->GetParent() == aParent,
                "tried to insert view with invalid sibling");
   NS_ASSERTION(!IsViewInserted(aChild), "tried to insert an already-inserted view");
 
   if ((nullptr != aParent) && (nullptr != aChild))
@@ -886,44 +886,44 @@ NS_IMETHODIMP nsViewManager::InsertChild
       if (aParent->GetFloating())
         aChild->SetFloating(true);
 
       //and mark this area as dirty if the view is visible...
 
       if (nsViewVisibility_kHide != aChild->GetVisibility())
         aChild->GetViewManagerInternal()->InvalidateView(aChild);
     }
-  return NS_OK;
 }
 
-NS_IMETHODIMP nsViewManager::InsertChild(nsView *aParent, nsView *aChild, int32_t aZIndex)
+void
+nsViewManager::InsertChild(nsView *aParent, nsView *aChild, int32_t 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, false, aZIndex, false);
-  return InsertChild(aParent, aChild, nullptr, true);
+  InsertChild(aParent, aChild, nullptr, true);
 }
 
-NS_IMETHODIMP nsViewManager::RemoveChild(nsView *aChild)
+void
+nsViewManager::RemoveChild(nsView *aChild)
 {
-  NS_ENSURE_ARG_POINTER(aChild);
+  NS_ASSERTION(aChild, "aChild must not be null");
 
   nsView* parent = aChild->GetParent();
 
   if (nullptr != parent) {
     NS_ASSERTION(aChild->GetViewManager() == this ||
                  parent->GetViewManager() == this, "wrong view manager");
     aChild->GetViewManagerInternal()->InvalidateView(aChild);
     parent->RemoveChild(aChild);
   }
-
-  return NS_OK;
 }
 
-NS_IMETHODIMP nsViewManager::MoveViewTo(nsView *aView, nscoord aX, nscoord aY)
+void
+nsViewManager::MoveViewTo(nsView *aView, nscoord aX, nscoord aY)
 {
   NS_ASSERTION(aView->GetViewManager() == this, "wrong view manager");
   nsPoint oldPt = aView->GetPosition();
   nsRect oldBounds = aView->GetBoundsInParentUnits();
   aView->SetPosition(aX, aY);
 
   // only do damage control if the view is visible
 
@@ -932,17 +932,16 @@ NS_IMETHODIMP nsViewManager::MoveViewTo(
       nsView* parentView = aView->GetParent();
       if (parentView) {
         nsViewManager* parentVM = parentView->GetViewManagerInternal();
         parentVM->InvalidateView(parentView, oldBounds);
         parentVM->InvalidateView(parentView, aView->GetBoundsInParentUnits());
       }
     }
   }
-  return NS_OK;
 }
 
 void nsViewManager::InvalidateHorizontalBandDifference(nsView *aView, const nsRect& aRect, const nsRect& aCutOut,
   nscoord aY1, nscoord aY2, bool aInCutOut) {
   nscoord height = aY2 - aY1;
   if (aRect.x < aCutOut.x) {
     nsRect r(aRect.x, aY1, aCutOut.x - aRect.x, height);
     InvalidateView(aView, r);
@@ -966,17 +965,18 @@ void nsViewManager::InvalidateRectDiffer
   if (aCutOut.y < aCutOut.YMost()) {
     InvalidateHorizontalBandDifference(aView, aRect, aCutOut, aCutOut.y, aCutOut.YMost(), true);
   }
   if (aCutOut.YMost() < aRect.YMost()) {
     InvalidateHorizontalBandDifference(aView, aRect, aCutOut, aCutOut.YMost(), aRect.YMost(), false);
   }
 }
 
-NS_IMETHODIMP nsViewManager::ResizeView(nsView *aView, const nsRect &aRect, bool aRepaintExposedAreaOnly)
+void
+nsViewManager::ResizeView(nsView *aView, const nsRect &aRect, bool aRepaintExposedAreaOnly)
 {
   NS_ASSERTION(aView->GetViewManager() == this, "wrong view manager");
 
   nsRect oldDimensions = aView->GetDimensions();
   if (!oldDimensions.IsEqualEdges(aRect)) {
     // resize the view.
     // Prevent Invalidation of hidden views 
     if (aView->GetVisibility() == nsViewVisibility_kHide) {
@@ -1001,30 +1001,28 @@ NS_IMETHODIMP nsViewManager::ResizeView(
     }
   }
 
   // Note that if layout resizes the view and the view has a custom clip
   // region set, then we expect layout to update the clip region too. Thus
   // in the case where mClipRect has been optimized away to just be a null
   // pointer, and this resize is implicitly changing the clip rect, it's OK
   // because layout will change it back again if necessary.
-
-  return NS_OK;
 }
 
-NS_IMETHODIMP nsViewManager::SetViewFloating(nsView *aView, bool aFloating)
+void
+nsViewManager::SetViewFloating(nsView *aView, bool aFloating)
 {
   NS_ASSERTION(!(nullptr == aView), "no view");
 
   aView->SetFloating(aFloating);
-
-  return NS_OK;
 }
 
-NS_IMETHODIMP nsViewManager::SetViewVisibility(nsView *aView, nsViewVisibility aVisible)
+void
+nsViewManager::SetViewVisibility(nsView *aView, nsViewVisibility aVisible)
 {
   NS_ASSERTION(aView->GetViewManager() == this, "wrong view manager");
 
   if (aVisible != aView->GetVisibility()) {
     aView->SetVisibility(aVisible);
 
     if (IsViewInserted(aView)) {
       if (!aView->HasWidget()) {
@@ -1036,17 +1034,16 @@ NS_IMETHODIMP nsViewManager::SetViewVisi
           }
         }
         else {
           InvalidateView(aView);
         }
       }
     }
   }
-  return NS_OK;
 }
 
 bool nsViewManager::IsViewInserted(nsView *aView)
 {
   if (mRootView == aView) {
     return true;
   } else if (aView->GetParent() == nullptr) {
     return false;
@@ -1057,51 +1054,48 @@ bool nsViewManager::IsViewInserted(nsVie
         return true;
       }        
       view = view->GetNextSibling();
     }
     return false;
   }
 }
 
-NS_IMETHODIMP nsViewManager::SetViewZIndex(nsView *aView, bool aAutoZIndex, int32_t aZIndex, bool aTopMost)
+void
+nsViewManager::SetViewZIndex(nsView *aView, bool aAutoZIndex, int32_t aZIndex, bool aTopMost)
 {
-  nsresult  rv = NS_OK;
-
   NS_ASSERTION((aView != nullptr), "no view");
 
   // don't allow the root view's z-index to be changed. It should always be zero.
   // This could be removed and replaced with a style rule, or just removed altogether, with interesting consequences
   if (aView == mRootView) {
-    return rv;
+    return;
   }
 
   bool oldTopMost = aView->IsTopMost();
   bool oldIsAuto = aView->GetZIndexIsAuto();
 
   if (aAutoZIndex) {
     aZIndex = 0;
   }
 
   int32_t oldidx = aView->GetZIndex();
   aView->SetZIndex(aAutoZIndex, aZIndex, aTopMost);
 
   if (oldidx != aZIndex || oldTopMost != aTopMost ||
       oldIsAuto != aAutoZIndex) {
     InvalidateView(aView);
   }
-
-  return rv;
 }
 
-NS_IMETHODIMP nsViewManager::GetDeviceContext(nsDeviceContext *&aContext)
+void
+nsViewManager::GetDeviceContext(nsDeviceContext *&aContext)
 {
   aContext = mContext;
   NS_IF_ADDREF(aContext);
-  return NS_OK;
 }
 
 nsViewManager*
 nsViewManager::IncrementDisableRefreshCount()
 {
   if (!IsRootVM()) {
     return RootViewManager()->IncrementDisableRefreshCount();
   }
@@ -1114,49 +1108,50 @@ nsViewManager::IncrementDisableRefreshCo
 void
 nsViewManager::DecrementDisableRefreshCount()
 {
   NS_ASSERTION(IsRootVM(), "Should only be called on root");
   --mRefreshDisableCount;
   NS_ASSERTION(mRefreshDisableCount >= 0, "Invalid refresh disable count!");
 }
 
-NS_IMETHODIMP nsViewManager::GetRootWidget(nsIWidget **aWidget)
+void
+nsViewManager::GetRootWidget(nsIWidget **aWidget)
 {
   if (!mRootView) {
     *aWidget = nullptr;
-    return NS_OK;
+    return;
   }
   if (mRootView->HasWidget()) {
     *aWidget = mRootView->GetWidget();
     NS_ADDREF(*aWidget);
-    return NS_OK;
+    return;
   }
-  if (mRootView->GetParent())
-    return mRootView->GetParent()->GetViewManagerInternal()->GetRootWidget(aWidget);
+  if (mRootView->GetParent()) {
+    mRootView->GetParent()->GetViewManagerInternal()->GetRootWidget(aWidget);
+    return;
+  }
   *aWidget = nullptr;
-  return NS_OK;
 }
 
 nsIntRect nsViewManager::ViewToWidget(nsView *aView, const nsRect &aRect) const
 {
   NS_ASSERTION(aView->GetViewManager() == this, "wrong view manager");
 
   // account for the view's origin not lining up with the widget's
   nsRect rect = aRect + aView->ViewToWidgetOffset();
 
   // finally, convert to device coordinates.
   return rect.ToOutsidePixels(AppUnitsPerDevPixel());
 }
 
-NS_IMETHODIMP
+void
 nsViewManager::IsPainting(bool& aIsPainting)
 {
   aIsPainting = IsPainting();
-  return NS_OK;
 }
 
 void
 nsViewManager::ProcessPendingUpdates()
 {
   if (!IsRootVM()) {
     RootViewManager()->ProcessPendingUpdates();
     return;
@@ -1209,21 +1204,20 @@ nsViewManager::CallWillPaintOnObservers(
         if (shell) {
           shell->WillPaint(aWillSendDidPaint);
         }
       }
     }
   }
 }
 
-NS_IMETHODIMP
+void
 nsViewManager::GetLastUserEventTime(uint32_t& aTime)
 {
   aTime = gLastUserEventTime;
-  return NS_OK;
 }
 
 void
 nsViewManager::InvalidateHierarchy()
 {
   if (mRootView) {
     if (!IsRootVM()) {
       NS_RELEASE(mRootViewManager);