[MathML only] fix weirdness in the edge case of an empty <mfenced></mfenced>

This commit is contained in:
rbs%maths.uq.edu.au 2002-02-15 14:39:50 +00:00
Родитель ebacef8405
Коммит b010ac3189
3 изменённых файлов: 16 добавлений и 10 удалений

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

@ -981,6 +981,10 @@ struct nsBoundingMetrics {
to follow the current one. Depending on the font, this
could be greater than or less than the right bearing. */
nsBoundingMetrics() {
Clear();
}
//////////
// Utility methods and operators:

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

@ -1491,7 +1491,7 @@ nsMathMLChar::Stretch(nsIPresContext* aPresContext,
targetSize = aContainerSize.width;
}
// if we are not a largeop in display mode, return if size fits
if (!largeop && IsSizeOK(charSize, targetSize, aStretchHint)) {
if (targetSize <= 0 || (!largeop && IsSizeOK(charSize, targetSize, aStretchHint))) {
// ensure that the char later behaves like a normal char
// (will be reset back to its intrinsic value in case of dynamic updates)
mDirection = NS_STRETCH_DIRECTION_UNSUPPORTED;

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

@ -289,9 +289,9 @@ nsMathMLmfencedFrame::doReflow(nsIPresContext* aPresContext,
nsSize availSize(aReflowState.mComputedWidth, aReflowState.mComputedHeight);
nsHTMLReflowMetrics childDesiredSize(aDesiredSize.maxElementSize,
aDesiredSize.mFlags | NS_REFLOW_CALC_BOUNDING_METRICS);
nsIFrame* fisrtChild;
aForFrame->FirstChild(aPresContext, nsnull, &fisrtChild);
nsIFrame* childFrame = fisrtChild;
nsIFrame* firstChild;
aForFrame->FirstChild(aPresContext, nsnull, &firstChild);
nsIFrame* childFrame = firstChild;
while (childFrame) {
nsHTMLReflowState childReflowState(aPresContext, aReflowState,
childFrame, availSize);
@ -337,7 +337,7 @@ nsMathMLmfencedFrame::doReflow(nsIPresContext* aPresContext,
mathMLFrame->GetPreferredStretchSize(aPresContext, *aReflowState.rendContext,
0, /* i.e., without embellishments */
stretchDir, containerSize);
childFrame = fisrtChild;
childFrame = firstChild;
while (childFrame) {
nsIMathMLFrame* mathmlChild;
childFrame->QueryInterface(NS_GET_IID(nsIMathMLFrame), (void**)&mathmlChild);
@ -376,10 +376,12 @@ nsMathMLmfencedFrame::doReflow(nsIPresContext* aPresContext,
GetEmHeight(fm, em);
// we need to center around the axis
nscoord delta = PR_MAX(containerSize.ascent - axisHeight,
containerSize.descent + axisHeight);
containerSize.ascent = delta + axisHeight;
containerSize.descent = delta - axisHeight;
if (firstChild) { // do nothing for an empty <mfenced></mfenced>
nscoord delta = PR_MAX(containerSize.ascent - axisHeight,
containerSize.descent + axisHeight);
containerSize.ascent = delta + axisHeight;
containerSize.descent = delta - axisHeight;
}
/////////////////
// opening fence ...
@ -413,7 +415,7 @@ nsMathMLmfencedFrame::doReflow(nsIPresContext* aPresContext,
firstTime = PR_FALSE;
}
childFrame = fisrtChild;
childFrame = firstChild;
while (childFrame) {
nsHTMLReflowMetrics childSize(nsnull);
GetReflowAndBoundingMetricsFor(childFrame, childSize, bm);