Bug 802456. Set min size in size constraints to zero when sizing a hidden view to zero to avoid resize conflicts. r=enndeakin a=lsblakk
authorTimothy Nikkel <tnikkel@gmail.com>
Mon, 29 Oct 2012 17:36:09 -0500
changeset 116607 dd53d0988e6ff9c8587066fde0ea1ef31d861c2b
parent 116606 5b307b318efa421de3d650e09c29b38719cf5ffd
child 116608 aee404ebbdae2215f1f3eff0383aaeb0cd1fb937
push id1708
push userakeybl@mozilla.com
push dateMon, 19 Nov 2012 21:10:21 +0000
treeherdermozilla-beta@27b14fe50103 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenndeakin, lsblakk
bugs802456
milestone18.0a2
Bug 802456. Set min size in size constraints to zero when sizing a hidden view to zero to avoid resize conflicts. r=enndeakin a=lsblakk
layout/xul/base/src/nsMenuPopupFrame.cpp
--- a/layout/xul/base/src/nsMenuPopupFrame.cpp
+++ b/layout/xul/base/src/nsMenuPopupFrame.cpp
@@ -442,17 +442,17 @@ nsMenuPopupFrame::LayoutPopup(nsBoxLayou
         SetPopupPosition(nullptr, false);
       }
     }
   }
 
   nsPresContext* pc = PresContext();
   nsIView* view = GetView();
 
-  if (sizeChanged) {
+  if ((isOpen && mIsOpenChanged) || sizeChanged) {
     // If the size of the popup changed, apply any size constraints.
     nsIWidget* widget = view->GetWidget();
     if (widget) {
       SetSizeConstraints(pc, widget, minSize, maxSize);
     }
   }
 
   if (isOpen) {
@@ -788,16 +788,23 @@ nsMenuPopupFrame::HidePopup(bool aDesele
 
   mIsOpenChanged = false;
   mCurrentMenu = nullptr; // make sure no current menu is set
   mHFlip = mVFlip = false;
 
   nsIView* view = GetView();
   nsIViewManager* viewManager = view->GetViewManager();
   viewManager->SetViewVisibility(view, nsViewVisibility_kHide);
+  nsIWidget* widget = view->GetWidget();
+  if (widget) {
+    widget::SizeConstraints sizeConstraints = widget->GetSizeConstraints();
+    sizeConstraints.mMinSize.width = sizeConstraints.mMinSize.height = 0;
+    widget->SetSizeConstraints(sizeConstraints);
+  }
+  viewManager->ResizeView(view, nsRect(0, 0, 0, 0));
 
   FireDOMEvent(NS_LITERAL_STRING("DOMMenuInactive"), mContent);
 
   // XXX, bug 137033, In Windows, if mouse is outside the window when the menupopup closes, no
   // mouse_enter/mouse_exit event will be fired to clear current hover state, we should clear it manually.
   // This code may not the best solution, but we can leave it here until we find the better approach.
   NS_ASSERTION(mContent->IsElement(), "How do we have a non-element?");
   nsEventStates state = mContent->AsElement()->State();