Bug 1267568 part 3 - Use an individual method for check whether resize should be delayed. r=smaug
authorXidorn Quan <quanxunzhen@gmail.com>
Tue, 03 May 2016 17:58:57 +1000
changeset 295869 ffcdd861062d2400e3991964bb151ad17f270faa
parent 295868 fa640b84845393a371b96a5bc5d17147ecff9df5
child 295870 da3006dcfb7b7525ef19208d2d38d52c01f72bb3
push id19043
push usercbook@mozilla.com
push dateTue, 03 May 2016 14:20:17 +0000
treeherderfx-team@7f959c47385b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1267568
milestone49.0a1
Bug 1267568 part 3 - Use an individual method for check whether resize should be delayed. r=smaug MozReview-Commit-ID: 3esSPNoDJCB
view/nsViewManager.cpp
view/nsViewManager.h
--- a/view/nsViewManager.cpp
+++ b/view/nsViewManager.cpp
@@ -188,22 +188,33 @@ void nsViewManager::DoSetWindowDimension
   if (!oldDim.IsEqualEdges(newDim)) {
     // Don't resize the widget. It is already being set elsewhere.
     mRootView->SetDimensions(newDim, true, false);
     if (mPresShell)
       mPresShell->ResizeReflow(aWidth, aHeight);
   }
 }
 
+bool
+nsViewManager::ShouldDelayResize() const
+{
+  MOZ_ASSERT(mRootView);
+  if (!mRootView->IsEffectivelyVisible() ||
+      !mPresShell || !mPresShell->IsVisible() ||
+      mPresShell->IsInFullscreenChange()) {
+    return true;
+  }
+  return false;
+}
+
 void
 nsViewManager::SetWindowDimensions(nscoord aWidth, nscoord aHeight)
 {
   if (mRootView) {
-    if (mRootView->IsEffectivelyVisible() && mPresShell &&
-        mPresShell->IsVisible() && !mPresShell->IsInFullscreenChange()) {
+    if (!ShouldDelayResize()) {
       if (mDelayedResize != nsSize(NSCOORD_NONE, NSCOORD_NONE) &&
           mDelayedResize != nsSize(aWidth, aHeight)) {
         // We have a delayed resize; that now obsolete size may already have
         // been flushed to the PresContext so we need to update the PresContext
         // with the new size because if the new size is exactly the same as the
         // root view's current size then DoSetWindowDimensions will not
         // request a resize reflow (which would correct it). See bug 617076.
         mDelayedResize = nsSize(aWidth, aHeight);
--- a/view/nsViewManager.h
+++ b/view/nsViewManager.h
@@ -356,16 +356,17 @@ private:
   /**
    * Intersects aRect with aView's bounds and then transforms it from aView's
    * coordinate system to the coordinate system of the widget attached to
    * aView.
    */
   LayoutDeviceIntRect ViewToWidget(nsView* aView, const nsRect& aRect) const;
 
   void DoSetWindowDimensions(nscoord aWidth, nscoord aHeight);
+  bool ShouldDelayResize() const;
 
   bool IsPainting() const {
     return RootViewManager()->mPainting;
   }
 
   void SetPainting(bool aPainting) {
     RootViewManager()->mPainting = aPainting;
   }