Backed out changeset 41f004509646 (bug 1315394) for android crashtest assertions a=backout
authorWes Kocher <wkocher@mozilla.com>
Fri, 11 Nov 2016 11:17:53 -0800
changeset 352323 7cd08d5a029d98157b1548f2b0fc28e62849a2ea
parent 352322 447eb26dd36a4d64f9236065a8b2859fadfc069b
child 352324 bab8ca566708c22df6fd85a74fb7aac075e80d16
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1315394
milestone52.0a1
backs out41f0045096469c7245bc376f1e43bebe9768e0da
Backed out changeset 41f004509646 (bug 1315394) for android crashtest assertions a=backout
layout/base/nsDocumentViewer.cpp
layout/base/nsPresShell.cpp
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -4464,27 +4464,16 @@ NS_IMETHODIMP nsDocumentViewer::SetPageM
 
   if (mPresContext) {
     DestroyPresContext();
   }
 
   mViewManager  = nullptr;
   mWindow       = nullptr;
 
-  // We're creating a new presentation context for an existing document.
-  // Remove and reinsert the root from the DOM, which will cause us to
-  // drop any associated layout data (i.e. ServoElementData).
-  Element* root = mDocument->GetRootElement();
-  if (root) {
-    auto index = mDocument->IndexOf(root);
-    MOZ_ASSERT(index >= 0);
-    mDocument->RemoveChildAt(index, /* aNotify = */ false);
-    mDocument->InsertChildAt(root, index, /* aNotify = */ false);
-  }
-
   NS_ENSURE_STATE(mDocument);
   if (aPageMode)
   {    
     mPresContext = CreatePresContext(mDocument,
         nsPresContext::eContext_PageLayout, FindContainerView());
     NS_ENSURE_TRUE(mPresContext, NS_ERROR_OUT_OF_MEMORY);
     mPresContext->SetPaginatedScrolling(true);
     mPresContext->SetPrintSettings(aPrintSettings);
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -1693,16 +1693,23 @@ PresShell::Initialize(nscoord aWidth, ns
 #endif
 
   // XXX Do a full invalidate at the beginning so that invalidates along
   // the way don't have region accumulation issues?
 
   mPresContext->SetVisibleArea(nsRect(0, 0, aWidth, aHeight));
 
   if (mStyleSet->IsServo() && mDocument->GetRootElement()) {
+    // If we have the root element already, go ahead style it along with any
+    // descendants.
+    //
+    // Some things, like nsDocumentViewer::GetPageMode, recreate the PresShell
+    // while keeping the content tree alive (see bug 1292280) - so we
+    // unconditionally mark the root as dirty.
+    mDocument->GetRootElement()->SetIsDirtyForServo();
     mStyleSet->AsServo()->StyleDocument(/* aLeaveDirtyBits = */ false);
   }
 
   // Get the root frame from the frame manager
   // XXXbz it would be nice to move this somewhere else... like frame manager
   // Init(), say.  But we need to make sure our views are all set up by the
   // time we do this!
   nsIFrame* rootFrame = mFrameConstructor->GetRootFrame();