Bug 1382918 - Respect widget min and max size in nsMenuPopupFrame to prevent excessive compositing. r=mstange
authorRyan Hunt <rhunt@eqrion.net>
Wed, 26 Jul 2017 23:36:13 -0500
changeset 420283 a37abf878197b5840adf1db527021c71aa50d8a4
parent 420282 6a51dec278cc313330d877902f1a650061680e91
child 420284 7068c8d4448c81ae1787451ac1969a3fab317458
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1382918
milestone56.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 1382918 - Respect widget min and max size in nsMenuPopupFrame to prevent excessive compositing. r=mstange nsMenuPopupFrame will constrain the size of its widget to its min and max size. It will also request its nsView to resize to its frame rect. If its frame rect is larger or smaller than the min or max size, nsView will be unable to change the size of the widget, and each ViewManagerFlush will attempt a resize and force a composite. When there are a lot of ViewManagerFlushes, this can overload the compositor.
layout/xul/nsMenuPopupFrame.cpp
--- a/layout/xul/nsMenuPopupFrame.cpp
+++ b/layout/xul/nsMenuPopupFrame.cpp
@@ -558,16 +558,17 @@ nsMenuPopupFrame::LayoutPopup(nsBoxLayou
       SetSizeConstraints(pc, widget, minSize, maxSize);
     }
   }
 
   if (isOpen) {
     nsViewManager* viewManager = view->GetViewManager();
     nsRect rect = GetRect();
     rect.x = rect.y = 0;
+    rect.SizeTo(BoundsCheck(minSize, rect.Size(), maxSize));
     viewManager->ResizeView(view, rect);
 
     if (mPopupState == ePopupOpening) {
       mPopupState = ePopupVisible;
     }
 
     viewManager->SetViewVisibility(view, nsViewVisibility_kShow);
     SyncFrameViewProperties(view);