Bug 1322570 Part 7 - Use GetParentAllowServo() in nsMathMLChar. r=bz

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

--HG--
extra : rebase_source : 41880ffdc6064dd06e1cee6046a4cf64535d77b2
This commit is contained in:
Ting-Yu Lin 2017-03-20 14:14:30 +08:00
parent 0a2de7f987
commit fd01a09628

View File

@ -1521,7 +1521,7 @@ nsMathMLChar::StretchInternal(nsPresContext* aPresContext,
// 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();
@ -1961,7 +1961,7 @@ nsMathMLChar::Display(nsDisplayListBuilder* aBuilder,
uint32_t aIndex,
const nsRect* aSelectedRect)
{
nsStyleContext* parentContext = mStyleContext->GetParent();
nsStyleContext* parentContext = mStyleContext->GetParentAllowServo();
nsStyleContext* styleContext = mStyleContext;
if (mDraw == DRAW_NORMAL) {
@ -2039,7 +2039,7 @@ nsMathMLChar::PaintForeground(nsPresContext* aPresContext,
nsPoint aPt,
bool aIsSelected)
{
nsStyleContext* parentContext = mStyleContext->GetParent();
nsStyleContext* parentContext = mStyleContext->GetParentAllowServo();
nsStyleContext* styleContext = mStyleContext;
if (mDraw == DRAW_NORMAL) {