Bug 788829 - Call SetSizeConstraints even if a popup is not open. r=enndeakin
authorDavid Keeler <dkeeler@mozilla.com>
Wed, 12 Sep 2012 17:10:09 -0700
changeset 109589 54079ce3e83633654bdd7d24bf5ae32323c843d2
parent 109588 71c76fb26e9efb904a68062ec295fcf9ae65cd0e
child 109590 65b95ed309b948dbd8aa2fcd79a98ebee7395eee
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersenndeakin
bugs788829
milestone18.0a1
Bug 788829 - Call SetSizeConstraints even if a popup is not open. r=enndeakin
layout/xul/base/src/nsMenuPopupFrame.cpp
--- a/layout/xul/base/src/nsMenuPopupFrame.cpp
+++ b/layout/xul/base/src/nsMenuPopupFrame.cpp
@@ -440,30 +440,30 @@ nsMenuPopupFrame::LayoutPopup(nsBoxLayou
       mPrefSize = newsize;
       if (isOpen) {
         SetPopupPosition(nullptr, false);
       }
     }
   }
 
   nsPresContext* pc = PresContext();
+  nsIView* view = GetView();
+
+  if (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) {
-    nsIView* view = GetView();
     nsIViewManager* viewManager = view->GetViewManager();
     nsRect rect = GetRect();
     rect.x = rect.y = 0;
-
-    if (sizeChanged) {
-      // If the size of the popup changed, apply any size constraints.
-      nsIWidget* widget = view->GetWidget();
-      if (widget) {
-        SetSizeConstraints(pc, widget, minSize, maxSize);
-      }
-    }
-
     viewManager->ResizeView(view, rect);
 
     viewManager->SetViewVisibility(view, nsViewVisibility_kShow);
     mPopupState = ePopupOpenAndVisible;
     nsContainerFrame::SyncFrameViewProperties(pc, this, nullptr, view, 0);
   }
 
   // finally, if the popup just opened, send a popupshown event