Bug 1382017 - stylo: Don't crash on null parent contexts in nsCSSFrameConstructor::AddFrameConstructionItemsInternal ; r?xidorn
MozReview-Commit-ID: Ga6s9RlRqzl
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -5882,18 +5882,21 @@ nsCSSFrameConstructor::AddFrameConstruct
ServoRestyleManager::ClearServoDataFromSubtree(element);
styleSet->StyleNewSubtree(element);
// Servo's should_traverse_children() in traversal.rs skips
// styling descendants of elements with a -moz-binding the
// first time. Thus call StyleNewChildren() again.
styleSet->StyleNewChildren(element);
+ auto parent = styleContext->GetParentAllowServo();
+ ServoStyleContext* parentServo = parent ? parent->AsServo() : nullptr;
+
styleContext =
- styleSet->ResolveStyleFor(element, styleContext->GetParentAllowServo()->AsServo(),
+ styleSet->ResolveStyleFor(element, parent,
LazyComputeBehavior::Assert);
} else {
styleContext =
ResolveStyleContext(styleContext->GetParent(), aContent, &aState);
}
display = styleContext->StyleDisplay();
aStyleContext = styleContext;