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 id23636
push usergsharp@mozilla.com
push dateMon, 08 Oct 2012 08:08:19 +0000
treeherdermozilla-central@24cf40690042 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenndeakin
bugs788829
milestone18.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
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