Bug 953385 - Set math script flag on textruns belonging to MathML tokens. r=roc

This commit is contained in:
James Kitchener 2014-01-30 10:59:16 -05:00
parent 73fcb48bd9
commit 705ad85b6f
2 changed files with 20 additions and 5 deletions

View File

@ -1324,11 +1324,16 @@ BuildTextRuns(gfxContext* aContext, nsTextFrame* aForFrame,
"Wrong line container hint");
}
if (aForFrame && aForFrame->HasAnyStateBits(NS_FRAME_IS_IN_SINGLE_CHAR_MI)) {
aLineContainer->AddStateBits(NS_FRAME_IS_IN_SINGLE_CHAR_MI);
}
if (aForFrame && aForFrame->HasAnyStateBits(NS_FRAME_MATHML_SCRIPT_DESCENDANT)) {
aLineContainer->AddStateBits(NS_FRAME_MATHML_SCRIPT_DESCENDANT);
if (aForFrame) {
if (aForFrame->HasAnyStateBits(TEXT_IS_IN_TOKEN_MATHML)) {
aLineContainer->AddStateBits(TEXT_IS_IN_TOKEN_MATHML);
if (aForFrame->HasAnyStateBits(NS_FRAME_IS_IN_SINGLE_CHAR_MI)) {
aLineContainer->AddStateBits(NS_FRAME_IS_IN_SINGLE_CHAR_MI);
}
}
if (aForFrame->HasAnyStateBits(NS_FRAME_MATHML_SCRIPT_DESCENDANT)) {
aLineContainer->AddStateBits(NS_FRAME_MATHML_SCRIPT_DESCENDANT);
}
}
nsPresContext* presContext = aLineContainer->PresContext();
@ -1980,6 +1985,13 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
anyMathMLStyling = true;
}
nsIFrame* parent = mLineContainer->GetParent();
if (mLineContainer->HasAnyStateBits(TEXT_IS_IN_TOKEN_MATHML)) {
// All MathML tokens except <mtext> use 'math' script.
if (!(parent && parent->GetContent() &&
parent->GetContent()->Tag() == nsGkAtoms::mtext_)) {
textFlags |= gfxTextRunFactory::TEXT_USE_MATH_SCRIPT;
}
}
nsIFrame* child = mLineContainer;
uint8_t oldScriptLevel = 0;
while (parent &&

View File

@ -54,6 +54,9 @@ public:
// so that it also has access to the _INCOMING flag
// TEXT_TRAILING_ARABICCHAR
// TEXT_INCOMING_ARABICCHAR
// This is defined in gfxTextRunFactory to allow access in gfxFont.
// TEXT_USE_MATH_SCRIPT
};
// These constants are used in TransformText to represent context information