Bug 711651, Clean up ResizeReflowIgnoreOverride, r=roc a=LegNeato BETA_BASE_20111220
authorOlli Pettay <Olli.Pettay@helsinki.fi>
Mon, 19 Dec 2011 22:23:27 +0200
changeset 80799 0d8490e274575cee5c89b4402cbaa71022e5b0f6
parent 80798 2bd5ab8de0f05f654b9e24bee0b9bcc5551f1b63
child 80800 5fd6b066d5640a8dea7c5070898243b28b3919a1
push id626
push useropettay@mozilla.com
push dateMon, 19 Dec 2011 20:50:31 +0000
treeherdermozilla-aurora@0d8490e27457 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, LegNeato
bugs711651
milestone10.0a2
Bug 711651, Clean up ResizeReflowIgnoreOverride, r=roc a=LegNeato
layout/base/nsPresShell.cpp
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -2096,47 +2096,49 @@ PresShell::ResizeReflowIgnoreOverride(ns
   nsIFrame* rootFrame = FrameManager()->GetRootFrame();
 
   if (!rootFrame && aHeight == NS_UNCONSTRAINEDSIZE) {
     // We can't do the work needed for SizeToContent without a root
     // frame, and we want to return before setting the visible area.
     return NS_ERROR_NOT_AVAILABLE;
   }
 
+  nsCOMPtr<nsIViewManager> viewManagerDeathGrip = mViewManager;
+  // Take this ref after viewManager so it'll make sure to go away first
+  nsCOMPtr<nsIPresShell> kungFuDeathGrip(this);
+
   if (!mIsDestroying && !mResizeEvent.IsPending() &&
       !mAsyncResizeTimerIsActive) {
     FireBeforeResizeEvent();
   }
 
   mPresContext->SetVisibleArea(nsRect(0, 0, aWidth, aHeight));
 
   // There isn't anything useful we can do if the initial reflow hasn't happened
+  rootFrame = FrameManager()->GetRootFrame();
   if (!rootFrame)
     return NS_OK;
 
-  NS_ASSERTION(mViewManager, "Must have view manager");
-  nsCOMPtr<nsIViewManager> viewManagerDeathGrip = mViewManager;
-  // Take this ref after viewManager so it'll make sure to go away first
-  nsCOMPtr<nsIPresShell> kungFuDeathGrip(this);
   if (!GetPresContext()->SupressingResizeReflow())
   {
     nsIViewManager::UpdateViewBatch batch(mViewManager);
 
     // Have to make sure that the content notifications are flushed before we
     // start messing with the frame model; otherwise we can get content doubling.
     mDocument->FlushPendingNotifications(Flush_ContentAndNotify);
 
     // Make sure style is up to date
     {
       nsAutoScriptBlocker scriptBlocker;
       mFrameConstructor->CreateNeededFrames();
       mFrameConstructor->ProcessPendingRestyles();
     }
 
-    if (!mIsDestroying) {
+    rootFrame = FrameManager()->GetRootFrame();
+    if (!mIsDestroying && rootFrame) {
       // XXX Do a full invalidate at the beginning so that invalidates along
       // the way don't have region accumulation issues?
 
       {
         nsAutoCauseReflowNotifier crNotifier(this);
         WillDoReflow();
 
         // Kick off a top-down reflow
@@ -2147,17 +2149,18 @@ PresShell::ResizeReflowIgnoreOverride(ns
       }
 
       DidDoReflow(true);
     }
 
     batch.EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC);
   }
 
-  if (aHeight == NS_UNCONSTRAINEDSIZE) {
+  rootFrame = FrameManager()->GetRootFrame();
+  if (aHeight == NS_UNCONSTRAINEDSIZE && rootFrame) {
     mPresContext->SetVisibleArea(
       nsRect(0, 0, aWidth, rootFrame->GetRect().height));
   }
 
   if (!mIsDestroying && !mResizeEvent.IsPending() &&
       !mAsyncResizeTimerIsActive) {
     if (mInResize) {
       if (!mAsyncResizeEventTimer) {