Back out bug 575294, bug 726264. (cset 1727de7d26ec, 6bcea3a628d8, 011c1c8e9cc7, 0be261a5042b, d51338c5cd0c)
authorMats Palmgren <matspal@gmail.com>
Sun, 03 Jun 2012 18:05:00 +0200
changeset 95641 9f81724d820ebf138bc53335aab41c1e6b19c391
parent 95601 d51338c5cd0c85669a8903080ade6467e69729d2
child 95642 e7ca047b71b26c8da62a063bb0b814f88c66a936
push id22824
push usermpalmgren@mozilla.com
push dateSun, 03 Jun 2012 16:07:10 +0000
treeherdermozilla-central@e7ca047b71b2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs575294, 726264
milestone15.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Back out bug 575294, bug 726264. (cset 1727de7d26ec, 6bcea3a628d8, 011c1c8e9cc7, 0be261a5042b, d51338c5cd0c)
dom/base/nsFocusManager.cpp
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsComboboxControlFrame.h
layout/forms/nsIComboboxControlFrame.h
layout/forms/nsIListControlFrame.h
layout/forms/nsListControlFrame.cpp
layout/forms/nsListControlFrame.h
layout/xul/base/public/nsXULPopupManager.h
widget/cocoa/nsChildView.mm
widget/gtk2/nsWindow.cpp
widget/nsIRollupListener.h
widget/os2/nsWindow.cpp
widget/qt/nsWindow.cpp
widget/windows/nsWindow.cpp
widget/xpwidgets/nsBaseWidget.h
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -922,31 +922,26 @@ nsFocusManager::WindowHidden(nsIDOMWindo
 
   // at this point, we know that the window being hidden is either the focused
   // window, or an ancestor of the focused window. Either way, the focus is no
   // longer valid, so it needs to be updated.
 
   nsIContent* oldFocusedContent = mFocusedContent;
   mFocusedContent = nsnull;
 
-  nsCOMPtr<nsIDocShell> focusedDocShell = mFocusedWindow->GetDocShell();
-  nsCOMPtr<nsIPresShell> presShell;
-  focusedDocShell->GetPresShell(getter_AddRefs(presShell));
-
   if (oldFocusedContent && oldFocusedContent->IsInDoc()) {
     NotifyFocusStateChange(oldFocusedContent,
                            mFocusedWindow->ShouldShowFocusRing(),
                            false);
-    window->UpdateCommands(NS_LITERAL_STRING("focus"));
-
-    SendFocusOrBlurEvent(NS_BLUR_CONTENT, presShell,
-                         oldFocusedContent->GetCurrentDoc(),
-                         oldFocusedContent, 1, false);
   }
 
+  nsCOMPtr<nsIDocShell> focusedDocShell = mFocusedWindow->GetDocShell();
+  nsCOMPtr<nsIPresShell> presShell;
+  focusedDocShell->GetPresShell(getter_AddRefs(presShell));
+
   nsIMEStateManager::OnTextStateBlur(nsnull, nsnull);
   if (presShell) {
     nsIMEStateManager::OnChangeFocus(presShell->GetPresContext(), nsnull,
                                      GetFocusMoveActionCause(0));
     SetCaretVisible(presShell, false, nsnull);
   }
 
   // if the docshell being hidden is being destroyed, then we want to move
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -111,17 +111,17 @@ public:
 
   nsComboboxControlFrame* mComboBox;
 };
 
 NS_IMPL_ISUPPORTS1(nsComboButtonListener,
                    nsIDOMEventListener)
 
 // static class data member for Bug 32920
-nsComboboxControlFrame* nsComboboxControlFrame::sFocused = nsnull;
+nsComboboxControlFrame * nsComboboxControlFrame::mFocused = nsnull;
 
 nsIFrame*
 NS_NewComboboxControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aStateFlags)
 {
   nsComboboxControlFrame* it = new (aPresShell) nsComboboxControlFrame(aContext);
 
   if (it) {
     // set the state flags (if any are provided)
@@ -274,28 +274,29 @@ static PRInt32 gReflowInx = -1;
 #define PX(__v) __v 
 #endif
 
 //------------------------------------------------------
 //-- Done with macros
 //------------------------------------------------------
 
 nsComboboxControlFrame::nsComboboxControlFrame(nsStyleContext* aContext)
-  : nsBlockFrame(aContext)
-  , mDisplayFrame(nsnull)
-  , mButtonFrame(nsnull)
-  , mDropdownFrame(nsnull)
-  , mListControlFrame(nsnull)
-  , mDisplayWidth(0)
-  , mRecentSelectedIndex(NS_SKIP_NOTIFY_INDEX)
-  , mDisplayedIndex(-1)
-  , mDroppedDown(false)
-  , mInRedisplayText(false)
-  , mDelayedShowDropDown(false)
+  : nsBlockFrame(aContext),
+    mDisplayWidth(0)
 {
+  mListControlFrame            = nsnull;
+  mDroppedDown                 = false;
+  mDisplayFrame                = nsnull;
+  mButtonFrame                 = nsnull;
+  mDropdownFrame               = nsnull;
+
+  mInRedisplayText = false;
+
+  mRecentSelectedIndex = NS_SKIP_NOTIFY_INDEX;
+
   REFLOW_COUNTER_INIT()
 }
 
 //--------------------------------------------------------------
 nsComboboxControlFrame::~nsComboboxControlFrame()
 {
   REFLOW_COUNTER_DUMP("nsCCF");
 }
@@ -319,32 +320,25 @@ nsComboboxControlFrame::CreateAccessible
     return accService->CreateHTMLComboboxAccessible(mContent,
                                                     PresContext()->PresShell());
   }
 
   return nsnull;
 }
 #endif
 
-void
+void 
 nsComboboxControlFrame::SetFocus(bool aOn, bool aRepaint)
 {
   nsWeakFrame weakFrame(this);
   if (aOn) {
     nsListControlFrame::ComboboxFocusSet();
-    sFocused = this;
-    if (mDelayedShowDropDown) {
-      ShowDropDown(true); // might destroy us
-      if (!weakFrame.IsAlive()) {
-        return;
-      }
-    }
+    mFocused = this;
   } else {
-    sFocused = nsnull;
-    mDelayedShowDropDown = false;
+    mFocused = nsnull;
     if (mDroppedDown) {
       mListControlFrame->ComboboxFinish(mDisplayedIndex); // might destroy us
       if (!weakFrame.IsAlive()) {
         return;
       }
     }
     // May delete |this|.
     mListControlFrame->FireOnChange();
@@ -444,54 +438,16 @@ nsComboboxControlFrame::ShowList(bool aS
         }
       }
     }
   }
 
   return weakFrame.IsAlive();
 }
 
-class nsResizeDropdownAtFinalPosition
-  : public nsIReflowCallback, public nsRunnable
-{
-public:
-  nsResizeDropdownAtFinalPosition(nsComboboxControlFrame* aFrame)
-    : mFrame(aFrame)
-  {
-    MOZ_COUNT_CTOR(nsResizeDropdownAtFinalPosition);
-  }
-  ~nsResizeDropdownAtFinalPosition()
-  {
-    MOZ_COUNT_DTOR(nsResizeDropdownAtFinalPosition);
-  }
-
-  virtual bool ReflowFinished()
-  {
-    Run();
-    NS_RELEASE_THIS();
-    return false;
-  }
-
-  virtual void ReflowCallbackCanceled()
-  {
-    NS_RELEASE_THIS();
-  }
-
-  NS_IMETHODIMP Run()
-  {
-    if (mFrame.IsAlive()) {
-      static_cast<nsComboboxControlFrame*>(mFrame.GetFrame())->
-        AbsolutelyPositionDropDown();
-    }
-    return NS_OK;
-  }
-
-  nsWeakFrame mFrame;
-};
-
 nsresult
 nsComboboxControlFrame::ReflowDropdown(nsPresContext*  aPresContext, 
                                        const nsHTMLReflowState& aReflowState)
 {
   // All we want out of it later on, really, is the height of a row, so we
   // don't even need to cache mDropdownFrame's ascent or anything.  If we don't
   // need to reflow it, just bail out here.
   if (!aReflowState.ShouldReflowAllKids() &&
@@ -575,176 +531,59 @@ nsComboboxControlFrame::GetCSSTransformT
       translation -= GetOffsetToCrossDoc(rootPC->PresShell()->GetRootFrame());
     } else {
       translation.x = translation.y = 0;
     }
   }
   return translation;
 }
 
-class nsAsyncRollup : public nsRunnable
-{
-public:
-  nsAsyncRollup(nsComboboxControlFrame* aFrame) : mFrame(aFrame) {}
-  NS_IMETHODIMP Run()
-  {
-    if (mFrame.IsAlive()) {
-      static_cast<nsComboboxControlFrame*>(mFrame.GetFrame())
-        ->RollupFromList();
-    }
-    return NS_OK;
-  }
-  nsWeakFrame mFrame;
-};
-
-class nsAsyncResize : public nsRunnable
+void
+nsComboboxControlFrame::AbsolutelyPositionDropDown()
 {
-public:
-  nsAsyncResize(nsComboboxControlFrame* aFrame) : mFrame(aFrame) {}
-  NS_IMETHODIMP Run()
-  {
-    if (mFrame.IsAlive()) {
-      nsComboboxControlFrame* combo =
-        static_cast<nsComboboxControlFrame*>(mFrame.GetFrame());
-      static_cast<nsListControlFrame*>(combo->mDropdownFrame)->
-        SetSuppressScrollbarUpdate(true);
-      nsCOMPtr<nsIPresShell> shell = mFrame->PresContext()->PresShell();
-      shell->FrameNeedsReflow(combo->mDropdownFrame, nsIPresShell::eResize,
-                              NS_FRAME_IS_DIRTY);
-      shell->FlushPendingNotifications(Flush_Layout);
-      if (mFrame.IsAlive()) {
-        combo = static_cast<nsComboboxControlFrame*>(mFrame.GetFrame());
-        static_cast<nsListControlFrame*>(combo->mDropdownFrame)->
-          SetSuppressScrollbarUpdate(false);
-        if (combo->mDelayedShowDropDown) {
-          combo->ShowDropDown(true);
-        }
-      }
-    }
-    return NS_OK;
-  }
-  nsWeakFrame mFrame;
-};
+   // Position the dropdown list. It is positioned below the display frame if there is enough
+   // room on the screen to display the entire list. Otherwise it is placed above the display
+   // frame.
 
-void
-nsComboboxControlFrame::GetAvailableDropdownSpace(nscoord* aAbove,
-                                                  nscoord* aBelow,
-                                                  nsPoint* aTranslation)
-{
-  // Note: At first glance, it appears that you could simply get the absolute
-  // bounding box for the dropdown list by first getting its view, then getting
-  // the view's nsIWidget, then asking the nsIWidget for its AbsoluteBounds.
-  // The problem with this approach, is that the dropdown lists y location can
-  // change based on whether the dropdown is placed below or above the display
-  // frame.  The approach, taken here is to get the absolute position of the
-  // display frame and use its location to determine if the dropdown will go
-  // offscreen.
+   // Note: As first glance, it appears that you could simply get the absolute bounding box for the
+   // dropdown list by first getting its view, then getting the view's nsIWidget, then asking the nsIWidget
+   // for it's AbsoluteBounds. The problem with this approach, is that the dropdown lists y location can
+   // change based on whether the dropdown is placed below or above the display frame.
+   // The approach, taken here is to get use the absolute position of the display frame and use it's location
+   // to determine if the dropdown will go offscreen.
 
   // Normal frame geometry (eg GetOffsetTo, mRect) doesn't include transforms.
   // In the special case that our transform is only a 2D translation we
   // introduce this hack so that the dropdown will show up in the right place.
-  *aTranslation = GetCSSTransformTranslation();
-  *aAbove = 0;
-  *aBelow = 0;
-  
-  nsRect thisScreenRect = GetScreenRectInAppUnits();
-  nsRect screen = nsFormControlFrame::GetUsableScreenRect(PresContext());
-  nscoord dropdownY = thisScreenRect.YMost() + aTranslation->y;
+  nsPoint translation = GetCSSTransformTranslation();
+
+   // Use the height calculated for the area frame so it includes both
+   // the display and button heights.
+  nscoord dropdownYOffset = GetRect().height;
+  nsSize dropdownSize = mDropdownFrame->GetSize();
 
-  nscoord minY;
-  if (!PresContext()->IsChrome()) {
-    nsIFrame* root = PresContext()->PresShell()->GetRootFrame();
-    minY = root->GetScreenRectInAppUnits().y;
-    if (dropdownY < root->GetScreenRectInAppUnits().y) {
-      // Don't allow the drop-down to be placed above the top of the root frame.
-      return;
-    }
-  } else {
-    minY = screen.y;
-  }
-  
-  nscoord below = screen.YMost() - dropdownY;
-  nscoord above = thisScreenRect.y + aTranslation->y - minY;
+  nsRect screen = nsFormControlFrame::GetUsableScreenRect(PresContext());
 
-  // If the difference between the space above and below is less
-  // than a row-height, then we favor the space below.
-  if (above >= below) {
-    nsListControlFrame* lcf = static_cast<nsListControlFrame*>(mDropdownFrame);
-    nscoord rowHeight = lcf->GetHeightOfARow();
-    if (above < below + rowHeight) {
-      above -= rowHeight;
-    }
+  // Check to see if the drop-down list will go offscreen
+  if ((GetScreenRectInAppUnits() + translation).YMost() + dropdownSize.height > screen.YMost()) {
+    // move the dropdown list up
+    dropdownYOffset = - (dropdownSize.height);
   }
 
-  *aBelow = below;
-  *aAbove = above;
-}
-
-nsComboboxControlFrame::DropDownPositionState
-nsComboboxControlFrame::AbsolutelyPositionDropDown()
-{
-  nsPoint translation;
-  nscoord above, below;
-  GetAvailableDropdownSpace(&above, &below, &translation);
-  if (above <= 0 && below <= 0) {
-    // Hide the view immediately to minimize flicker.
-    nsIView* view = mDropdownFrame->GetView();
-    view->GetViewManager()->SetViewVisibility(view, nsViewVisibility_kHide);
-    NS_DispatchToCurrentThread(new nsAsyncRollup(this));
-    return eDropDownPositionSuppressed;
-  }
-
-  nsSize dropdownSize = mDropdownFrame->GetSize();
-  nscoord height = NS_MAX(above, below);
-  nsListControlFrame* lcf = static_cast<nsListControlFrame*>(mDropdownFrame);
-  if (height < dropdownSize.height) {
-    if (lcf->GetNumDisplayRows() > 1) {
-      // The drop-down doesn't fit and currently shows more than 1 row -
-      // schedule a resize to show fewer rows.
-      NS_DispatchToCurrentThread(new nsAsyncResize(this));
-      return eDropDownPositionPendingResize;
-    }
-  } else if (height > (dropdownSize.height + lcf->GetHeightOfARow() * 1.5) &&
-             lcf->GetDropdownCanGrow()) {
-    // The drop-down fits but there is room for at least 1.5 more rows -
-    // schedule a resize to show more rows if it has more rows to show.
-    // (1.5 rows for good measure to avoid any rounding issues that would
-    // lead to a loop of reflow requests)
-    NS_DispatchToCurrentThread(new nsAsyncResize(this));
-    return eDropDownPositionPendingResize;
-  }
-
-  // Position the drop-down below if there is room, otherwise place it
-  // on the side that has more room.
-  bool b = dropdownSize.height <= below || below >= above;
-  nsPoint dropdownPosition(0, b ? GetRect().height : -dropdownSize.height);
-  if (GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) {
+  nsPoint dropdownPosition;
+  const nsStyleVisibility* vis = GetStyleVisibility();
+  if (vis->mDirection == NS_STYLE_DIRECTION_RTL) {
     // Align the right edge of the drop-down with the right edge of the control.
     dropdownPosition.x = GetRect().width - dropdownSize.width;
+  } else {
+    dropdownPosition.x = 0;
   }
-  mDropdownFrame->SetPosition(dropdownPosition + translation);
-  nsContainerFrame::PositionFrameView(mDropdownFrame);
-  return eDropDownPositionFinal;
-}
+  dropdownPosition.y = dropdownYOffset; 
 
-void
-nsComboboxControlFrame::NotifyGeometryChange()
-{
-  // We don't need to resize if we're not dropped down since ShowDropDown
-  // does that, or if we're dirty then the reflow callback does it,
-  // or if we have a delayed ShowDropDown pending.
-  if (IsDroppedDown() &&
-      !(GetStateBits() & NS_FRAME_IS_DIRTY) &&
-      !mDelayedShowDropDown) {
-    // Async because we're likely in a middle of a scroll here so
-    // frame/view positions are in flux.
-    nsRefPtr<nsResizeDropdownAtFinalPosition> resize =
-      new nsResizeDropdownAtFinalPosition(this);
-    NS_DispatchToCurrentThread(resize);
-  }
+  mDropdownFrame->SetPosition(dropdownPosition + translation);
 }
 
 //----------------------------------------------------------
 // 
 //----------------------------------------------------------
 #ifdef DO_REFLOW_DEBUG
 static int myCounter = 0;
 
@@ -862,23 +701,16 @@ nsComboboxControlFrame::Reflow(nsPresCon
     mListControlFrame->GetOptionText(selectedIndex, selectedOptionText);
   }
   if (mDisplayedOptionText != selectedOptionText) {
     RedisplayText(selectedIndex);
   }
 
   // First reflow our dropdown so that we know how tall we should be.
   ReflowDropdown(aPresContext, aReflowState);
-  nsRefPtr<nsResizeDropdownAtFinalPosition> resize =
-    new nsResizeDropdownAtFinalPosition(this);
-  if (NS_SUCCEEDED(aPresContext->PresShell()->PostReflowCallback(resize))) {
-    // The reflow callback queue doesn't AddRef so we keep it alive until
-    // it's released in its ReflowFinished / ReflowCallbackCanceled.
-    resize.forget();
-  }
 
   // Get the width of the vertical scrollbar.  That will be the width of the
   // dropdown button.
   nscoord buttonWidth;
   const nsStyleDisplay *disp = GetStyleDisplay();
   if (IsThemed(disp) && !aPresContext->GetTheme()->ThemeNeedsComboboxDropmarker()) {
     buttonWidth = 0;
   }
@@ -957,35 +789,26 @@ nsComboboxControlFrame::GetFrameName(nsA
 
 
 //----------------------------------------------------------------------
 // nsIComboboxControlFrame
 //----------------------------------------------------------------------
 void
 nsComboboxControlFrame::ShowDropDown(bool aDoDropDown) 
 {
-  mDelayedShowDropDown = false;
   nsEventStates eventStates = mContent->AsElement()->State();
-  if (aDoDropDown && eventStates.HasState(NS_EVENT_STATE_DISABLED)) {
+  if (eventStates.HasState(NS_EVENT_STATE_DISABLED)) {
     return;
   }
 
   if (!mDroppedDown && aDoDropDown) {
-    if (sFocused == this) {
-      DropDownPositionState state = AbsolutelyPositionDropDown();
-      if (state == eDropDownPositionFinal) {
-        ShowList(aDoDropDown); // might destroy us
-      } else if (state == eDropDownPositionPendingResize) {
-        // Delay until after the resize reflow, see nsAsyncResize.
-        mDelayedShowDropDown = true;
-      }
-    } else {
-      // Delay until we get focus, see SetFocus().
-      mDelayedShowDropDown = true;
+    if (mListControlFrame) {
+      mListControlFrame->SyncViewWithFrame();
     }
+    ShowList(aDoDropDown); // might destroy us
   } else if (mDroppedDown && !aDoDropDown) {
     ShowList(aDoDropDown); // might destroy us
   }
 }
 
 void
 nsComboboxControlFrame::SetDropDown(nsIFrame* aDropDownFrame)
 {
@@ -1608,17 +1431,17 @@ nsComboboxControlFrame::BuildDisplayList
   return DisplaySelectionOverlay(aBuilder, aLists.Content());
 }
 
 void nsComboboxControlFrame::PaintFocus(nsRenderingContext& aRenderingContext,
                                         nsPoint aPt)
 {
   /* Do we need to do anything? */
   nsEventStates eventStates = mContent->AsElement()->State();
-  if (eventStates.HasState(NS_EVENT_STATE_DISABLED) || sFocused != this)
+  if (eventStates.HasState(NS_EVENT_STATE_DISABLED) || mFocused != this)
     return;
 
   aRenderingContext.PushState();
   nsRect clipRect = mDisplayFrame->GetRect() + aPt;
   aRenderingContext.IntersectClip(clipRect);
 
   // REVIEW: Why does the old code paint mDisplayFrame again? We've
   // already painted it in the children above. So clipping it here won't do
--- a/layout/forms/nsComboboxControlFrame.h
+++ b/layout/forms/nsComboboxControlFrame.h
@@ -132,26 +132,17 @@ public:
    */
   virtual void ShowDropDown(bool aDoDropDown);
   virtual nsIFrame* GetDropDown();
   virtual void SetDropDown(nsIFrame* aDropDownFrame);
   /**
    * @note This method might destroy |this|.
    */
   virtual void RollupFromList();
-
-  /**
-   * Return the available space above and below this frame for
-   * placing the drop-down list, and the current 2D translation.
-   * Note that either or both can be less than or equal to zero,
-   * if both are then the drop-down should be closed.
-   */
-  void GetAvailableDropdownSpace(nscoord* aAbove,
-                                 nscoord* aBelow,
-                                 nsPoint* aTranslation);
+  virtual void AbsolutelyPositionDropDown();
   virtual PRInt32 GetIndexOfDisplayArea();
   /**
    * @note This method might destroy |this|.
    */
   NS_IMETHOD RedisplaySelectedText();
   virtual PRInt32 UpdateRecentIndex(PRInt32 aIndex);
   virtual void OnContentReset();
 
@@ -163,17 +154,16 @@ public:
   NS_IMETHOD OnSetSelectedIndex(PRInt32 aOldIndex, PRInt32 aNewIndex);
 
   //nsIRollupListener
   /**
    * Hide the dropdown menu and stop capturing mouse events.
    * @note This method might destroy |this|.
    */
   virtual nsIContent* Rollup(PRUint32 aCount, bool aGetLastRolledUp = false);
-  virtual void NotifyGeometryChange();
 
   /**
    * A combobox should roll up if a mousewheel event happens outside of
    * the popup area.
    */
   virtual bool ShouldRollupOnMouseWheelEvent()
     { return true; }
 
@@ -189,37 +179,27 @@ public:
 
   //nsIStatefulFrame
   NS_IMETHOD SaveState(SpecialStateID aStateID, nsPresState** aState);
   NS_IMETHOD RestoreState(nsPresState* aState);
 
   static bool ToolkitHasNativePopup();
 
 protected:
-  friend class RedisplayTextEvent;
-  friend class nsAsyncResize;
-  friend class nsResizeDropdownAtFinalPosition;
 
   // Utilities
   nsresult ReflowDropdown(nsPresContext*          aPresContext, 
                           const nsHTMLReflowState& aReflowState);
 
-  enum DropDownPositionState {
-    // can't show the dropdown at its current position
-    eDropDownPositionSuppressed,
-    // a resize reflow is pending, don't show it yet
-    eDropDownPositionPendingResize,
-    // the dropdown has its final size and position and can be displayed here
-    eDropDownPositionFinal
-  };
-  DropDownPositionState AbsolutelyPositionDropDown();
-
   // Helper for GetMinWidth/GetPrefWidth
   nscoord GetIntrinsicWidth(nsRenderingContext* aRenderingContext,
                             nsLayoutUtils::IntrinsicWidthType aType);
+protected:
+  class RedisplayTextEvent;
+  friend class RedisplayTextEvent;
 
   class RedisplayTextEvent : public nsRunnable {
   public:
     NS_DECL_NSIRUNNABLE
     RedisplayTextEvent(nsComboboxControlFrame *c) : mControlFrame(c) {}
     void Revoke() { mControlFrame = nsnull; }
   private:
     nsComboboxControlFrame *mControlFrame;
@@ -257,35 +237,31 @@ protected:
   nsIFrame*                mButtonFrame;             // button frame
   nsIFrame*                mDropdownFrame;           // dropdown list frame
   nsIListControlFrame *    mListControlFrame;        // ListControl Interface for the dropdown frame
 
   // The width of our display area.  Used by that frame's reflow to
   // size to the full width except the drop-marker.
   nscoord mDisplayWidth;
   
+  bool                  mDroppedDown;             // Current state of the dropdown list, true is dropped down
+  bool                  mInRedisplayText;
+
   nsRevocableEventPtr<RedisplayTextEvent> mRedisplayTextEvent;
 
   PRInt32               mRecentSelectedIndex;
   PRInt32               mDisplayedIndex;
   nsString              mDisplayedOptionText;
 
   // make someone to listen to the button. If its programmatically pressed by someone like Accessibility
   // then open or close the combo box.
   nsCOMPtr<nsIDOMEventListener> mButtonListener;
 
-  // Current state of the dropdown list, true is dropped down.
-  bool                  mDroppedDown;
-  // See comment in HandleRedisplayTextEvent().
-  bool                  mInRedisplayText;
-  // Acting on ShowDropDown(true) is delayed until we're focused.
-  bool                  mDelayedShowDropDown;
-
   // static class data member for Bug 32920
   // only one control can be focused at a time
-  static nsComboboxControlFrame* sFocused;
+  static nsComboboxControlFrame * mFocused;
 
 #ifdef DO_REFLOW_COUNTER
   PRInt32 mReflowId;
 #endif
 };
 
 #endif
--- a/layout/forms/nsIComboboxControlFrame.h
+++ b/layout/forms/nsIComboboxControlFrame.h
@@ -56,16 +56,21 @@ public:
   NS_IMETHOD RedisplaySelectedText() = 0;
 
   /**
    * Method for the listbox to set and get the recent index
    */
   virtual PRInt32 UpdateRecentIndex(PRInt32 aIndex) = 0;
 
   /**
+   *
+   */
+  virtual void AbsolutelyPositionDropDown() = 0;
+
+  /**
    * Notification that the content has been reset
    */
   virtual void OnContentReset() = 0;
   
   /**
    * This returns the index of the item that is currently being displayed
    * in the display area. It may differ from what the currently Selected index
    * is in in the dropdown.
--- a/layout/forms/nsIListControlFrame.h
+++ b/layout/forms/nsIListControlFrame.h
@@ -57,16 +57,21 @@ public:
 
   /**
    * Returns the number of options in the listbox
    */
 
   virtual PRInt32 GetNumberOfOptions() = 0; 
 
   /**
+   * 
+   */
+  virtual void SyncViewWithFrame() = 0;
+
+  /**
    * Called by combobox when it's about to drop down
    */
   virtual void AboutToDropDown() = 0;
 
   /**
    * Called by combobox when it's about to roll up
    */
   virtual void AboutToRollup() = 0;
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -48,17 +48,17 @@
 #include "nsLayoutUtils.h"
 #include "nsDisplayList.h"
 #include "nsContentUtils.h"
 #include "mozilla/LookAndFeel.h"
 
 using namespace mozilla;
 
 // Constants
-const PRInt32 kMaxDropDownRows          = 20; // This matches the setting for 4.x browsers
+const nscoord kMaxDropDownRows          = 20; // This matches the setting for 4.x browsers
 const PRInt32 kNothingSelected          = -1;
 
 // Static members
 nsListControlFrame * nsListControlFrame::mFocused = nsnull;
 nsString * nsListControlFrame::sIncrementalString = nsnull;
 
 // Using for incremental typing navigation
 #define INCREMENTAL_SEARCH_KEYPRESS_TIME 1000
@@ -107,17 +107,16 @@ NS_NewListControlFrame(nsIPresShell* aPr
 NS_IMPL_FRAMEARENA_HELPERS(nsListControlFrame)
 
 //---------------------------------------------------------
 nsListControlFrame::nsListControlFrame(
   nsIPresShell* aShell, nsIDocument* aDocument, nsStyleContext* aContext)
   : nsHTMLScrollFrame(aShell, aContext, false),
     mMightNeedSecondPass(false),
     mHasPendingInterruptAtStartOfReflow(false),
-    mDropdownCanGrow(false),
     mLastDropdownComputedHeight(NS_UNCONSTRAINEDSIZE)
 {
   mComboboxFrame      = nsnull;
   mChangesSinceDragStart = false;
   mButtonDown         = false;
 
   mIsAllContentHere   = false;
   mIsAllFramesHere    = false;
@@ -505,29 +504,33 @@ nsListControlFrame::ReflowAsDropdown(nsP
   NS_PRECONDITION(aReflowState.ComputedHeight() == NS_UNCONSTRAINEDSIZE,
                   "We should not have a computed height here!");
   
   mMightNeedSecondPass = NS_SUBTREE_DIRTY(this) ||
     aReflowState.ShouldReflowAllKids();
 
 #ifdef DEBUG
   nscoord oldHeightOfARow = HeightOfARow();
-  nscoord oldVisibleHeight = (GetStateBits() & NS_FRAME_FIRST_REFLOW) ?
-    NS_UNCONSTRAINEDSIZE : GetScrolledFrame()->GetSize().height;
 #endif
 
   nsHTMLReflowState state(aReflowState);
 
+  nscoord oldVisibleHeight;
   if (!(GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
     // When not doing an initial reflow, and when the height is auto, start off
     // with our computed height set to what we'd expect our height to be.
     // Note: At this point, mLastDropdownComputedHeight can be
     // NS_UNCONSTRAINEDSIZE in cases when last time we didn't have to constrain
     // the height.  That's fine; just do the same thing as last time.
     state.SetComputedHeight(mLastDropdownComputedHeight);
+    oldVisibleHeight = GetScrolledFrame()->GetSize().height;
+  } else {
+    // Set oldVisibleHeight to something that will never test true against a
+    // real height.
+    oldVisibleHeight = NS_UNCONSTRAINEDSIZE;
   }
 
   nsresult rv = nsHTMLScrollFrame::Reflow(aPresContext, aDesiredSize,
                                           state, aStatus);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (!mMightNeedSecondPass) {
     NS_ASSERTION(oldVisibleHeight == GetScrolledFrame()->GetSize().height,
@@ -559,44 +562,58 @@ nsListControlFrame::ReflowAsDropdown(nsP
 
   // Gotta reflow again.
   // XXXbz We're just changing the height here; do we need to dirty ourselves
   // or anything like that?  We might need to, per the letter of the reflow
   // protocol, but things seem to work fine without it...  Is that just an
   // implementation detail of nsHTMLScrollFrame that we're depending on?
   nsHTMLScrollFrame::DidReflow(aPresContext, &state, aStatus);
 
-  // Now compute the height we want to have.
-  // Note: no need to apply min/max constraints, since we have no such
-  // rules applied to the combobox dropdown.
+  // Now compute the height we want to have
+  mNumDisplayRows = kMaxDropDownRows;
+  if (visibleHeight > mNumDisplayRows * heightOfARow) {
+    visibleHeight = mNumDisplayRows * heightOfARow;
+    // This is an adaptive algorithm for figuring out how many rows 
+    // should be displayed in the drop down. The standard size is 20 rows, 
+    // but on 640x480 it is typically too big.
+    // This takes the height of the screen divides it by two and then subtracts off 
+    // an estimated height of the combobox. I estimate it by taking the max element size
+    // of the drop down and multiplying it by 2 (this is arbitrary) then subtract off
+    // the border and padding of the drop down (again rather arbitrary)
+    // This all breaks down if the font of the combobox is a lot larger then the option items
+    // or CSS style has set the height of the combobox to be rather large.
+    // We can fix these cases later if they actually happen.
+    nsRect screen = nsFormControlFrame::GetUsableScreenRect(aPresContext);
+    nscoord screenHeight = screen.height;
 
-  mDropdownCanGrow = false;
-  if (visibleHeight <= 0 || heightOfARow <= 0) {
+    nscoord availDropHgt = (screenHeight / 2) - (heightOfARow*2); // approx half screen minus combo size
+    availDropHgt -= aReflowState.mComputedBorderPadding.top + aReflowState.mComputedBorderPadding.bottom;
+
+    nscoord hgt = visibleHeight + aReflowState.mComputedBorderPadding.top + aReflowState.mComputedBorderPadding.bottom;
+    if (heightOfARow > 0) {
+      if (hgt > availDropHgt) {
+        visibleHeight = (availDropHgt / heightOfARow) * heightOfARow;
+      }
+      mNumDisplayRows = visibleHeight / heightOfARow;
+    } else {
+      // Hmmm, not sure what to do here. Punt, and make both of them one
+      visibleHeight   = 1;
+      mNumDisplayRows = 1;
+    }
+
+    state.SetComputedHeight(mNumDisplayRows * heightOfARow);
+    // Note: no need to apply min/max constraints, since we have no such
+    // rules applied to the combobox dropdown.
+    // XXXbz this is ending up too big!!  Figure out why.
+  } else if (visibleHeight == 0) {
     // Looks like we have no options.  Just size us to a single row height.
     state.SetComputedHeight(heightOfARow);
-    mNumDisplayRows = 1;
   } else {
-    nsComboboxControlFrame* combobox = static_cast<nsComboboxControlFrame*>(mComboboxFrame);
-    nsPoint translation;
-    nscoord above, below;
-    combobox->GetAvailableDropdownSpace(&above, &below, &translation);
-    if (above <= 0 && below <= 0) {
-      state.SetComputedHeight(heightOfARow);
-      mNumDisplayRows = 1;
-    } else {
-      nscoord bp = aReflowState.mComputedBorderPadding.TopBottom();
-      nscoord availableHeight = NS_MAX(above, below) - bp;
-      nscoord height = NS_MIN(visibleHeight, availableHeight);
-      PRInt32 rows = height / heightOfARow;
-      mNumDisplayRows = clamped(rows, 1, kMaxDropDownRows);
-      nscoord newHeight = mNumDisplayRows * heightOfARow;
-      state.SetComputedHeight(newHeight);
-      mDropdownCanGrow = visibleHeight - newHeight >= heightOfARow &&
-                         mNumDisplayRows != kMaxDropDownRows;
-    }
+    // Not too big, not too small.  Just use it!
+    state.SetComputedHeight(NS_UNCONSTRAINEDSIZE);
   }
 
   // Note: At this point, state.mComputedHeight can be NS_UNCONSTRAINEDSIZE in
   // cases when there were some options, but not too many (so no scrollbar was
   // needed).  That's fine; just store that.
   mLastDropdownComputedHeight = state.ComputedHeight();
 
   nsHTMLScrollFrame::WillReflow(aPresContext);
@@ -1576,16 +1593,28 @@ nsListControlFrame::GetFormProperty(nsIA
     // You shouldn't be calling me for this!!!
     return NS_ERROR_INVALID_ARG;
   }
 
   return NS_OK;
 }
 
 void
+nsListControlFrame::SyncViewWithFrame()
+{
+    // Resync the view's position with the frame.
+    // The problem is the dropdown's view is attached directly under
+    // the root view. This means its view needs to have its coordinates calculated
+    // as if it were in it's normal position in the view hierarchy.
+  mComboboxFrame->AbsolutelyPositionDropDown();
+
+  nsContainerFrame::PositionFrameView(this);
+}
+
+void
 nsListControlFrame::AboutToDropDown()
 {
   NS_ASSERTION(IsInDropDownMode(),
     "AboutToDropDown called without being in dropdown mode");
 
   // Our widget doesn't get invalidated on changes to the rest of the document,
   // so compute and store this color at the start of a dropdown so we don't
   // get weird painting behaviour.
@@ -1639,17 +1668,24 @@ NS_IMETHODIMP
 nsListControlFrame::DidReflow(nsPresContext*           aPresContext,
                               const nsHTMLReflowState* aReflowState,
                               nsDidReflowStatus        aStatus)
 {
   nsresult rv;
   bool wasInterrupted = !mHasPendingInterruptAtStartOfReflow &&
                           aPresContext->HasPendingInterrupt();
 
-  rv = nsHTMLScrollFrame::DidReflow(aPresContext, aReflowState, aStatus);
+  if (IsInDropDownMode()) 
+  {
+    //SyncViewWithFrame();
+    rv = nsHTMLScrollFrame::DidReflow(aPresContext, aReflowState, aStatus);
+    SyncViewWithFrame();
+  } else {
+    rv = nsHTMLScrollFrame::DidReflow(aPresContext, aReflowState, aStatus);
+  }
 
   if (mNeedToReset && !wasInterrupted) {
     mNeedToReset = false;
     // Suppress scrolling to the selected element if we restored
     // scroll history state AND the list contents have not changed
     // since we loaded all the children AND nothing else forced us
     // to scroll by calling ResetList(true). The latter two conditions
     // are folded into mPostChildrenLoadedReset.
--- a/layout/forms/nsListControlFrame.h
+++ b/layout/forms/nsListControlFrame.h
@@ -125,16 +125,17 @@ public:
    * If the there are zero items then an empty string is returned
    * If there is nothing selected, then the 0th item's text is returned.
    */
   virtual void GetOptionText(PRInt32 aIndex, nsAString & aStr);
 
   virtual void CaptureMouseEvents(bool aGrabMouseEvents);
   virtual nscoord GetHeightOfARow();
   virtual PRInt32 GetNumberOfOptions();  
+  virtual void SyncViewWithFrame();
   virtual void AboutToDropDown();
 
   /**
    * @note This method might destroy |this|.
    */
   virtual void AboutToRollup();
 
   /**
@@ -227,27 +228,16 @@ public:
   }
 
   /**
    * Return whether the list is in dropdown mode.
    */
   bool IsInDropDownMode() const;
 
   /**
-   * Return the number of displayed rows in the list.
-   */
-  PRUint32 GetNumDisplayRows() const { return mNumDisplayRows; }
-
-  /**
-   * Return true if the drop-down list can display more rows.
-   * (always false if not in drop-down mode)
-   */
-  bool GetDropdownCanGrow() const { return mDropdownCanGrow; }
-
-  /**
    * Dropdowns need views
    */
   virtual bool NeedsView() { return IsInDropDownMode(); }
 
   /**
    * Frees statics owned by this class.
    */
   static void Shutdown();
@@ -419,20 +409,16 @@ protected:
   bool mMightNeedSecondPass:1;
 
   /**
    * Set to aPresContext->HasPendingInterrupt() at the start of Reflow.
    * Set to false at the end of DidReflow.
    */
   bool mHasPendingInterruptAtStartOfReflow:1;
 
-  // True if the drop-down can show more rows.  Always false if this list
-  // is not in drop-down mode.
-  bool mDropdownCanGrow:1;
-  
   // The last computed height we reflowed at if we're a combobox dropdown.
   // XXXbz should we be using a subclass here?  Or just not worry
   // about the extra member on listboxes?
   nscoord mLastDropdownComputedHeight;
 
   // At the time of our last dropdown, the backstop color to draw in case we
   // are translucent.
   nscolor mLastDropdownBackstopColor;
--- a/layout/xul/base/public/nsXULPopupManager.h
+++ b/layout/xul/base/public/nsXULPopupManager.h
@@ -284,17 +284,16 @@ public:
   NS_DECL_NSITIMERCALLBACK
   NS_DECL_NSIDOMEVENTLISTENER
 
   // nsIRollupListener
   virtual nsIContent* Rollup(PRUint32 aCount, bool aGetLastRolledUp = false);
   virtual bool ShouldRollupOnMouseWheelEvent();
   virtual bool ShouldRollupOnMouseActivate();
   virtual PRUint32 GetSubmenuWidgetChain(nsTArray<nsIWidget*> *aWidgetChain);
-  virtual void NotifyGeometryChange() {}
 
   static nsXULPopupManager* sInstance;
 
   // initialize and shutdown methods called by nsLayoutStatics
   static nsresult Init();
   static void Shutdown();
 
   // returns a weak reference to the popup manager instance, could return null
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -830,17 +830,16 @@ NS_IMETHODIMP nsChildView::Move(PRInt32 
 
   NSRect r;
   nsCocoaUtils::GeckoRectToNSRect(mBounds, r);
   [mView setFrame:r];
 
   if (mVisible)
     [mView setNeedsDisplay:YES];
 
-  NotifyRollupGeometryChange(gRollupListener);
   ReportMoveEvent();
 
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 NS_IMETHODIMP nsChildView::Resize(PRInt32 aWidth, PRInt32 aHeight, bool aRepaint)
@@ -855,17 +854,16 @@ NS_IMETHODIMP nsChildView::Resize(PRInt3
 
   NSRect r;
   nsCocoaUtils::GeckoRectToNSRect(mBounds, r);
   [mView setFrame:r];
 
   if (mVisible && aRepaint)
     [mView setNeedsDisplay:YES];
 
-  NotifyRollupGeometryChange(gRollupListener);
   ReportSizeEvent();
 
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 NS_IMETHODIMP nsChildView::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, bool aRepaint)
@@ -888,17 +886,16 @@ NS_IMETHODIMP nsChildView::Resize(PRInt3
 
   NSRect r;
   nsCocoaUtils::GeckoRectToNSRect(mBounds, r);
   [mView setFrame:r];
 
   if (mVisible && aRepaint)
     [mView setNeedsDisplay:YES];
 
-  NotifyRollupGeometryChange(gRollupListener);
   if (isMoving) {
     ReportMoveEvent();
     if (mOnDestroyCalled)
       return NS_OK;
   }
   if (isResizing)
     ReportSizeEvent();
 
--- a/widget/gtk2/nsWindow.cpp
+++ b/widget/gtk2/nsWindow.cpp
@@ -1059,18 +1059,16 @@ nsWindow::Resize(PRInt32 aWidth, PRInt32
             // dunno why, but apparently we're lame like that.
             NativeResize(aWidth, aHeight, aRepaint);
         }
         else {
             mNeedsResize = true;
         }
     }
 
-    NotifyRollupGeometryChange(gRollupListener);
-
     // synthesize a resize event if this isn't a toplevel
     if (mIsTopLevel || mListenForResizes) {
         nsIntRect rect(mBounds.x, mBounds.y, aWidth, aHeight);
         nsEventStatus status;
         DispatchResizeEvent(rect, status);
     }
 
     return NS_OK;
@@ -1125,18 +1123,16 @@ nsWindow::Resize(PRInt32 aX, PRInt32 aY,
             // dunno why, but apparently we're lame like that.
             NativeResize(aX, aY, aWidth, aHeight, aRepaint);
         }
         else {
             mNeedsResize = true;
         }
     }
 
-    NotifyRollupGeometryChange(gRollupListener);
-
     if (mIsTopLevel || mListenForResizes) {
         // synthesize a resize event
         nsIntRect rect(aX, aY, aWidth, aHeight);
         nsEventStatus status;
         DispatchResizeEvent(rect, status);
     }
 
     return NS_OK;
@@ -1190,17 +1186,16 @@ nsWindow::Move(PRInt32 aX, PRInt32 aY)
 
     if (mIsTopLevel) {
         gtk_window_move(GTK_WINDOW(mShell), aX, aY);
     }
     else if (mGdkWindow) {
         gdk_window_move(mGdkWindow, aX, aY);
     }
 
-    NotifyRollupGeometryChange(gRollupListener);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindow::PlaceBehind(nsTopLevelWidgetZPlacement  aPlacement,
                       nsIWidget                  *aWidget,
                       bool                        aActivate)
 {
--- a/widget/nsIRollupListener.h
+++ b/widget/nsIRollupListener.h
@@ -40,16 +40,11 @@ class nsIRollupListener {
    * Retrieve the widgets for open menus and store them in the array
    * aWidgetChain. The number of menus of the same type should be returned,
    * for example, if a context menu is open, return only the number of menus
    * that are part of the context menu chain. This allows closing up only
    * those menus in different situations. The returned value should be exactly
    * the same number of widgets added to aWidgetChain.
    */
   virtual PRUint32 GetSubmenuWidgetChain(nsTArray<nsIWidget*> *aWidgetChain) = 0;
-
-  /**
-   * Notify the RollupListener that the widget did a Move or Resize.
-   */
-  virtual void NotifyGeometryChange() = 0;
 };
 
 #endif /* __nsIRollupListener_h__ */
--- a/widget/os2/nsWindow.cpp
+++ b/widget/os2/nsWindow.cpp
@@ -761,46 +761,40 @@ void nsWindow::NS2PM_PARENT(POINTL& ptl)
   }
 }
 
 //-----------------------------------------------------------------------------
 
 NS_METHOD nsWindow::Move(PRInt32 aX, PRInt32 aY)
 {
   if (mFrame) {
-    nsresult rv = mFrame->Move(aX, aY);
-    NotifyRollupGeometryChange(gRollupListener);
-    return rv;
+    return mFrame->Move(aX, aY);
   }
   Resize(aX, aY, mBounds.width, mBounds.height, false);
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 
 NS_METHOD nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, bool aRepaint)
 {
   if (mFrame) {
-    nsresult rv = mFrame->Resize(aWidth, aHeight, aRepaint);
-    NotifyRollupGeometryChange(gRollupListener);
-    return rv;
+    return mFrame->Resize(aWidth, aHeight, aRepaint);
   }
   Resize(mBounds.x, mBounds.y, aWidth, aHeight, aRepaint);
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 
 NS_METHOD nsWindow::Resize(PRInt32 aX, PRInt32 aY,
                            PRInt32 aWidth, PRInt32 aHeight, bool aRepaint)
 {
   if (mFrame) {
-    nsresult rv = mFrame->Resize(aX, aY, aWidth, aHeight, aRepaint);
-    NotifyRollupGeometryChange(gRollupListener);
-    return rv;
+    return mFrame->Resize(aX, aY, aWidth, aHeight, aRepaint);
   }
 
   // For mWnd & eWindowType_child set the cached values upfront, see bug 286555.
   // For other mWnd types we defer transfer of values to mBounds to
   // WinSetWindowPos(), see bug 391421.
 
   if (!mWnd ||
       mWindowType == eWindowType_child ||
@@ -828,17 +822,16 @@ NS_METHOD nsWindow::Resize(PRInt32 aX, P
     }
 
     if (!WinSetWindowPos(mWnd, 0, ptl.x, ptl.y, aWidth, aHeight,
                          SWP_MOVE | SWP_SIZE) && aRepaint) {
       WinInvalidateRect(mWnd, 0, FALSE);
     }
   }
 
-  NotifyRollupGeometryChange(gRollupListener);
   return NS_OK;
 }
 
 //-----------------------------------------------------------------------------
 
 NS_METHOD nsWindow::PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
                                 nsIWidget* aWidget, bool aActivate)
 {
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -541,17 +541,17 @@ nsWindow::Move(PRInt32 aX, PRInt32 aY)
         pos = mWidget->mapFromScene(pos);
         pos = mWidget->mapToParent(pos);
         mWidget->setPos(pos);
     }
 
     mBounds.x = pos.x();
     mBounds.y = pos.y();
 
-    NotifyRollupGeometryChange(gRollupListener);
+
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindow::PlaceBehind(nsTopLevelWidgetZPlacement  aPlacement,
                       nsIWidget                  *aWidget,
                       bool                        aActivate)
 {
@@ -3006,17 +3006,16 @@ nsWindow::Resize(PRInt32 aWidth, PRInt32
 
     // synthesize a resize event if this isn't a toplevel
     if (mIsTopLevel || mListenForResizes) {
         nsIntRect rect(mBounds.x, mBounds.y, aWidth, aHeight);
         nsEventStatus status;
         DispatchResizeEvent(rect, status);
     }
 
-    NotifyRollupGeometryChange(gRollupListener);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindow::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight,
                  bool aRepaint)
 {
     mBounds.x = aX;
@@ -3070,17 +3069,16 @@ nsWindow::Resize(PRInt32 aX, PRInt32 aY,
         nsIntRect rect(aX, aY, aWidth, aHeight);
         nsEventStatus status;
         DispatchResizeEvent(rect, status);
     }
 
     if (aRepaint)
         mWidget->update();
 
-    NotifyRollupGeometryChange(gRollupListener);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindow::Enable(bool aState)
 {
     mEnabled = aState;
 
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -1323,17 +1323,16 @@ NS_METHOD nsWindow::Move(PRInt32 aX, PRI
         mClipRects &&
         (mClipRectCount != 1 || !mClipRects[0].IsEqualInterior(nsIntRect(0, 0, mBounds.width, mBounds.height)))) {
       flags |= SWP_NOCOPYBITS;
     }
     VERIFY(::SetWindowPos(mWnd, NULL, aX, aY, 0, 0, flags));
 
     SetThemeRegion();
   }
-  NotifyRollupGeometryChange(sRollupListener);
   return NS_OK;
 }
 
 // Resize this component
 NS_METHOD nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, bool aRepaint)
 {
   NS_ASSERTION((aWidth >=0 ) , "Negative width passed to nsWindow::Resize");
   NS_ASSERTION((aHeight >=0 ), "Negative height passed to nsWindow::Resize");
@@ -1361,17 +1360,16 @@ NS_METHOD nsWindow::Resize(PRInt32 aWidt
     ClearThemeRegion();
     VERIFY(::SetWindowPos(mWnd, NULL, 0, 0, aWidth, GetHeight(aHeight), flags));
     SetThemeRegion();
   }
 
   if (aRepaint)
     Invalidate();
 
-  NotifyRollupGeometryChange(sRollupListener);
   return NS_OK;
 }
 
 // Resize this component
 NS_METHOD nsWindow::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, bool aRepaint)
 {
   NS_ASSERTION((aWidth >=0 ),  "Negative width passed to nsWindow::Resize");
   NS_ASSERTION((aHeight >=0 ), "Negative height passed to nsWindow::Resize");
@@ -1401,17 +1399,16 @@ NS_METHOD nsWindow::Resize(PRInt32 aX, P
     ClearThemeRegion();
     VERIFY(::SetWindowPos(mWnd, NULL, aX, aY, aWidth, GetHeight(aHeight), flags));
     SetThemeRegion();
   }
 
   if (aRepaint)
     Invalidate();
 
-  NotifyRollupGeometryChange(sRollupListener);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindow::BeginResizeDrag(nsGUIEvent* aEvent, PRInt32 aHorizontal, PRInt32 aVertical)
 {
   NS_ENSURE_ARG_POINTER(aEvent);
 
--- a/widget/xpwidgets/nsBaseWidget.h
+++ b/widget/xpwidgets/nsBaseWidget.h
@@ -9,17 +9,16 @@
 #include "nsIWidget.h"
 #include "nsWidgetsCID.h"
 #include "nsILocalFile.h"
 #include "nsString.h"
 #include "nsCOMPtr.h"
 #include "nsGUIEvent.h"
 #include "nsAutoPtr.h"
 #include "BasicLayers.h"
-#include "nsIRollupListener.h"
 
 class nsIContent;
 class nsAutoRollup;
 class gfxContext;
 
 namespace mozilla {
 namespace layers {
 class CompositorChild;
@@ -261,23 +260,16 @@ protected:
   {
     static NS_DEFINE_IID(kCPopUpCID, NS_CHILD_CID);
     nsCOMPtr<nsIWidget> widget = do_CreateInstance(kCPopUpCID);
     return widget.forget();
   }
 
   BasicLayerManager* CreateBasicLayerManager();
 
-  void NotifyRollupGeometryChange(nsIRollupListener* aRollupListener)
-  {
-    if (aRollupListener) {
-      aRollupListener->NotifyGeometryChange();
-    }
-  }
-
 protected:
   /**
    * Starts the OMTC compositor destruction sequence.
    *
    * When this function returns, the compositor should not be 
    * able to access the opengl context anymore.
    * It is safe to call it several times if platform implementations
    * require the compositor to be destroyed before ~nsBaseWidget is