Bug 1186768 patch 3 - Compute affectedByScriptMinSize sooner to avoid asserting or doing extra work. r=heycam

The assertion added in patch 1 caught a separate bug, which is that we
were computing whether we were affected by scriptMinSize too soon.
Prior to patch 1, this bug meant doing extra work (taking the slow
path).  With patch 1, this changes in documents without MathML to
hitting the assertion instead of taking the slow path.

--HG--
extra : commitid : JD1GY8VL4F0
This commit is contained in:
L. David Baron 2015-11-06 11:26:50 +08:00
Родитель 9b054b046b
Коммит 2187e9fcf7
1 изменённых файлов: 9 добавлений и 4 удалений

Просмотреть файл

@ -3846,14 +3846,19 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext,
&scriptLevelAdjustedUnconstrainedParentSize);
NS_ASSERTION(!aUsedStartStruct || aFont->mScriptUnconstrainedSize == aFont->mSize,
"If we have a start struct, we should have reset everything coming in here");
SetFontSize(aPresContext, aRuleData, aFont, aParentFont,
&aFont->mSize,
systemFont, aParentFont->mSize, scriptLevelAdjustedParentSize,
aUsedStartStruct, atRoot, aConditions);
// Compute whether we're affected by scriptMinSize *before* calling
// SetFontSize, since aParentFont might be the same as aFont. If it
// is, calling SetFontSize might throw off our calculation.
bool affectedByScriptMinSize =
aParentFont->mSize != aParentFont->mScriptUnconstrainedSize ||
scriptLevelAdjustedParentSize !=
scriptLevelAdjustedUnconstrainedParentSize;
SetFontSize(aPresContext, aRuleData, aFont, aParentFont,
&aFont->mSize,
systemFont, aParentFont->mSize, scriptLevelAdjustedParentSize,
aUsedStartStruct, atRoot, aConditions);
if (!aPresContext->Document()->GetMathMLEnabled()) {
MOZ_ASSERT(!affectedByScriptMinSize);
// If MathML is not enabled, we don't need to mark this node as