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
--- 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;
}