Bug 1344398 part 1: Move presContext variable a little earlier in a nsCSSFrameConstructor method. r=tnikkel draft
authorDaniel Holbert <dholbert@cs.stanford.edu>
Wed, 10 May 2017 13:53:25 -0700
changeset 575775 67cbf91fb2fdeb46352559fb519693d6d13d3224
parent 575761 fa38c52a84a53685883ea4040193ea5c38c6ff8f
child 575776 0aba57dcc7e3dc6329b7cfc187384fe46d5a5a5e
push id58161
push userdholbert@mozilla.com
push dateWed, 10 May 2017 20:55:46 +0000
reviewerstnikkel
bugs1344398
milestone55.0a1
Bug 1344398 part 1: Move presContext variable a little earlier in a nsCSSFrameConstructor method. r=tnikkel Also, assert that this presContext is non-null (which we already implicitly assume, when we dereference it without null-checking it). MozReview-Commit-ID: IIYUqGQTOnb
layout/base/nsCSSFrameConstructor.cpp
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -8483,21 +8483,24 @@ nsCSSFrameConstructor::ContentRemoved(ns
   // old Gecko style system.
   //
   // That said, it's almost certainly possible to optimize this if it turns out to be
   // hot. It's just not a priority at the moment.
   if (aFlags == REMOVE_DESTROY_FRAMES && aChild->IsElement() && aChild->IsStyledByServo()) {
     ServoRestyleManager::ClearServoDataFromSubtree(aChild->AsElement());
   }
 
+  nsPresContext* presContext = mPresShell->GetPresContext();
+  MOZ_ASSERT(presContext, "Our presShell should have a valid presContext");
+
   if (aChild->IsHTMLElement(nsGkAtoms::body) ||
       (!aContainer && aChild->IsElement())) {
     // This might be the element we propagated viewport scrollbar
     // styles from.  Recompute those.
-    mPresShell->GetPresContext()->UpdateViewportScrollbarStylesOverride();
+    presContext->UpdateViewportScrollbarStylesOverride();
   }
 
   // XXXldb Do we need to re-resolve style to handle the CSS2 + combinator and
   // the :empty pseudo-class?
 
 #ifdef DEBUG
   if (gNoisyContentUpdates) {
     printf("nsCSSFrameConstructor::ContentRemoved container=%p child=%p "
@@ -8549,17 +8552,16 @@ nsCSSFrameConstructor::ContentRemoved(ns
         if (aFlags != REMOVE_DESTROY_FRAMES && *aDidReconstruct) {
           return;
         }
       }
     }
     ClearDisplayContentsIn(aChild, aContainer);
   }
 
-  nsPresContext* presContext = mPresShell->GetPresContext();
 #ifdef MOZ_XUL
   if (NotifyListBoxBody(presContext, aContainer, aChild, aOldNextSibling,
                         childFrame, CONTENT_REMOVED)) {
     if (aFlags == REMOVE_DESTROY_FRAMES) {
       CaptureStateForFramesOf(aChild, mTempFrameTreeState);
     }
     return;
   }