[#ifdef MOZ_MATHML: not yet part of default build]. Export the baseline out of the block frame code to support 'vertical-align: baseline' in table-cells. bug 10207. r:buster@netscape.com. a:waterson@mozilla.org

git-svn-id: svn://10.0.0.236/trunk@71513 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rbs%maths.uq.edu.au
2000-06-05 08:24:18 +00:00
parent c38ab71e04
commit 918b4d93c1
12 changed files with 372 additions and 0 deletions

View File

@@ -1072,6 +1072,17 @@ nsBlockReflowState::RecoverStateFrom(nsLineBox* aLine,
// coordinate.
nscoord finalDeltaY = newLineY - aLine->mBounds.y;
mBlock->SlideLine(*this, aLine, finalDeltaY);
#ifdef MOZ_MATHML
// aLine has been slided, but...
// XXX it is not necessary to worry about the ascent of mBlock here, right?
// Indeed, depending on the status of the first line of mBlock, we can either have:
// case first line of mBlock is dirty : it will be reflowed by mBlock and so
// mBlock->mAscent will be recomputed by the block frame, and we will
// never enter into this RecoverStateFrom(aLine) function.
// case first line of mBlock is clean : it is untouched by the incremental reflow.
// In other words, aLine is never equals to mBlock->mLines in this function.
// so mBlock->mAscent will remain unchanged.
#endif
// Place floaters for this line into the space manager
if (aLine->HasFloaters()) {
@@ -1438,6 +1449,14 @@ nsBlockFrame::IsPercentageBase(PRBool& aBase) const
//////////////////////////////////////////////////////////////////////
// Reflow methods
#ifdef MOZ_MATHML
inline nscoord
nsBlockFrame::GetAscent() const
{
return mAscent;
}
#endif
static void
CalculateContainingBlock(const nsHTMLReflowState& aReflowState,
nscoord aFrameWidth,
@@ -2259,6 +2278,11 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
autoHeight += borderPadding.bottom;
// Apply min/max values
#ifdef MOZ_MATHML
// XXX Here in ComputeFinalSize()
// XXX What to do when min/max values are applied to the height?
// How do all this impact on the first line of the block?
#endif
if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedMaxHeight) {
nscoord computedMaxHeight = aReflowState.mComputedMaxHeight +
borderPadding.top + borderPadding.bottom;
@@ -2281,8 +2305,22 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
}
}
#ifndef MOZ_MATHML
aMetrics.ascent = aMetrics.height;
aMetrics.descent = 0;
#else
if (mLines && mLines->mFirstChild && mLines->IsBlock()) {
// mAscent is not yet set because we didn't call VerticalAlignFrames()
// on mLines. So we need to fetch the ascent of the first child of mLines
nsBlockFrame* bf;
nsresult res = mLines->mFirstChild->QueryInterface(kBlockFrameCID, (void**)&bf);
if (NS_SUCCEEDED(res) && bf) {
mAscent = bf->GetAscent();
}
}
aMetrics.ascent = mAscent;
aMetrics.descent = aMetrics.height - aMetrics.ascent;
#endif
if (aState.GetFlag(BRS_COMPUTEMAXELEMENTSIZE)) {
// Store away the final value
aMetrics.maxElementSize->width = maxWidth;
@@ -4625,7 +4663,16 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
addedBullet = PR_TRUE;
}
nsSize maxElementSize;
#ifndef MOZ_MATHML
aLineLayout.VerticalAlignFrames(aLine, maxElementSize);
#else
nscoord lineAscent;
aLineLayout.VerticalAlignFrames(aLine, maxElementSize, lineAscent);
// Our ascent is the ascent of our first line
if (aLine == mLines) {
mAscent = lineAscent;
}
#endif
// See if we're shrink wrapping the width
if (aState.GetFlag(BRS_SHRINKWRAPWIDTH)) {
// When determining the line's width we also need to include any
@@ -4696,6 +4743,12 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
nscoord dy = -aState.mPrevBottomMargin;
newY = aState.mY + dy;
aLine->SlideBy(dy);
#ifdef MOZ_MATHML
// keep our ascent in sync
if (mLines == aLine) {
mAscent += dy;
}
#endif
}
// See if the line fit. If it doesn't we need to push it. Our first