bug 130886 - caret doesn't respect character position within certain <mo> elements, r=roc+moz, sr=attinasi, a=asa

This commit is contained in:
rbs%maths.uq.edu.au 2002-03-22 04:49:33 +00:00
Родитель 2a441078b6
Коммит 2dac49c58b
1 изменённых файлов: 41 добавлений и 23 удалений

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

@ -113,9 +113,17 @@ nsMathMLmoFrame::ProcessTextData(nsIPresContext* aPresContext)
{
mFlags = 0;
// don't bother doing anything special if we don't have a
// single child with a text content
nsAutoString data;
if (mFrames.GetLength() != 1) {
mMathMLChar.SetData(aPresContext, data); // empty data to reset the char
ResolveMathMLCharStyle(aPresContext, mContent, mStyleContext, &mMathMLChar, PR_FALSE);
return;
}
// kids can be comment-nodes, attribute-nodes, text-nodes...
// we use the DOM to ensure that we only look at text-nodes...
nsAutoString data;
PRInt32 numKids;
mContent->ChildCount(numKids);
for (PRInt32 kid=0; kid<numKids; kid++) {
@ -712,10 +720,9 @@ nsMathMLmoFrame::Stretch(nsIPresContext* aPresContext,
}
}
if (!useMathMLChar) {
// Place our children using the default method
// This will allow our child text frame to get its DidReflow()
Place(aPresContext, aRenderingContext, PR_TRUE, aDesiredStretchSize);
}
// Fixup for the final height.
// On one hand, our stretchy height can sometimes be shorter than surrounding
@ -758,8 +765,7 @@ nsMathMLmoFrame::Stretch(nsIPresContext* aPresContext,
aDesiredStretchSize.mBoundingMetrics.width = mBoundingMetrics.width;
nscoord dx = mEmbellishData.leftSpace;
if (!dx) return NS_OK;
if (dx) {
// adjust the offsets
mBoundingMetrics.leftBearing += dx;
mBoundingMetrics.rightBearing += dx;
@ -780,6 +786,18 @@ nsMathMLmoFrame::Stretch(nsIPresContext* aPresContext,
}
}
}
}
if (useMathMLChar && mFrames.FirstChild()) {
// even though our child text frame is not doing the rendering, we make it play
// nice with other operations that the MathMLChar doesn't handle (e.g., caret)
// use our whole height (i.e., with the leading that isn't part of the MathMLChar)
nsRect rect;
mMathMLChar.GetRect(rect);
rect.y = 0;
rect.height = aDesiredStretchSize.height;
mFrames.FirstChild()->SetRect(aPresContext, rect);
}
return NS_OK;
}