Bug 1322570 Part 7 - Use GetParentAllowServo() in nsMathMLChar.
The nsMathMLChar has SetStyleContext() that can change nsStyleContext. It's
not obvious how to get parent style context other than calling GetParent().
So white-list this case for now.
Fixed tests like layout/reftests/bugs/347348-1.xhtml.
MozReview-Commit-ID: JZU1IzcMxs8
--- a/layout/mathml/nsMathMLChar.cpp
+++ b/layout/mathml/nsMathMLChar.cpp
@@ -1516,17 +1516,17 @@ nsMathMLChar::StretchInternal(nsPresCont
// if we have been called before, and we didn't actually stretch, our
// direction may have been set to NS_STRETCH_DIRECTION_UNSUPPORTED.
// So first set our direction back to its instrinsic value
nsStretchDirection direction = nsMathMLOperators::GetStretchyDirection(mData);
// Set default font and get the default bounding metrics
// mStyleContext is a leaf context used only when stretching happens.
// For the base size, the default font should come from the parent context
- nsFont font = mStyleContext->GetParent()->StyleFont()->mFont;
+ nsFont font = mStyleContext->GetParentAllowServo()->StyleFont()->mFont;
NormalizeDefaultFont(font, aFontSizeInflation);
const nsStyleFont* styleFont = mStyleContext->StyleFont();
nsFontMetrics::Params params;
params.language = styleFont->mLanguage;
params.explicitLanguage = styleFont->mExplicitLanguage;
params.userFontSet = aPresContext->GetUserFontSet();
params.textPerf = aPresContext->GetTextPerfMetrics();
@@ -1956,17 +1956,17 @@ void nsDisplayMathMLCharDebug::Paint(nsD
void
nsMathMLChar::Display(nsDisplayListBuilder* aBuilder,
nsIFrame* aForFrame,
const nsDisplayListSet& aLists,
uint32_t aIndex,
const nsRect* aSelectedRect)
{
- nsStyleContext* parentContext = mStyleContext->GetParent();
+ nsStyleContext* parentContext = mStyleContext->GetParentAllowServo();
nsStyleContext* styleContext = mStyleContext;
if (mDraw == DRAW_NORMAL) {
// normal drawing if there is nothing special about this char
// Set default context to the parent context
styleContext = parentContext;
}
@@ -2034,17 +2034,17 @@ nsMathMLChar::ApplyTransforms(gfxContext
}
void
nsMathMLChar::PaintForeground(nsPresContext* aPresContext,
nsRenderingContext& aRenderingContext,
nsPoint aPt,
bool aIsSelected)
{
- nsStyleContext* parentContext = mStyleContext->GetParent();
+ nsStyleContext* parentContext = mStyleContext->GetParentAllowServo();
nsStyleContext* styleContext = mStyleContext;
if (mDraw == DRAW_NORMAL) {
// normal drawing if there is nothing special about this char
// Set default context to the parent context
styleContext = parentContext;
}