Bug 394301, bookmark menu shown too short, r+sr=bz, a=mconnor
authorenndeakin@sympatico.ca
Tue, 18 Sep 2007 07:35:17 -0700
changeset 6049 fd3de1362f6afa8e0e5635a853dd1e8d81700eb1
parent 6048 531e0e8b43b389c9819ef920ed0300f272cff5e6
child 6050 7ce641c5c4adbb23fd6a985dd6c6ac220d9b0c5b
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersmconnor
bugs394301
milestone1.9a8pre
Bug 394301, bookmark menu shown too short, r+sr=bz, a=mconnor
layout/xul/base/src/nsMenuFrame.cpp
layout/xul/base/src/nsMenuFrame.h
--- a/layout/xul/base/src/nsMenuFrame.cpp
+++ b/layout/xul/base/src/nsMenuFrame.cpp
@@ -191,18 +191,17 @@ NS_INTERFACE_MAP_END_INHERITING(nsBoxFra
 // nsMenuFrame cntr
 //
 nsMenuFrame::nsMenuFrame(nsIPresShell* aShell, nsStyleContext* aContext):
   nsBoxFrame(aShell, aContext),
     mIsMenu(PR_FALSE),
     mChecked(PR_FALSE),
     mType(eMenuType_Normal),
     mMenuParent(nsnull),
-    mPopupFrame(nsnull),
-    mLastPref(-1,-1)
+    mPopupFrame(nsnull)
 {
 
 } // cntr
 
 NS_IMETHODIMP
 nsMenuFrame::SetParent(const nsIFrame* aParent)
 {
   nsBoxFrame::SetParent(aParent);
@@ -729,20 +728,19 @@ nsMenuFrame::DoLayout(nsBoxLayoutState& 
     nsSize maxSize = mPopupFrame->GetMaxSize(aState);
 
     BoundsCheck(minSize, prefSize, maxSize);
 
     if (sizeToPopup)
         prefSize.width = mRect.width;
 
     // if the pref size changed then set bounds to be the pref size
-    PRBool sizeChanged = (mLastPref != prefSize);
+    PRBool sizeChanged = (mPopupFrame->GetRect().Size() != prefSize);
     if (sizeChanged) {
       mPopupFrame->SetBounds(aState, nsRect(0,0,prefSize.width, prefSize.height));
-      mLastPref = prefSize;
     }
 
     // if the menu has just been opened, or its size changed, position
     // the popup. The flag that the popup checks in the HasOpenChanged
     // method will get cleared in AdjustView which is called below.
     if (IsOpen() && (sizeChanged || mPopupFrame->HasOpenChanged()))
       mPopupFrame->SetPopupPosition(this);
 
@@ -1161,17 +1159,16 @@ nsMenuFrame::RemoveFrame(nsIAtom*       
                          nsIFrame*       aOldFrame)
 {
   nsresult rv =  NS_OK;
 
   if (mPopupFrame == aOldFrame) {
     // Go ahead and remove this frame.
     mPopupFrame->Destroy();
     mPopupFrame = nsnull;
-    mLastPref.SizeTo(-1, -1);
     PresContext()->PresShell()->
       FrameNeedsReflow(this, nsIPresShell::eTreeChange,
                        NS_FRAME_HAS_DIRTY_CHILDREN);
     rv = NS_OK;
   } else {
     rv = nsBoxFrame::RemoveFrame(aListName, aOldFrame);
   }
 
@@ -1182,17 +1179,16 @@ NS_IMETHODIMP
 nsMenuFrame::InsertFrames(nsIAtom*        aListName,
                           nsIFrame*       aPrevFrame,
                           nsIFrame*       aFrameList)
 {
   nsresult          rv;
 
   if (!mPopupFrame && aFrameList->GetType() == nsGkAtoms::menuPopupFrame) {
     mPopupFrame = static_cast<nsMenuPopupFrame *>(aFrameList);
-    mLastPref.SizeTo(-1, -1);
 
 #ifdef DEBUG_LAYOUT
     nsBoxLayoutState state(PresContext());
     SetDebug(state, aFrameList, mState & NS_STATE_CURRENTLY_IN_DEBUG);
 #endif
     PresContext()->PresShell()->
       FrameNeedsReflow(this, nsIPresShell::eTreeChange,
                        NS_FRAME_HAS_DIRTY_CHILDREN);
@@ -1210,17 +1206,16 @@ nsMenuFrame::AppendFrames(nsIAtom*      
 {
   if (!aFrameList)
     return NS_OK;
 
   nsresult          rv;
 
   if (!mPopupFrame && aFrameList->GetType() == nsGkAtoms::menuPopupFrame) {
     mPopupFrame = static_cast<nsMenuPopupFrame *>(aFrameList);
-    mLastPref.SizeTo(-1, -1);
 
 #ifdef DEBUG_LAYOUT
     nsBoxLayoutState state(PresContext());
     SetDebug(state, aFrameList, mState & NS_STATE_CURRENTLY_IN_DEBUG);
 #endif
     PresContext()->PresShell()->
       FrameNeedsReflow(this, nsIPresShell::eTreeChange,
                        NS_FRAME_HAS_DIRTY_CHILDREN);
--- a/layout/xul/base/src/nsMenuFrame.h
+++ b/layout/xul/base/src/nsMenuFrame.h
@@ -265,18 +265,16 @@ protected:
   PRPackedBool mChecked;              // are we checked?
   nsMenuType mType;
 
   nsIMenuParent* mMenuParent; // Our parent menu.
 
   // the popup for this menu, owned
   nsMenuPopupFrame* mPopupFrame;
 
-  nsSize mLastPref;
-
   // Reference to the mediator which wraps this frame.
   nsRefPtr<nsMenuTimerMediator> mTimerMediator;
 
   nsCOMPtr<nsITimer> mOpenTimer;
 
   nsString mGroupName;
   
   //we load some display strings from platformKeys.properties only once