Bug 851641. Simplify the logic in nsView::DoResetWidgetBounds. r=tnikkel
authorMats Palmgren <matspal@gmail.com>
Wed, 01 May 2013 16:21:33 -0500
changeset 130541 c0f3313e775994ce7d0b2b1cd6801d2e48711765
parent 130540 6151db377f706d0865f0931dbd0b90be3f933bba
child 130542 7b54ccf3088498f1e9ec8701165ca6701b242852
push id24621
push userphilringnalda@gmail.com
push dateThu, 02 May 2013 03:27:34 +0000
treeherdermozilla-central@0274ab3783b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs851641
milestone23.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 851641. Simplify the logic in nsView::DoResetWidgetBounds. r=tnikkel
view/src/nsView.cpp
--- a/view/src/nsView.cpp
+++ b/view/src/nsView.cpp
@@ -237,45 +237,42 @@ void nsView::DoResetWidgetBounds(bool aM
 
   NS_PRECONDITION(mWindow, "Why was this called??");
 
   // Hold this ref to make sure it stays alive.
   nsCOMPtr<nsIWidget> widget = mWindow;
 
   // Stash a copy of these and use them so we can handle this being deleted (say
   // from sync painting/flushing from Show/Move/Resize on the widget).
-  nsRect dimBounds = mDimBounds;
-  nsViewVisibility vis = mVis;
   nsIntRect newBounds;
   nsRefPtr<nsDeviceContext> dx;
   mViewManager->GetDeviceContext(*getter_AddRefs(dx));
 
   nsWindowType type;
   widget->GetWindowType(type);
 
   nsIntRect curBounds;
   widget->GetClientBounds(curBounds);
+  bool invisiblePopup = type == eWindowType_popup &&
+                        ((curBounds.IsEmpty() && mDimBounds.IsEmpty()) ||
+                         mVis == nsViewVisibility_kHide);
 
-  if (type == eWindowType_popup &&
-      ((curBounds.IsEmpty() && dimBounds.IsEmpty()) ||
-       vis == nsViewVisibility_kHide)) {
+  if (invisiblePopup) {
     // We're going to hit the early exit below, avoid calling CalcWidgetBounds.
   } else {
     newBounds = CalcWidgetBounds(type);
   }
 
   bool curVisibility = widget->IsVisible();
   bool newVisibility = IsEffectivelyVisible();
   if (curVisibility && !newVisibility) {
     widget->Show(false);
   }
 
-  if (type == eWindowType_popup &&
-      ((curBounds.IsEmpty() && dimBounds.IsEmpty()) ||
-       vis == nsViewVisibility_kHide)) {
+  if (invisiblePopup) {
     // Don't manipulate empty or hidden popup widgets. For example there's no
     // point moving hidden comboboxes around, or doing X server roundtrips
     // to compute their true screen position. This could mean that WidgetToScreen
     // operations on these widgets don't return up-to-date values, but popup
     // positions aren't reliable anyway because of correction to be on or off-screen.
     return;
   }