Bug 617539 - remove nsIWidget_MOZILLA_2_0_BRANCH, r=jimm
authorBenjamin Smedberg <benjamin@smedbergs.us>
Fri, 25 Mar 2011 11:03:35 -0400
changeset 63893 e9ab3e8d43031700ae02ca5104bff6d91cc75453
parent 63892 3e2d1dd1962ed1d886d2623f8a2246fe0f652288
child 63894 6f5809f445328167f2eb839a9525d4b41ef14e46
child 64414 79f09037701d762eed414136f28bf730c173614a
push idunknown
push userunknown
push dateunknown
reviewersjimm
bugs617539
milestone2.2a1pre
Bug 617539 - remove nsIWidget_MOZILLA_2_0_BRANCH, r=jimm
content/base/src/nsContentUtils.cpp
content/events/src/nsIMEStateManager.cpp
dom/base/nsDOMWindowUtils.cpp
dom/ipc/TabParent.cpp
gfx/layers/opengl/LayerManagerOGL.cpp
layout/base/nsLayoutUtils.cpp
widget/public/nsIWidget.h
widget/src/gtk2/nsWindow.cpp
widget/src/xpwidgets/nsBaseWidget.cpp
widget/src/xpwidgets/nsBaseWidget.h
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -6388,19 +6388,19 @@ LayerManagerForDocumentInternal(nsIDocum
     if (VM) {
       nsIView* rootView = nsnull;
       if (NS_SUCCEEDED(VM->GetRootView(rootView)) && rootView) {
         nsIView* displayRoot = GetDisplayRootFor(rootView);
         if (displayRoot) {
           nsIWidget* widget = displayRoot->GetNearestWidget(nsnull);
           if (widget) {
             nsRefPtr<LayerManager> manager =
-              static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(widget)->
-                GetLayerManager(aRequirePersistent ? nsIWidget_MOZILLA_2_0_BRANCH::LAYER_MANAGER_PERSISTENT : 
-                                                     nsIWidget_MOZILLA_2_0_BRANCH::LAYER_MANAGER_CURRENT,
+              widget->
+                GetLayerManager(aRequirePersistent ? nsIWidget::LAYER_MANAGER_PERSISTENT : 
+                                                     nsIWidget::LAYER_MANAGER_CURRENT,
                                 aAllowRetaining);
             return manager.forget();
           }
         }
       }
     }
   }
 
--- a/content/events/src/nsIMEStateManager.cpp
+++ b/content/events/src/nsIMEStateManager.cpp
@@ -161,19 +161,18 @@ nsIMEStateManager::OnChangeFocus(nsPresC
   if (aPresContext == sPresContext && aContent == sContent) {
     // actual focus isn't changing, but if IME enabled state is changing,
     // we should do it.
     PRUint32 newEnabledState = newState & nsIContent::IME_STATUS_MASK_ENABLED;
     if (newEnabledState == 0) {
       // the enabled state isn't changing, we should do nothing.
       return NS_OK;
     }
-    nsIWidget_MOZILLA_2_0_BRANCH* widget2 = static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(widget.get());
     IMEContext context;
-    if (!widget2 || NS_FAILED(widget2->GetInputMode(context))) {
+    if (!widget || NS_FAILED(widget->GetInputMode(context))) {
       // this platform doesn't support IME controlling
       return NS_OK;
     }
     if (context.mStatus ==
         nsContentUtils::GetWidgetStatusFromIMEStatus(newEnabledState)) {
       // the enabled state isn't changing.
       return NS_OK;
     }
@@ -218,19 +217,18 @@ nsIMEStateManager::UpdateIMEState(PRUint
   NS_PRECONDITION(aNewIMEState != 0, "aNewIMEState doesn't specify new state.");
   nsCOMPtr<nsIWidget> widget = GetWidget(sPresContext);
   if (!widget) {
     NS_WARNING("focused widget is not found");
     return;
   }
 
   // Don't update IME state when enabled state isn't actually changed.
-  nsIWidget_MOZILLA_2_0_BRANCH* widget2 = static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(widget.get());
   IMEContext context;
-  nsresult rv = widget2->GetInputMode(context);
+  nsresult rv = widget->GetInputMode(context);
   if (NS_FAILED(rv)) {
     return; // This platform doesn't support controling the IME state.
   }
   PRUint32 newEnabledState = aNewIMEState & nsIContent::IME_STATUS_MASK_ENABLED;
   if (context.mStatus ==
         nsContentUtils::GetWidgetStatusFromIMEStatus(newEnabledState)) {
     return;
   }
@@ -289,18 +287,17 @@ private:
 };
 
 void
 nsIMEStateManager::SetIMEState(PRUint32 aState,
                                nsIContent* aContent,
                                nsIWidget* aWidget)
 {
   if (aState & nsIContent::IME_STATUS_MASK_ENABLED) {
-    nsIWidget_MOZILLA_2_0_BRANCH* widget2 = static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(aWidget);
-    if (!widget2)
+    if (!aWidget)
       return;
 
     PRUint32 state = nsContentUtils::GetWidgetStatusFromIMEStatus(aState);
     IMEContext context;
     context.mStatus = state;
     
     if (aContent && aContent->GetNameSpaceID() == kNameSpaceID_XHTML &&
         (aContent->Tag() == nsGkAtoms::input ||
@@ -325,17 +322,17 @@ nsIMEStateManager::SetIMEState(PRUint32 
                      static_cast<nsHTMLFormElement*>(formElement)->HasSingleTextControl()) {
             willSubmit = PR_TRUE;
           }
         }
         context.mActionHint.Assign(willSubmit ? NS_LITERAL_STRING("go") : NS_LITERAL_STRING("next"));
       }
     }
 
-    widget2->SetInputMode(context);
+    aWidget->SetInputMode(context);
 
     nsContentUtils::AddScriptRunner(new IMEEnabledStateChangedEvent(state));
   }
   if (aState & nsIContent::IME_STATUS_MASK_OPENED) {
     PRBool open = !!(aState & nsIContent::IME_STATUS_OPEN);
     aWidget->SetIMEOpenState(open);
   }
 }
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -1001,57 +1001,54 @@ nsDOMWindowUtils::GetIMEIsOpen(PRBool *a
 {
   NS_ENSURE_ARG_POINTER(aState);
 
   nsCOMPtr<nsIWidget> widget = GetWidget();
   if (!widget)
     return NS_ERROR_FAILURE;
 
   // Open state should not be available when IME is not enabled.
-  nsIWidget_MOZILLA_2_0_BRANCH* widget2 = static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(widget.get());
   IMEContext context;
-  nsresult rv = widget2->GetInputMode(context);
+  nsresult rv = widget->GetInputMode(context);
   NS_ENSURE_SUCCESS(rv, rv);
   if (context.mStatus != nsIWidget::IME_STATUS_ENABLED)
     return NS_ERROR_NOT_AVAILABLE;
 
   return widget->GetIMEOpenState(aState);
 }
 
 NS_IMETHODIMP
 nsDOMWindowUtils::GetIMEStatus(PRUint32 *aState)
 {
   NS_ENSURE_ARG_POINTER(aState);
 
   nsCOMPtr<nsIWidget> widget = GetWidget();
   if (!widget)
     return NS_ERROR_FAILURE;
 
-  nsIWidget_MOZILLA_2_0_BRANCH* widget2 = static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(widget.get());
   IMEContext context;
-  nsresult rv = widget2->GetInputMode(context);
+  nsresult rv = widget->GetInputMode(context);
   NS_ENSURE_SUCCESS(rv, rv);
 
   *aState = context.mStatus;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMWindowUtils::GetFocusedInputType(char** aType)
 {
   NS_ENSURE_ARG_POINTER(aType);
 
   nsCOMPtr<nsIWidget> widget = GetWidget();
   if (!widget) {
     return NS_ERROR_FAILURE;
   }
 
-  nsIWidget_MOZILLA_2_0_BRANCH* widget2 = static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(widget.get());
   IMEContext context;
-  nsresult rv = widget2->GetInputMode(context);
+  nsresult rv = widget->GetInputMode(context);
   NS_ENSURE_SUCCESS(rv, rv);
 
   *aType = ToNewCString(context.mHTMLInputType);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMWindowUtils::FindElementWithViewId(nsViewID aID,
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -513,39 +513,34 @@ TabParent::RecvEndIMEComposition(const P
 
 bool
 TabParent::RecvGetIMEEnabled(PRUint32* aValue)
 {
   nsCOMPtr<nsIWidget> widget = GetWidget();
   if (!widget)
     return true;
 
-  nsIWidget_MOZILLA_2_0_BRANCH* widget2 = static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(widget.get());
   IMEContext context;
-  if (widget2) {
-    widget2->GetInputMode(context);
-    *aValue = context.mStatus;
-  }
+  widget->GetInputMode(context);
+  *aValue = context.mStatus;
   return true;
 }
 
 bool
 TabParent::RecvSetInputMode(const PRUint32& aValue, const nsString& aType, const nsString& aAction)
 {
   nsCOMPtr<nsIWidget> widget = GetWidget();
   if (!widget || !AllowContentIME())
     return true;
 
-  nsIWidget_MOZILLA_2_0_BRANCH* widget2 = static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(widget.get());
-
   IMEContext context;
   context.mStatus = aValue;
   context.mHTMLInputType.Assign(aType);
   context.mActionHint.Assign(aAction);
-  widget2->SetInputMode(context);
+  widget->SetInputMode(context);
 
   nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
   if (!observerService)
     return true;
 
   nsAutoString state;
   state.AppendInt(aValue);
   observerService->NotifyObservers(nsnull, "ime-enabled-state-changed", state.get());
--- a/gfx/layers/opengl/LayerManagerOGL.cpp
+++ b/gfx/layers/opengl/LayerManagerOGL.cpp
@@ -595,17 +595,17 @@ LayerManagerOGL::Render()
 
   mGLContext->fClearColor(0.0, 0.0, 0.0, 0.0);
   mGLContext->fClear(LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT);
 
   // Render our layers.
   RootLayer()->RenderLayer(mGLContext->IsDoubleBuffered() ? 0 : mBackBufferFBO,
                            nsIntPoint(0, 0));
                            
-  static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(mWidget)->DrawOver(this, rect);
+  mWidget->DrawOver(this, rect);
 
   if (mTarget) {
     CopyToTarget();
     return;
   }
 
   if (mGLContext->IsDoubleBuffered()) {
     mGLContext->SwapBuffers();
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -1579,43 +1579,41 @@ nsLayoutUtils::PaintFrame(nsIRenderingCo
       // the paint in such a way that we can't use them.  We're going
       // to display something different from what we'd normally paint
       // in a window, so make sure we flush out any retained layer
       // trees before *and after* we draw.  Callers should be fixed to
       // not do this.
       NS_WARNING("Flushing retained layers!");
       flags |= nsDisplayList::PAINT_FLUSH_LAYERS;
     } else if (!(aFlags & PAINT_DOCUMENT_RELATIVE)) {
-      nsIWidget_MOZILLA_2_0_BRANCH *widget2 =
-        static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(aFrame->GetNearestWidget());
-      if (widget2) {
+      nsIWidget *widget = aFrame->GetNearestWidget();
+      if (widget) {
         builder.SetFinalTransparentRegion(visibleRegion);
         // If we're finished building display list items for painting of the outermost
         // pres shell, notify the widget about any toolbars we've encountered.
-        widget2->UpdateThemeGeometries(builder.GetThemeGeometries());
+        widget->UpdateThemeGeometries(builder.GetThemeGeometries());
       }
     }
   }
   if (aFlags & PAINT_EXISTING_TRANSACTION) {
     flags |= nsDisplayList::PAINT_EXISTING_TRANSACTION;
   }
 
   list.PaintRoot(&builder, aRenderingContext, flags);
 
   // Update the widget's transparent region information. This sets
   // glass boundaries on Windows.
   if ((aFlags & PAINT_WIDGET_LAYERS) &&
       !willFlushRetainedLayers &&
       !(aFlags & PAINT_DOCUMENT_RELATIVE)) {
-    nsIWidget_MOZILLA_2_0_BRANCH *widget2 =
-      static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(aFrame->GetNearestWidget());
-    if (widget2) {
+    nsIWidget *widget = aFrame->GetNearestWidget();
+    if (widget) {
       PRInt32 pixelRatio = presContext->AppUnitsPerDevPixel();
       nsIntRegion visibleWindowRegion(visibleRegion.ToOutsidePixels(presContext->AppUnitsPerDevPixel()));
-      widget2->UpdateTransparentRegion(visibleWindowRegion);
+      widget->UpdateTransparentRegion(visibleWindowRegion);
     }
   }
 
 #ifdef DEBUG
   if (gDumpPaintList) {
     fprintf(stderr, "Painting --- after optimization:\n");
     nsFrame::PrintDisplayList(&builder, list);
 
--- a/widget/public/nsIWidget.h
+++ b/widget/public/nsIWidget.h
@@ -113,25 +113,19 @@ typedef nsEventStatus (* EVENT_CALLBACK)
 #define NS_NATIVE_PLUGIN_PORT_CG    101
 #endif
 #ifdef XP_WIN
 #define NS_NATIVE_TSF_THREAD_MGR       100
 #define NS_NATIVE_TSF_CATEGORY_MGR     101
 #define NS_NATIVE_TSF_DISPLAY_ATTR_MGR 102
 #endif
 
-// cc443f0b-af39-415d-9c4b-7e06eaa8b13b
 #define NS_IWIDGET_IID \
-  { 0xcc443f0b, 0xaf39, 0x415d, \
-    { 0x9c, 0x4b, 0x7e, 0x06, 0xea, 0xa8, 0xb1, 0x3b } }
-
-// {8FC2D005-5359-4dbf-ACB1-701992FB4617}
-#define NS_IWIDGET_MOZILLA_2_0_BRANCH_IID \
-  { 0x8fc2d005, 0x5359, 0x4dbf, \
-    { 0xac, 0xb1, 0x70, 0x19, 0x92, 0xfb, 0x46, 0x17 } }
+  { 0xe5c2efd1, 0xfbae, 0x4a74, \
+    { 0xb2, 0xeb, 0xf3, 0x49, 0xf5, 0x72, 0xca, 0x71 } }
 
 /*
  * Window shadow styles
  * Also used for the -moz-window-shadow CSS property
  */
 
 #define NS_STYLE_WINDOW_SHADOW_NONE             0
 #define NS_STYLE_WINDOW_SHADOW_DEFAULT          1
@@ -786,22 +780,16 @@ class nsIWidget : public nsISupports {
 
     /**
      * Get the transparency mode of the top-level window that contains this
      * widget.
      */
     virtual nsTransparencyMode GetTransparencyMode() = 0;
 
     /**
-     * depreciated, see 2.0 interface.
-     */
-    virtual void UpdatePossiblyTransparentRegion(const nsIntRegion &aDirtyRegion,
-                                                 const nsIntRegion &aPossiblyTransparentRegion) {};
-
-    /**
      * This represents a command to set the bounds and clip region of
      * a child widget.
      */
     struct Configuration {
         nsIWidget* mChild;
         nsIntRect mBounds;
         nsTArray<nsIntRect> mClipRegion;
     };
@@ -887,17 +875,62 @@ class nsIWidget : public nsISupports {
 
     /**
      * Return the widget's LayerManager. The layer tree for that
      * LayerManager is what gets rendered to the widget.
      *
      * @param aAllowRetaining an outparam that states whether the returned
      * layer manager should be used for retained layers
      */
-    virtual LayerManager* GetLayerManager(bool* aAllowRetaining = nsnull) = 0;
+    inline LayerManager* GetLayerManager(bool* aAllowRetaining = nsnull)
+    {
+        return GetLayerManager(LAYER_MANAGER_CURRENT, aAllowRetaining);
+    }
+
+
+    enum LayerManagerPersistence
+    {
+      LAYER_MANAGER_CURRENT = 0,
+      LAYER_MANAGER_PERSISTENT
+    };
+
+    virtual LayerManager *GetLayerManager(LayerManagerPersistence aPersistence,
+                                          bool* aAllowRetaining = nsnull) = 0;
+
+    /**
+     * Called after the LayerManager draws the layer tree
+     *
+     * @param aManager The drawing LayerManager.
+     * @param aRect Current widget rect that is being drawn.
+     */
+    virtual void DrawOver(LayerManager* aManager, nsIntRect aRect) = 0;
+
+    /**
+     * Called when Gecko knows which themed widgets exist in this window.
+     * The passed array contains an entry for every themed widget of the right
+     * type (currently only NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR and
+     * NS_THEME_TOOLBAR) within the window, except for themed widgets which are
+     * transformed or have effects applied to them (e.g. CSS opacity or
+     * filters).
+     * This could sometimes be called during display list construction
+     * outside of painting.
+     * If called during painting, it will be called before we actually
+     * paint anything.
+     */
+    virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) = 0;
+
+    /**
+     * Informs the widget about the region of the window that is partially
+     * transparent. Widgets should assume that the initial transparent
+     * region is empty.
+     *
+     * @param aTransparentRegion the region of the window that is partially
+     * transparent.
+     */
+    virtual void UpdateTransparentRegion(const nsIntRegion &aTransparentRegion) {};
 
     /** 
      * Internal methods
      */
 
     //@{
     virtual void AddChild(nsIWidget* aChild) = 0;
     virtual void RemoveChild(nsIWidget* aChild) = 0;
@@ -1246,16 +1279,29 @@ class nsIWidget : public nsISupports {
      */
     NS_IMETHOD GetIMEEnabled(PRUint32* aState) = 0;
 
     /*
      * Destruct and don't commit the IME composition string.
      */
     NS_IMETHOD CancelIMEComposition() = 0;
 
+    /*
+     * Notifies the IME if the input context changes.
+     *
+     * aContext cannot be null.
+     * Set mStatus to 'Enabled' or 'Disabled' or 'Password'.
+     */
+    NS_IMETHOD SetInputMode(const IMEContext& aContext) = 0;
+
+    /*
+     * Get IME is 'Enabled' or 'Disabled' or 'Password' and other input context
+     */
+    NS_IMETHOD GetInputMode(IMEContext& aContext) = 0;
+
     /**
      * Set accelerated rendering to 'True' or 'False'
      */
     NS_IMETHOD SetAcceleratedRendering(PRBool aEnabled) = 0;
 
     /*
      * Get toggled key states.
      * aKeyCode should be NS_VK_CAPS_LOCK or  NS_VK_NUM_LOCK or
@@ -1378,76 +1424,9 @@ protected:
     nsCOMPtr<nsIWidget> mFirstChild;
     nsIWidget* mLastChild;
     nsCOMPtr<nsIWidget> mNextSibling;
     nsIWidget* mPrevSibling;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIWidget, NS_IWIDGET_IID)
 
-class nsIWidget_MOZILLA_2_0_BRANCH : public nsIWidget {
-  public:
-    NS_DECLARE_STATIC_IID_ACCESSOR(NS_IWIDGET_MOZILLA_2_0_BRANCH_IID)
-
-    typedef mozilla::layers::LayerManager LayerManager;
-
-    /*
-     * Notifies the IME if the input context changes.
-     *
-     * aContext cannot be null.
-     * Set mStatus to 'Enabled' or 'Disabled' or 'Password'.
-     */
-    NS_IMETHOD SetInputMode(const IMEContext& aContext) = 0;
-
-    /*
-     * Get IME is 'Enabled' or 'Disabled' or 'Password' and other input context
-     */
-    NS_IMETHOD GetInputMode(IMEContext& aContext) = 0;
-
-    enum LayerManagerPersistence
-    {
-      LAYER_MANAGER_CURRENT = 0,
-      LAYER_MANAGER_PERSISTENT
-    };
-
-    virtual LayerManager *GetLayerManager(LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
-                                          bool* aAllowRetaining = nsnull) = 0;
-
-    // Hide build warnings about nsIWidget::GetLayerManager being hidden by
-    // our GetLayerManager method above.
-    using nsIWidget::GetLayerManager;
-
-    /**
-     * Called after the LayerManager draws the layer tree
-     *
-     * @param aManager The drawing LayerManager.
-     * @param aRect Current widget rect that is being drawn.
-     */
-    virtual void DrawOver(LayerManager* aManager, nsIntRect aRect) = 0;
-
-    /**
-     * Called when Gecko knows which themed widgets exist in this window.
-     * The passed array contains an entry for every themed widget of the right
-     * type (currently only NS_THEME_MOZ_MAC_UNIFIED_TOOLBAR and
-     * NS_THEME_TOOLBAR) within the window, except for themed widgets which are
-     * transformed or have effects applied to them (e.g. CSS opacity or
-     * filters).
-     * This could sometimes be called during display list construction
-     * outside of painting.
-     * If called during painting, it will be called before we actually
-     * paint anything.
-     */
-    virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) = 0;
-
-    /**
-     * Informs the widget about the region of the window that is partially
-     * transparent. Widgets should assume that the initial transparent
-     * region is empty.
-     *
-     * @param aTransparentRegion the region of the window that is partially
-     * transparent.
-     */
-    virtual void UpdateTransparentRegion(const nsIntRegion &aTransparentRegion) {};
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIWidget_MOZILLA_2_0_BRANCH, NS_IWIDGET_MOZILLA_2_0_BRANCH_IID)
-
 #endif // nsIWidget_h__
--- a/widget/src/gtk2/nsWindow.cpp
+++ b/widget/src/gtk2/nsWindow.cpp
@@ -2166,19 +2166,19 @@ nsWindow::OnExposeEvent(GtkWidget *aWidg
         }
     }
 
     if (event.region.IsEmpty()) {
         g_free(rects);
         return TRUE;
     }
 
-    if (GetLayerManager(nsnull)->GetBackendType() == LayerManager::LAYERS_OPENGL)
+    if (GetLayerManager()->GetBackendType() == LayerManager::LAYERS_OPENGL)
     {
-        LayerManagerOGL *manager = static_cast<LayerManagerOGL*>(GetLayerManager(nsnull));
+        LayerManagerOGL *manager = static_cast<LayerManagerOGL*>(GetLayerManager());
         manager->SetClippingRegion(event.region);
 
         nsEventStatus status;
         DispatchEvent(&event, status);
 
         g_free(rects);
 
         DispatchDidPaint(this);
--- a/widget/src/xpwidgets/nsBaseWidget.cpp
+++ b/widget/src/xpwidgets/nsBaseWidget.cpp
@@ -745,28 +745,28 @@ NS_IMETHODIMP nsBaseWidget::MakeFullScre
 }
 
 nsBaseWidget::AutoLayerManagerSetup::AutoLayerManagerSetup(
     nsBaseWidget* aWidget, gfxContext* aTarget,
     BasicLayerManager::BufferMode aDoubleBuffering)
   : mWidget(aWidget)
 {
   BasicLayerManager* manager =
-    static_cast<BasicLayerManager*>(mWidget->GetLayerManager(nsnull));
+    static_cast<BasicLayerManager*>(mWidget->GetLayerManager());
   if (manager) {
     NS_ASSERTION(manager->GetBackendType() == LayerManager::LAYERS_BASIC,
       "AutoLayerManagerSetup instantiated for non-basic layer backend!");
     manager->SetDefaultTarget(aTarget, aDoubleBuffering);
   }
 }
 
 nsBaseWidget::AutoLayerManagerSetup::~AutoLayerManagerSetup()
 {
   BasicLayerManager* manager =
-    static_cast<BasicLayerManager*>(mWidget->GetLayerManager(nsnull));
+    static_cast<BasicLayerManager*>(mWidget->GetLayerManager());
   if (manager) {
     NS_ASSERTION(manager->GetBackendType() == LayerManager::LAYERS_BASIC,
       "AutoLayerManagerSetup instantiated for non-basic layer backend!");
     manager->SetDefaultTarget(nsnull, BasicLayerManager::BUFFER_NONE);
   }
 }
 
 nsBaseWidget::AutoUseBasicLayerManager::AutoUseBasicLayerManager(nsBaseWidget* aWidget)
@@ -858,21 +858,16 @@ nsBaseWidget::GetShouldAccelerate()
 
   if (accelerateByDefault)
     return PR_TRUE;
 
   /* use the window acceleration flag */
   return mUseAcceleratedRendering;
 }
 
-LayerManager* nsBaseWidget::GetLayerManager(bool* aAllowRetaining)
-{
-  return GetLayerManager(LAYER_MANAGER_CURRENT, aAllowRetaining);
-}
-
 LayerManager* nsBaseWidget::GetLayerManager(LayerManagerPersistence,
                                             bool* aAllowRetaining)
 {
   if (!mLayerManager) {
 
     mUseAcceleratedRendering = GetShouldAccelerate();
 
     if (mUseAcceleratedRendering) {
--- a/widget/src/xpwidgets/nsBaseWidget.h
+++ b/widget/src/xpwidgets/nsBaseWidget.h
@@ -57,17 +57,17 @@ class gfxContext;
  * Common widget implementation used as base class for native
  * or crossplatform implementations of Widgets. 
  * All cross-platform behavior that all widgets need to implement 
  * should be placed in this class. 
  * (Note: widget implementations are not required to use this
  * class, but it gives them a head start.)
  */
 
-class nsBaseWidget : public nsIWidget_MOZILLA_2_0_BRANCH
+class nsBaseWidget : public nsIWidget
 {
   friend class nsAutoRollup;
 
 protected:
   typedef mozilla::layers::BasicLayerManager BasicLayerManager;
 
 public:
   nsBaseWidget();
@@ -110,19 +110,20 @@ public:
   virtual nsTransparencyMode GetTransparencyMode();
   virtual void            GetWindowClipRegion(nsTArray<nsIntRect>* aRects);
   NS_IMETHOD              SetWindowShadowStyle(PRInt32 aStyle);
   virtual void            SetShowsToolbarButton(PRBool aShow) {}
   NS_IMETHOD              HideWindowChrome(PRBool aShouldHide);
   NS_IMETHOD              MakeFullScreen(PRBool aFullScreen);
   virtual nsIDeviceContext* GetDeviceContext();
   virtual nsIToolkit*     GetToolkit();
-  virtual LayerManager*   GetLayerManager(bool *aAllowRetaining = nsnull);
-  virtual LayerManager*   GetLayerManager(LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
+  virtual LayerManager*   GetLayerManager(LayerManagerPersistence aPersistence,
                                           bool* aAllowRetaining = nsnull);
+  using nsIWidget::GetLayerManager;
+
   virtual void            DrawOver(LayerManager* aManager, nsIntRect aRect) {}
   virtual void            UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) {}
   virtual gfxASurface*    GetThebesSurface();
   NS_IMETHOD              SetModal(PRBool aModal); 
   NS_IMETHOD              SetWindowClass(const nsAString& xulWinType);
   NS_IMETHOD              SetBounds(const nsIntRect &aRect);
   NS_IMETHOD              GetBounds(nsIntRect &aRect);
   NS_IMETHOD              GetClientBounds(nsIntRect &aRect);