зеркало из https://github.com/mozilla/gecko-dev.git
Change the bulk of ascent (baseline) computation to happen on a virtual method on nsIFrame, and remove the redundant descent member from nsHTMLReflowMetrics, primarily to support having both first-line and last-line baselines. b=367332 r+sr=roc
This commit is contained in:
Родитель
6e8088efdd
Коммит
f6245f0ed9
|
@ -565,4 +565,4 @@ nsVisualIterator::GetPrevSiblingInner(nsIFrame* aFrame) {
|
|||
return nsnull;
|
||||
nsFrameList list(parent->GetFirstChild(nsnull));
|
||||
return list.GetPrevVisualFor(aFrame);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1676,8 +1676,8 @@ nsLayoutUtils::ComputeSizeWithIntrinsicDimensions(
|
|||
}
|
||||
|
||||
/* static */ nscoord
|
||||
nsLayoutUtils::MinWidthFromInline(nsIFrame *aFrame,
|
||||
nsIRenderingContext *aRenderingContext)
|
||||
nsLayoutUtils::MinWidthFromInline(nsIFrame* aFrame,
|
||||
nsIRenderingContext* aRenderingContext)
|
||||
{
|
||||
nsIFrame::InlineMinWidthData data;
|
||||
DISPLAY_MIN_WIDTH(aFrame, data.prevLines);
|
||||
|
@ -1687,8 +1687,8 @@ nsLayoutUtils::MinWidthFromInline(nsIFrame *aFrame,
|
|||
}
|
||||
|
||||
/* static */ nscoord
|
||||
nsLayoutUtils::PrefWidthFromInline(nsIFrame *aFrame,
|
||||
nsIRenderingContext *aRenderingContext)
|
||||
nsLayoutUtils::PrefWidthFromInline(nsIFrame* aFrame,
|
||||
nsIRenderingContext* aRenderingContext)
|
||||
{
|
||||
nsIFrame::InlinePrefWidthData data;
|
||||
DISPLAY_PREF_WIDTH(aFrame, data.prevLines);
|
||||
|
@ -1753,3 +1753,97 @@ nsLayoutUtils::GetStringWidth(const nsIFrame* aFrame,
|
|||
aContext->GetWidth(aString, aLength, width);
|
||||
return width;
|
||||
}
|
||||
|
||||
/* static */ PRBool
|
||||
nsLayoutUtils::GetFirstLineBaseline(const nsIFrame* aFrame, nscoord* aResult)
|
||||
{
|
||||
const nsBlockFrame* block;
|
||||
if (NS_FAILED(NS_CONST_CAST(nsIFrame*, aFrame)->
|
||||
QueryInterface(kBlockFrameCID, (void**)&block))) {
|
||||
// For the first-line baseline we also have to check for a table, and if
|
||||
// so, use the baseline of its first row.
|
||||
nsIAtom* fType = aFrame->GetType();
|
||||
if (fType == nsGkAtoms::tableOuterFrame) {
|
||||
*aResult = aFrame->GetBaseline();
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// For first-line baselines, we have to consider scroll frames.
|
||||
if (fType == nsGkAtoms::scrollFrame) {
|
||||
nsIScrollableFrame *sFrame;
|
||||
if (NS_FAILED(CallQueryInterface(NS_CONST_CAST(nsIFrame*,
|
||||
aFrame), &sFrame)) || !sFrame) {
|
||||
NS_NOTREACHED("not scroll frame");
|
||||
}
|
||||
nscoord kidBaseline;
|
||||
if (GetFirstLineBaseline(sFrame->GetScrolledFrame(), &kidBaseline)) {
|
||||
// Consider only the border and padding that contributes to the
|
||||
// kid's position, not the scrolling, so we get the initial
|
||||
// position.
|
||||
*aResult = kidBaseline + aFrame->GetUsedBorderAndPadding().top;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// No baseline.
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
for (nsBlockFrame::const_line_iterator line = block->begin_lines(),
|
||||
line_end = block->end_lines();
|
||||
line != line_end; ++line) {
|
||||
if (line->IsBlock()) {
|
||||
nsIFrame *kid = line->mFirstChild;
|
||||
nscoord kidBaseline;
|
||||
if (GetFirstLineBaseline(kid, &kidBaseline)) {
|
||||
*aResult = kidBaseline + kid->GetPosition().y;
|
||||
return PR_TRUE;
|
||||
}
|
||||
} else {
|
||||
// XXX Is this the right test? We have some bogus empty lines
|
||||
// floating around, but IsEmpty is perhaps too weak.
|
||||
if (line->GetHeight() != 0 || !line->IsEmpty()) {
|
||||
*aResult = line->mBounds.y + line->GetAscent();
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
/* static */ PRBool
|
||||
nsLayoutUtils::GetLastLineBaseline(const nsIFrame* aFrame, nscoord* aResult)
|
||||
{
|
||||
const nsBlockFrame* block;
|
||||
if (NS_FAILED(NS_CONST_CAST(nsIFrame*, aFrame)->
|
||||
QueryInterface(kBlockFrameCID, (void**)&block)))
|
||||
// No baseline. (We intentionally don't descend into scroll frames.)
|
||||
return PR_FALSE;
|
||||
|
||||
for (nsBlockFrame::const_reverse_line_iterator line = block->rbegin_lines(),
|
||||
line_end = block->rend_lines();
|
||||
line != line_end; ++line) {
|
||||
if (line->IsBlock()) {
|
||||
nsIFrame *kid = line->mFirstChild;
|
||||
nscoord kidBaseline;
|
||||
if (GetLastLineBaseline(kid, &kidBaseline)) {
|
||||
*aResult = kidBaseline + kid->GetPosition().y;
|
||||
return PR_TRUE;
|
||||
} else if (kid->GetType() == nsGkAtoms::scrollFrame) {
|
||||
// Use the bottom of the scroll frame.
|
||||
// XXX CSS2.1 really doesn't say what to do here.
|
||||
*aResult = kid->GetRect().YMost();
|
||||
return PR_TRUE;
|
||||
}
|
||||
} else {
|
||||
// XXX Is this the right test? We have some bogus empty lines
|
||||
// floating around, but IsEmpty is perhaps too weak.
|
||||
if (line->GetHeight() != 0 || !line->IsEmpty()) {
|
||||
*aResult = line->mBounds.y + line->GetAscent();
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
|
|
@ -560,6 +560,26 @@ public:
|
|||
nsIRenderingContext* aContext,
|
||||
const PRUnichar* aString,
|
||||
PRInt32 aLength);
|
||||
|
||||
/**
|
||||
* Derive a baseline of |aFrame| (measured from its top border edge)
|
||||
* from its first in-flow line box (not descending into anything with
|
||||
* 'overflow' not 'visible', potentially including aFrame itself).
|
||||
*
|
||||
* Returns true if a baseline was found (and fills in aResult).
|
||||
* Otherwise returns false.
|
||||
*/
|
||||
static PRBool GetFirstLineBaseline(const nsIFrame* aFrame, nscoord* aResult);
|
||||
|
||||
/**
|
||||
* Derive a baseline of |aFrame| (measured from its top border edge)
|
||||
* from its last in-flow line box (not descending into anything with
|
||||
* 'overflow' not 'visible', potentially including aFrame itself).
|
||||
*
|
||||
* Returns true if a baseline was found (and fills in aResult).
|
||||
* Otherwise returns false.
|
||||
*/
|
||||
static PRBool GetLastLineBaseline(const nsIFrame* aFrame, nscoord* aResult);
|
||||
};
|
||||
|
||||
#endif // nsLayoutUtils_h__
|
||||
|
|
|
@ -637,8 +637,6 @@ nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
|
|||
aDesiredSize.height = min;
|
||||
}
|
||||
aDesiredSize.width = contentRect.width + borderPadding.left + borderPadding.right;
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
aDesiredSize.mOverflowArea = nsRect(0, 0, aDesiredSize.width, aDesiredSize.height);
|
||||
if (mLegendFrame)
|
||||
ConsiderChildOverflow(aDesiredSize.mOverflowArea, mLegendFrame);
|
||||
|
|
|
@ -341,7 +341,6 @@ nsHTMLButtonControlFrame::Reflow(nsPresContext* aPresContext,
|
|||
|
||||
aDesiredSize.ascent +=
|
||||
aReflowState.mComputedBorderPadding.top + focusPadding.top;
|
||||
aDesiredSize.descent = aDesiredSize.height - aDesiredSize.ascent;
|
||||
|
||||
aDesiredSize.mOverflowArea =
|
||||
nsRect(0, 0, aDesiredSize.width, aDesiredSize.height);
|
||||
|
@ -413,14 +412,17 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
|
|||
yoff = (minInternalHeight - aDesiredSize.height) / 2;
|
||||
}
|
||||
|
||||
// Adjust the ascent by our offset (since we moved the child's
|
||||
// baseline by that much).
|
||||
aDesiredSize.ascent += yoff;
|
||||
|
||||
// Place the child
|
||||
FinishReflowChild(aFirstKid, aPresContext, &reflowState, aDesiredSize,
|
||||
xoffset,
|
||||
yoff + aFocusPadding.top + aReflowState.mComputedBorderPadding.top, 0);
|
||||
|
||||
if (aDesiredSize.ascent == nsHTMLReflowMetrics::ASK_FOR_BASELINE)
|
||||
aDesiredSize.ascent = aFirstKid->GetBaseline();
|
||||
|
||||
// Adjust the baseline by our offset (since we moved the child's
|
||||
// baseline by that much).
|
||||
aDesiredSize.ascent += yoff;
|
||||
}
|
||||
|
||||
/* virtual */ PRBool
|
||||
|
|
|
@ -115,7 +115,6 @@ BRFrame::Reflow(nsPresContext* aPresContext,
|
|||
// However, it's not always 0. See below.
|
||||
aMetrics.width = 0;
|
||||
aMetrics.ascent = 0;
|
||||
aMetrics.descent = 0;
|
||||
|
||||
// Only when the BR is operating in a line-layout situation will it
|
||||
// behave like a BR.
|
||||
|
@ -155,8 +154,6 @@ BRFrame::Reflow(nsPresContext* aPresContext,
|
|||
nscoord leading = logicalHeight - ascent - descent;
|
||||
aMetrics.height = logicalHeight;
|
||||
aMetrics.ascent = ascent + (leading/2);
|
||||
aMetrics.descent = logicalHeight - aMetrics.ascent;
|
||||
// = descent + (leading/2), but without rounding error
|
||||
}
|
||||
else {
|
||||
aMetrics.ascent = aMetrics.height = 0;
|
||||
|
|
|
@ -499,6 +499,18 @@ nsBlockFrame::InvalidateInternal(const nsRect& aDamageRect,
|
|||
nsBlockFrameSuper::InvalidateInternal(aDamageRect, aX, aY, aForChild, aImmediate);
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsBlockFrame::GetBaseline() const
|
||||
{
|
||||
NS_ASSERTION(!(GetStateBits() & (NS_FRAME_IS_DIRTY |
|
||||
NS_FRAME_HAS_DIRTY_CHILDREN)),
|
||||
"frame must not be dirty");
|
||||
nscoord result;
|
||||
if (nsLayoutUtils::GetLastLineBaseline(this, &result))
|
||||
return result;
|
||||
return nsFrame::GetBaseline();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Child frame enumeration
|
||||
|
||||
|
@ -993,6 +1005,40 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
|
|||
|
||||
CheckFloats(state);
|
||||
|
||||
// Place the "marker" (bullet) frame if it is placed next to a block
|
||||
// child.
|
||||
//
|
||||
// According to the CSS2 spec, section 12.6.1, the "marker" box
|
||||
// participates in the height calculation of the list-item box's
|
||||
// first line box.
|
||||
//
|
||||
// There are exactly two places a bullet can be placed: near the
|
||||
// first or second line. It's only placed on the second line in a
|
||||
// rare case: an empty first line followed by a second line that
|
||||
// contains a block (example: <LI>\n<P>... ). This is where
|
||||
// the second case can happen.
|
||||
if (mBullet && HaveOutsideBullet() &&
|
||||
(mLines.empty() ||
|
||||
mLines.front()->IsBlock() ||
|
||||
0 == mLines.front()->mBounds.height)) {
|
||||
// Reflow the bullet
|
||||
nsHTMLReflowMetrics metrics;
|
||||
ReflowBullet(state, metrics);
|
||||
|
||||
nscoord baseline;
|
||||
if (!nsLayoutUtils::GetFirstLineBaseline(this, &baseline)) {
|
||||
baseline = 0;
|
||||
}
|
||||
|
||||
// Doing the alignment using the baseline will also cater for
|
||||
// bullets that are placed next to a child block (bug 92896)
|
||||
|
||||
// Tall bullets won't look particularly nice here...
|
||||
nsRect bbox = mBullet->GetRect();
|
||||
bbox.y = baseline - metrics.ascent;
|
||||
mBullet->SetRect(bbox);
|
||||
}
|
||||
|
||||
// Compute our final size
|
||||
ComputeFinalSize(aReflowState, state, aMetrics);
|
||||
|
||||
|
@ -1296,13 +1342,6 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
|
|||
aMetrics.height = autoHeight;
|
||||
}
|
||||
|
||||
// XXXbernd this should be revised when inline-blocks are implemented
|
||||
if (GetFirstChild(nsnull))
|
||||
aMetrics.ascent = mAscent;
|
||||
else
|
||||
aMetrics.ascent = aMetrics.height;
|
||||
aMetrics.descent = aMetrics.height - aMetrics.ascent;
|
||||
|
||||
#ifdef DEBUG_blocks
|
||||
if (CRAZY_WIDTH(aMetrics.width) || CRAZY_HEIGHT(aMetrics.height)) {
|
||||
ListTag(stdout);
|
||||
|
@ -1658,9 +1697,6 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)
|
|||
|
||||
line_iterator line = begin_lines(), line_end = end_lines();
|
||||
|
||||
if (line == line_end)
|
||||
mAscent=0; // there are no lines, reset the previously computed ascent
|
||||
|
||||
// Reflow the lines that are already ours
|
||||
for ( ; line != line_end; ++line, aState.AdvanceToNextLine()) {
|
||||
DumpLine(aState, line, deltaY, 0);
|
||||
|
@ -3003,47 +3039,6 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
|
|||
brc.GetCarriedOutBottomMargin(), collapsedBottomMargin.get(),
|
||||
aState.mPrevBottomMargin);
|
||||
#endif
|
||||
|
||||
// If the block frame that we just reflowed happens to be our
|
||||
// first block, then its computed ascent is ours
|
||||
if (frame == GetTopBlockChild(aState.mPresContext)) {
|
||||
const nsHTMLReflowMetrics& metrics = brc.GetMetrics();
|
||||
mAscent = metrics.ascent;
|
||||
}
|
||||
|
||||
// Place the "marker" (bullet) frame.
|
||||
//
|
||||
// According to the CSS2 spec, section 12.6.1, the "marker" box
|
||||
// participates in the height calculation of the list-item box's
|
||||
// first line box.
|
||||
//
|
||||
// There are exactly two places a bullet can be placed: near the
|
||||
// first or second line. It's only placed on the second line in a
|
||||
// rare case: an empty first line followed by a second line that
|
||||
// contains a block (example: <LI>\n<P>... ). This is where
|
||||
// the second case can happen.
|
||||
if (mBullet && HaveOutsideBullet() &&
|
||||
((aLine == mLines.front()) ||
|
||||
((0 == mLines.front()->mBounds.height) &&
|
||||
(aLine == begin_lines().next())))) {
|
||||
// Reflow the bullet
|
||||
nsHTMLReflowMetrics metrics;
|
||||
ReflowBullet(aState, metrics);
|
||||
|
||||
// Doing the alignment using |mAscent| will also cater for bullets
|
||||
// that are placed next to a child block (bug 92896)
|
||||
// (Note that mAscent should be set by now, otherwise why would
|
||||
// we be placing the bullet yet?)
|
||||
|
||||
// Tall bullets won't look particularly nice here...
|
||||
nsRect bbox = mBullet->GetRect();
|
||||
nscoord bulletTopMargin = applyTopMargin
|
||||
? collapsedBottomMargin.get()
|
||||
: 0;
|
||||
bbox.y = aState.BorderPadding().top + mAscent -
|
||||
metrics.ascent + bulletTopMargin;
|
||||
mBullet->SetRect(bbox);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// None of the block fits. Determine the correct reflow status.
|
||||
|
@ -3828,11 +3823,6 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
|||
addedBullet = PR_TRUE;
|
||||
}
|
||||
aLineLayout.VerticalAlignLine();
|
||||
// Our ascent is the ascent of our first line (but if this line is all
|
||||
// whitespace we'll correct things in |ReflowBlockFrame|).
|
||||
if (aLine == mLines.front()) {
|
||||
mAscent = aLine->mBounds.y + aLine->GetAscent();
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
|
@ -3910,11 +3900,6 @@ nsBlockFrame::PlaceLine(nsBlockReflowState& aState,
|
|||
? -aState.mPrevBottomMargin.get() : 0;
|
||||
newY = aState.mY + dy;
|
||||
aLine->SlideBy(dy); // XXXldb Do we really want to do this?
|
||||
// keep our ascent in sync
|
||||
// XXXldb If it's empty, shouldn't the next line control the ascent?
|
||||
if (mLines.front() == aLine) {
|
||||
mAscent += dy;
|
||||
}
|
||||
}
|
||||
|
||||
// See if the line fit. If it doesn't we need to push it. Our first
|
||||
|
|
|
@ -174,6 +174,7 @@ public:
|
|||
nsIFrame* aOldFrame);
|
||||
virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const;
|
||||
NS_IMETHOD SetParent(const nsIFrame* aParent);
|
||||
virtual nscoord GetBaseline() const;
|
||||
virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
|
||||
virtual void Destroy();
|
||||
virtual nsSplittableType GetSplittableType() const;
|
||||
|
@ -263,8 +264,6 @@ public:
|
|||
|
||||
static nsresult GetCurrentLine(nsBlockReflowState *aState, nsLineBox **aOutCurrentLine);
|
||||
|
||||
inline nscoord GetAscent() { return mAscent; }
|
||||
|
||||
// Create a contination for aPlaceholder and its out of flow frame and
|
||||
// add it to the list of overflow floats
|
||||
nsresult SplitPlaceholder(nsBlockReflowState& aState, nsIFrame* aPlaceholder);
|
||||
|
@ -565,9 +564,6 @@ protected:
|
|||
PRInt32 GetDepth() const;
|
||||
#endif
|
||||
|
||||
// Ascent of our first line to support 'vertical-align: baseline' in table-cells
|
||||
nscoord mAscent;
|
||||
|
||||
nscoord mMinWidth, mPrefWidth;
|
||||
|
||||
nsLineList mLines;
|
||||
|
|
|
@ -365,8 +365,6 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
|
|||
#ifdef DEBUG
|
||||
mMetrics.width = nscoord(0xdeadbeef);
|
||||
mMetrics.height = nscoord(0xdeadbeef);
|
||||
mMetrics.ascent = nscoord(0xdeadbeef);
|
||||
mMetrics.descent = nscoord(0xdeadbeef);
|
||||
#endif
|
||||
|
||||
mOuterReflowState.mSpaceManager->Translate(tx, ty);
|
||||
|
@ -381,14 +379,10 @@ nsBlockReflowContext::ReflowBlock(const nsRect& aSpace,
|
|||
printf(" metrics=%d,%d!\n", mMetrics.width, mMetrics.height);
|
||||
}
|
||||
if ((mMetrics.width == nscoord(0xdeadbeef)) ||
|
||||
(mMetrics.height == nscoord(0xdeadbeef)) ||
|
||||
(mMetrics.ascent == nscoord(0xdeadbeef)) ||
|
||||
(mMetrics.descent == nscoord(0xdeadbeef))) {
|
||||
(mMetrics.height == nscoord(0xdeadbeef))) {
|
||||
printf("nsBlockReflowContext: ");
|
||||
nsFrame::ListTag(stdout, mFrame);
|
||||
printf(" didn't set whad %d,%d,%d,%d!\n",
|
||||
mMetrics.width, mMetrics.height,
|
||||
mMetrics.ascent, mMetrics.descent);
|
||||
printf(" didn't set w/h %d,%d!\n", mMetrics.width, mMetrics.height);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1442,10 +1442,7 @@ nsBulletFrame::GetDesiredSize(nsPresContext* aCX,
|
|||
#endif
|
||||
|
||||
aMetrics.width = mComputedSize.width;
|
||||
aMetrics.height = mComputedSize.height;
|
||||
|
||||
aMetrics.ascent = aMetrics.height;
|
||||
aMetrics.descent = 0;
|
||||
aMetrics.ascent = aMetrics.height = mComputedSize.height;
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1469,9 +1466,7 @@ nsBulletFrame::GetDesiredSize(nsPresContext* aCX,
|
|||
switch (myList->mListStyleType) {
|
||||
case NS_STYLE_LIST_STYLE_NONE:
|
||||
aMetrics.width = 0;
|
||||
aMetrics.height = 0;
|
||||
aMetrics.ascent = 0;
|
||||
aMetrics.descent = 0;
|
||||
aMetrics.ascent = aMetrics.height = 0;
|
||||
break;
|
||||
|
||||
case NS_STYLE_LIST_STYLE_DISC:
|
||||
|
@ -1488,9 +1483,7 @@ nsBulletFrame::GetDesiredSize(nsPresContext* aCX,
|
|||
bulletSize = NSIntPixelsToTwips(bulletSize, p2t);
|
||||
mPadding.bottom = NSIntPixelsToTwips((nscoord) NSToIntRound((float)ascent / (8.0f * p2t)),p2t);
|
||||
aMetrics.width = mPadding.right + bulletSize;
|
||||
aMetrics.height = mPadding.bottom + bulletSize;
|
||||
aMetrics.ascent = mPadding.bottom + bulletSize;
|
||||
aMetrics.descent = 0;
|
||||
aMetrics.ascent = aMetrics.height = mPadding.bottom + bulletSize;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1551,7 +1544,6 @@ nsBulletFrame::GetDesiredSize(nsPresContext* aCX,
|
|||
aMetrics.width = nsLayoutUtils::GetStringWidth(this, aRenderingContext, text.get(), text.Length());
|
||||
aMetrics.width += mPadding.right;
|
||||
fm->GetMaxAscent(aMetrics.ascent);
|
||||
fm->GetMaxDescent(aMetrics.descent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1574,7 +1566,6 @@ nsBulletFrame::Reflow(nsPresContext* aPresContext,
|
|||
aMetrics.width += borderPadding.left + borderPadding.right;
|
||||
aMetrics.height += borderPadding.top + borderPadding.bottom;
|
||||
aMetrics.ascent += borderPadding.top;
|
||||
aMetrics.descent += borderPadding.bottom;
|
||||
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
|
||||
|
|
|
@ -590,8 +590,6 @@ nsColumnSetFrame::ReflowChildren(nsHTMLReflowMetrics& aDesiredSize,
|
|||
aDesiredSize.height = borderPadding.top + contentSize.height +
|
||||
borderPadding.bottom;
|
||||
aDesiredSize.width = contentSize.width + borderPadding.left + borderPadding.right;
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
overflowRect.UnionRect(overflowRect, nsRect(0, 0, aDesiredSize.width, aDesiredSize.height));
|
||||
aDesiredSize.mOverflowArea = overflowRect;
|
||||
|
||||
|
|
|
@ -283,7 +283,6 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
|
|||
aMetrics.width += lr;
|
||||
aMetrics.height += tb;
|
||||
aMetrics.ascent += bp.top;
|
||||
aMetrics.descent += bp.bottom;
|
||||
|
||||
// Create a continuation or remove existing continuations based on
|
||||
// the reflow completion status.
|
||||
|
|
|
@ -794,6 +794,17 @@ nsFrame::SetAdditionalStyleContext(PRInt32 aIndex,
|
|||
NS_PRECONDITION(aIndex >= 0, "invalid index number");
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsFrame::GetBaseline() const
|
||||
{
|
||||
NS_ASSERTION(!(GetStateBits() & (NS_FRAME_IS_DIRTY |
|
||||
NS_FRAME_HAS_DIRTY_CHILDREN)),
|
||||
"frame must not be dirty");
|
||||
// Default to the bottom margin edge, per CSS2.1's definition of the
|
||||
// 'baseline' value of 'vertical-align'.
|
||||
return mRect.height + GetUsedMargin().bottom;
|
||||
}
|
||||
|
||||
// Child frame enumeration
|
||||
|
||||
nsIAtom*
|
||||
|
@ -3248,8 +3259,6 @@ nsFrame::Reflow(nsPresContext* aPresContext,
|
|||
DO_GLOBAL_REFLOW_COUNT("nsFrame");
|
||||
aDesiredSize.width = 0;
|
||||
aDesiredSize.height = 0;
|
||||
aDesiredSize.ascent = 0;
|
||||
aDesiredSize.descent = 0;
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
||||
return NS_OK;
|
||||
|
@ -3746,7 +3755,6 @@ nsFrame::IsFrameTreeTooDeep(const nsHTMLReflowState& aReflowState,
|
|||
aMetrics.width = 0;
|
||||
aMetrics.height = 0;
|
||||
aMetrics.ascent = 0;
|
||||
aMetrics.descent = 0;
|
||||
aMetrics.mCarriedOutBottomMargin.Zero();
|
||||
aMetrics.mOverflowArea.x = 0;
|
||||
aMetrics.mOverflowArea.y = 0;
|
||||
|
@ -5803,7 +5811,12 @@ nsFrame::RefreshSizeCache(nsBoxLayoutState& aState)
|
|||
|
||||
metrics->mBlockPrefSize.height = metrics->mBlockMinSize.height;
|
||||
|
||||
metrics->mBlockAscent = desiredSize.ascent;
|
||||
if (desiredSize.ascent == nsHTMLReflowMetrics::ASK_FOR_BASELINE) {
|
||||
if (!nsLayoutUtils::GetFirstLineBaseline(this, &metrics->mBlockAscent))
|
||||
metrics->mBlockAscent = GetBaseline();
|
||||
} else {
|
||||
metrics->mBlockAscent = desiredSize.ascent;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_adaptor
|
||||
printf("min=(%d,%d), pref=(%d,%d), ascent=%d\n", metrics->mBlockMinSize.width,
|
||||
|
@ -6168,15 +6181,6 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
|
|||
|
||||
NS_ASSERTION(NS_FRAME_IS_COMPLETE(status), "bad status");
|
||||
|
||||
// Save the ascent. (bug 103925)
|
||||
PRBool isCollapsed = PR_FALSE;
|
||||
IsCollapsed(aState, isCollapsed);
|
||||
if (isCollapsed) {
|
||||
metrics->mAscent = 0;
|
||||
} else {
|
||||
metrics->mAscent = aDesiredSize.ascent;
|
||||
}
|
||||
|
||||
// printf("width: %d, height: %d\n", aDesiredSize.mCombinedArea.width, aDesiredSize.mCombinedArea.height);
|
||||
|
||||
// see if the overflow option is set. If it is then if our child's bounds overflow then
|
||||
|
@ -6238,6 +6242,20 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
|
|||
PRUint32 layoutFlags = aState.LayoutFlags();
|
||||
nsContainerFrame::FinishReflowChild(this, aPresContext, &reflowState,
|
||||
aDesiredSize, aX, aY, layoutFlags | NS_FRAME_NO_MOVE_FRAME);
|
||||
|
||||
// Save the ascent. (bug 103925)
|
||||
PRBool isCollapsed = PR_FALSE;
|
||||
IsCollapsed(aState, isCollapsed);
|
||||
if (isCollapsed) {
|
||||
metrics->mAscent = 0;
|
||||
} else {
|
||||
if (aDesiredSize.ascent == nsHTMLReflowMetrics::ASK_FOR_BASELINE) {
|
||||
if (!nsLayoutUtils::GetFirstLineBaseline(this, &metrics->mAscent))
|
||||
metrics->mAscent = GetBaseline();
|
||||
} else
|
||||
metrics->mAscent = aDesiredSize.ascent;
|
||||
}
|
||||
|
||||
} else {
|
||||
aDesiredSize.ascent = metrics->mBlockAscent;
|
||||
}
|
||||
|
|
|
@ -181,6 +181,7 @@ public:
|
|||
virtual void SetAdditionalStyleContext(PRInt32 aIndex,
|
||||
nsStyleContext* aStyleContext);
|
||||
NS_IMETHOD SetParent(const nsIFrame* aParent);
|
||||
virtual nscoord GetBaseline() const;
|
||||
virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
|
||||
virtual nsIFrame* GetFirstChild(nsIAtom* aListName) const;
|
||||
NS_IMETHOD HandleEvent(nsPresContext* aPresContext,
|
||||
|
|
|
@ -723,8 +723,6 @@ nsHTMLFramesetFrame::GetDesiredSize(nsPresContext* aPresContext,
|
|||
aDesiredSize.width = size.width;
|
||||
aDesiredSize.height = size.height;
|
||||
}
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -249,8 +249,6 @@ struct ScrollReflowState {
|
|||
nsRect mScrollPortRect;
|
||||
// The size of the inside-border area
|
||||
nsSize mInsideBorderSize;
|
||||
// Taken from kid metrics; ascent from the inner-border top edge
|
||||
nscoord mAscent;
|
||||
// Whether we decided to show the horizontal scrollbar
|
||||
PRPackedBool mShowHScrollbar;
|
||||
// Whether we decided to show the vertical scrollbar
|
||||
|
@ -411,7 +409,6 @@ nsHTMLScrollFrame::TryLayout(ScrollReflowState* aState,
|
|||
scrollPortOrigin.x += vScrollbarActualWidth;
|
||||
}
|
||||
aState->mScrollPortRect = nsRect(scrollPortOrigin, scrollPortSize);
|
||||
aState->mAscent = aKidMetrics.ascent;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -781,10 +778,7 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
|
|||
state.mComputedBorder.LeftRight();
|
||||
aDesiredSize.height = state.mInsideBorderSize.height +
|
||||
state.mComputedBorder.TopBottom();
|
||||
aDesiredSize.ascent =
|
||||
state.mAscent + aReflowState.mComputedBorderPadding.top;
|
||||
|
||||
aDesiredSize.descent = aDesiredSize.height - aDesiredSize.ascent;
|
||||
aDesiredSize.mOverflowArea = nsRect(0, 0, aDesiredSize.width, aDesiredSize.height);
|
||||
FinishAndStoreOverflow(&aDesiredSize);
|
||||
|
||||
|
|
|
@ -145,9 +145,6 @@ nsHTMLCanvasFrame::Reflow(nsPresContext* aPresContext,
|
|||
aMetrics.height = PR_MAX(0, aMetrics.height);
|
||||
}
|
||||
|
||||
aMetrics.ascent = aMetrics.height;
|
||||
aMetrics.descent = 0;
|
||||
|
||||
aMetrics.mOverflowArea.SetRect(0, 0, aMetrics.width, aMetrics.height);
|
||||
FinishAndStoreOverflow(&aMetrics);
|
||||
|
||||
|
|
|
@ -566,8 +566,6 @@ CanvasFrame::Reflow(nsPresContext* aPresContext,
|
|||
if (mFrames.IsEmpty()) {
|
||||
// We have no child frame, so return an empty size
|
||||
aDesiredSize.width = aDesiredSize.height = 0;
|
||||
aDesiredSize.ascent = aDesiredSize.descent = 0;
|
||||
|
||||
} else {
|
||||
nsIFrame* kidFrame = mFrames.FirstChild();
|
||||
PRBool kidDirty = (kidFrame->GetStateBits() & NS_FRAME_IS_DIRTY) != 0;
|
||||
|
@ -613,9 +611,6 @@ CanvasFrame::Reflow(nsPresContext* aPresContext,
|
|||
nsPoint(kidReflowState.mComputedMargin.left,
|
||||
kidReflowState.mComputedMargin.top));
|
||||
FinishAndStoreOverflow(&aDesiredSize);
|
||||
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
}
|
||||
|
||||
NS_FRAME_TRACE_REFLOW_OUT("CanvasFrame::Reflow", aStatus);
|
||||
|
|
|
@ -139,8 +139,10 @@ struct nsCollapsingMargin {
|
|||
* @see #Reflow()
|
||||
*/
|
||||
struct nsHTMLReflowMetrics {
|
||||
nscoord width, height; // [OUT] desired width and height
|
||||
nscoord ascent, descent; // [OUT] ascent and descent information
|
||||
nscoord width, height; // [OUT] desired width and height (border-box)
|
||||
nscoord ascent; // [OUT] baseline (from top), or ASK_FOR_BASELINE
|
||||
|
||||
enum { ASK_FOR_BASELINE = nscoord_MAX };
|
||||
|
||||
#ifdef MOZ_MATHML
|
||||
// Metrics that _exactly_ enclose the text to allow precise MathML placements.
|
||||
|
@ -185,7 +187,7 @@ struct nsHTMLReflowMetrics {
|
|||
// initialized, but there are some bad frame classes that aren't
|
||||
// properly setting them when returning from Reflow()...
|
||||
width = height = 0;
|
||||
ascent = descent = 0;
|
||||
ascent = ASK_FOR_BASELINE;
|
||||
}
|
||||
|
||||
nsHTMLReflowMetrics& operator=(const nsHTMLReflowMetrics& aOther)
|
||||
|
@ -203,7 +205,6 @@ struct nsHTMLReflowMetrics {
|
|||
width = aOther.width;
|
||||
height = aOther.height;
|
||||
ascent = aOther.ascent;
|
||||
descent = aOther.descent;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
@ -100,10 +100,10 @@ struct nsMargin;
|
|||
typedef class nsIFrame nsIBox;
|
||||
|
||||
// IID for the nsIFrame interface
|
||||
// c822dca6-310c-433d-a1d0-d5b5b1cdce1f
|
||||
// f02b2868-ac80-4e38-978c-02df6477d294
|
||||
#define NS_IFRAME_IID \
|
||||
{ 0xc822dca6, 0x310c, 0x433d, \
|
||||
{ 0xa1, 0xd0, 0xd5, 0xb5, 0xb1, 0xcd, 0xce, 0x1f } }
|
||||
{ 0xf02b2868, 0xac80, 0x4e38, \
|
||||
{ 0x97, 0x8c, 0x02, 0xdf, 0x64, 0x77, 0xd2, 0x94 } }
|
||||
|
||||
/**
|
||||
* Indication of how the frame can be split. This is used when doing runaround
|
||||
|
@ -712,6 +712,14 @@ public:
|
|||
nsRect GetPaddingRect() const;
|
||||
nsRect GetContentRect() const;
|
||||
|
||||
/**
|
||||
* Get the position of the frame's baseline, relative to the top of
|
||||
* the frame (its top border edge). Only valid when Reflow is not
|
||||
* needed and when the frame returned nsHTMLReflowMetrics::
|
||||
* ASK_FOR_ASCENT as ascent in its reflow metrics.
|
||||
*/
|
||||
virtual nscoord GetBaseline() const = 0;
|
||||
|
||||
/**
|
||||
* Used to iterate the list of additional child list names. Returns the atom
|
||||
* name for the additional child list at the specified 0-based index, or a
|
||||
|
|
|
@ -881,8 +881,6 @@ nsImageFrame::Reflow(nsPresContext* aPresContext,
|
|||
aStatus = NS_FRAME_NOT_COMPLETE;
|
||||
}
|
||||
}
|
||||
aMetrics.ascent = aMetrics.height;
|
||||
aMetrics.descent = 0;
|
||||
|
||||
aMetrics.mOverflowArea.SetRect(0, 0, aMetrics.width, aMetrics.height);
|
||||
FinishAndStoreOverflow(&aMetrics);
|
||||
|
|
|
@ -463,7 +463,6 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
|||
aMetrics.width = 0;
|
||||
aMetrics.height = 0;
|
||||
aMetrics.ascent = 0;
|
||||
aMetrics.descent = 0;
|
||||
}
|
||||
else {
|
||||
// Compute final width
|
||||
|
@ -493,14 +492,12 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
|||
// and bottom border and padding. The height of children do not
|
||||
// affect our height.
|
||||
fm->GetMaxAscent(aMetrics.ascent);
|
||||
fm->GetMaxDescent(aMetrics.descent);
|
||||
fm->GetHeight(aMetrics.height);
|
||||
} else {
|
||||
NS_WARNING("Cannot get font metrics - defaulting sizes to 0");
|
||||
aMetrics.ascent = aMetrics.descent = aMetrics.height = 0;
|
||||
aMetrics.ascent = aMetrics.height = 0;
|
||||
}
|
||||
aMetrics.ascent += aReflowState.mComputedBorderPadding.top;
|
||||
aMetrics.descent += aReflowState.mComputedBorderPadding.bottom;
|
||||
aMetrics.height += aReflowState.mComputedBorderPadding.top +
|
||||
aReflowState.mComputedBorderPadding.bottom;
|
||||
}
|
||||
|
@ -511,8 +508,8 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
|||
|
||||
#ifdef NOISY_FINAL_SIZE
|
||||
ListTag(stdout);
|
||||
printf(": metrics=%d,%d ascent=%d descent=%d\n",
|
||||
aMetrics.width, aMetrics.height, aMetrics.ascent, aMetrics.descent);
|
||||
printf(": metrics=%d,%d ascent=%d\n",
|
||||
aMetrics.width, aMetrics.height, aMetrics.ascent);
|
||||
#endif
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -135,8 +135,6 @@ nsLeafFrame::AddBordersAndPadding(const nsHTMLReflowState& aReflowState,
|
|||
{
|
||||
aMetrics.width += aReflowState.mComputedBorderPadding.LeftRight();
|
||||
aMetrics.height += aReflowState.mComputedBorderPadding.TopBottom();
|
||||
aMetrics.ascent = aMetrics.height;
|
||||
aMetrics.descent = 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -145,8 +143,6 @@ nsLeafFrame::SizeToAvailSize(const nsHTMLReflowState& aReflowState,
|
|||
{
|
||||
aDesiredSize.width = aReflowState.availableWidth; // FRAME
|
||||
aDesiredSize.height = aReflowState.availableHeight;
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
aDesiredSize.mOverflowArea =
|
||||
nsRect(0, 0, aDesiredSize.width, aDesiredSize.height);
|
||||
FinishAndStoreOverflow(&aDesiredSize);
|
||||
|
|
|
@ -796,8 +796,6 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
|
|||
#ifdef DEBUG
|
||||
metrics.width = nscoord(0xdeadbeef);
|
||||
metrics.height = nscoord(0xdeadbeef);
|
||||
metrics.ascent = nscoord(0xdeadbeef);
|
||||
metrics.descent = nscoord(0xdeadbeef);
|
||||
#endif
|
||||
nscoord tx = x - psd->mReflowState->mComputedBorderPadding.left;
|
||||
nscoord ty = y - psd->mReflowState->mComputedBorderPadding.top;
|
||||
|
@ -910,13 +908,10 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
|
|||
printf(" metrics=%d,%d!\n", metrics.width, metrics.height);
|
||||
}
|
||||
if ((metrics.width == nscoord(0xdeadbeef)) ||
|
||||
(metrics.height == nscoord(0xdeadbeef)) ||
|
||||
(metrics.ascent == nscoord(0xdeadbeef)) ||
|
||||
(metrics.descent == nscoord(0xdeadbeef))) {
|
||||
(metrics.height == nscoord(0xdeadbeef))) {
|
||||
printf("nsLineLayout: ");
|
||||
nsFrame::ListTag(stdout, aFrame);
|
||||
printf(" didn't set whad %d,%d,%d,%d!\n", metrics.width, metrics.height,
|
||||
metrics.ascent, metrics.descent);
|
||||
printf(" didn't set w/h %d,%d!\n", metrics.width, metrics.height);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1245,8 +1240,10 @@ nsLineLayout::PlaceFrame(PerFrameData* pfd, nsHTMLReflowMetrics& aMetrics)
|
|||
}
|
||||
|
||||
// Record ascent and update max-ascent and max-descent values
|
||||
pfd->mAscent = aMetrics.ascent;
|
||||
pfd->mDescent = aMetrics.descent;
|
||||
if (aMetrics.ascent == nsHTMLReflowMetrics::ASK_FOR_BASELINE)
|
||||
pfd->mAscent = pfd->mFrame->GetBaseline();
|
||||
else
|
||||
pfd->mAscent = aMetrics.ascent;
|
||||
|
||||
// If the band was updated during the reflow of that frame then we
|
||||
// need to adjust any prior frames that were reflowed.
|
||||
|
@ -1293,8 +1290,10 @@ nsLineLayout::AddBulletFrame(nsIFrame* aFrame,
|
|||
pfd->mFrameType = NS_FRAME_REPLACED(NS_CSS_FRAME_TYPE_INLINE);
|
||||
pfd->mFlags = 0; // all flags default to false
|
||||
pfd->SetFlag(PFD_ISBULLET, PR_TRUE);
|
||||
pfd->mAscent = aMetrics.ascent;
|
||||
pfd->mDescent = aMetrics.descent;
|
||||
if (aMetrics.ascent == nsHTMLReflowMetrics::ASK_FOR_BASELINE)
|
||||
pfd->mAscent = aFrame->GetBaseline();
|
||||
else
|
||||
pfd->mAscent = aMetrics.ascent;
|
||||
|
||||
// Note: y value will be updated during vertical alignment
|
||||
pfd->mBounds = aFrame->GetRect();
|
||||
|
@ -1405,7 +1404,6 @@ nsLineLayout::VerticalAlignLine()
|
|||
rootPFD.mFrame = mBlockReflowState->frame;
|
||||
rootPFD.mFrameType = mBlockReflowState->mFrameType;
|
||||
rootPFD.mAscent = 0;
|
||||
rootPFD.mDescent = 0;
|
||||
mRootSpan->mFrame = &rootPFD;
|
||||
|
||||
// Partially place the children of the block frame. The baseline for
|
||||
|
@ -1863,17 +1861,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
|||
case NS_STYLE_VERTICAL_ALIGN_BASELINE:
|
||||
// The elements baseline is aligned with the baseline of
|
||||
// the parent.
|
||||
if (frameSpan) {
|
||||
// XXX explain
|
||||
pfd->mBounds.y = baselineY - pfd->mAscent;
|
||||
}
|
||||
else {
|
||||
// For non-span elements the borders, padding and
|
||||
// margins are significant. Use the visual box height
|
||||
// and the bottom margin as the distance off of the
|
||||
// baseline.
|
||||
pfd->mBounds.y = baselineY - pfd->mAscent - pfd->mMargin.bottom;
|
||||
}
|
||||
pfd->mBounds.y = baselineY - pfd->mAscent;
|
||||
pfd->mVerticalAlign = VALIGN_OTHER;
|
||||
break;
|
||||
|
||||
|
@ -1884,13 +1872,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
|||
// offset to the baseline Y.
|
||||
fm->GetSubscriptOffset(parentSubscript);
|
||||
revisedBaselineY = baselineY + parentSubscript;
|
||||
if (frameSpan) {
|
||||
pfd->mBounds.y = revisedBaselineY - pfd->mAscent;
|
||||
}
|
||||
else {
|
||||
pfd->mBounds.y = revisedBaselineY - pfd->mAscent -
|
||||
pfd->mMargin.bottom;
|
||||
}
|
||||
pfd->mBounds.y = revisedBaselineY - pfd->mAscent;
|
||||
pfd->mVerticalAlign = VALIGN_OTHER;
|
||||
break;
|
||||
|
||||
|
@ -1901,13 +1883,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
|||
// offset to the baseline Y.
|
||||
fm->GetSuperscriptOffset(parentSuperscript);
|
||||
revisedBaselineY = baselineY - parentSuperscript;
|
||||
if (frameSpan) {
|
||||
pfd->mBounds.y = revisedBaselineY - pfd->mAscent;
|
||||
}
|
||||
else {
|
||||
pfd->mBounds.y = revisedBaselineY - pfd->mAscent -
|
||||
pfd->mMargin.bottom;
|
||||
}
|
||||
pfd->mBounds.y = revisedBaselineY - pfd->mAscent;
|
||||
pfd->mVerticalAlign = VALIGN_OTHER;
|
||||
break;
|
||||
|
||||
|
@ -1991,13 +1967,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
|||
// the screen we reverse the sign.
|
||||
coordOffset = textStyle->mVerticalAlign.GetCoordValue();
|
||||
revisedBaselineY = baselineY - coordOffset;
|
||||
if (frameSpan) {
|
||||
pfd->mBounds.y = revisedBaselineY - pfd->mAscent;
|
||||
}
|
||||
else {
|
||||
pfd->mBounds.y = revisedBaselineY - pfd->mAscent -
|
||||
pfd->mMargin.bottom;
|
||||
}
|
||||
pfd->mBounds.y = revisedBaselineY - pfd->mAscent;
|
||||
pfd->mVerticalAlign = VALIGN_OTHER;
|
||||
break;
|
||||
|
||||
|
@ -2010,13 +1980,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
|||
textStyle->mVerticalAlign.GetPercentValue() * elementLineHeight
|
||||
);
|
||||
revisedBaselineY = baselineY - percentOffset;
|
||||
if (frameSpan) {
|
||||
pfd->mBounds.y = revisedBaselineY - pfd->mAscent;
|
||||
}
|
||||
else {
|
||||
pfd->mBounds.y = revisedBaselineY - pfd->mAscent -
|
||||
pfd->mMargin.bottom;
|
||||
}
|
||||
pfd->mBounds.y = revisedBaselineY - pfd->mAscent;
|
||||
pfd->mVerticalAlign = VALIGN_OTHER;
|
||||
break;
|
||||
}
|
||||
|
@ -2073,8 +2037,8 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
|||
if (yTop < minY) minY = yTop;
|
||||
if (yBottom > maxY) maxY = yBottom;
|
||||
#ifdef NOISY_VERTICAL_ALIGN
|
||||
printf(" [frame]raw: a=%d d=%d h=%d bp=%d,%d logical: h=%d leading=%d y=%d minY=%d maxY=%d\n",
|
||||
pfd->mAscent, pfd->mDescent, pfd->mBounds.height,
|
||||
printf(" [frame]raw: a=%d h=%d bp=%d,%d logical: h=%d leading=%d y=%d minY=%d maxY=%d\n",
|
||||
pfd->mAscent, pfd->mBounds.height,
|
||||
pfd->mBorderPadding.top, pfd->mBorderPadding.bottom,
|
||||
logicalHeight,
|
||||
pfd->mSpan ? topLeading : 0,
|
||||
|
@ -2176,9 +2140,9 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
|||
if ((psd != mRootSpan) && (psd->mZeroEffectiveSpanBox)) {
|
||||
#ifdef NOISY_VERTICAL_ALIGN
|
||||
printf(" [span]adjusting for zeroEffectiveSpanBox\n");
|
||||
printf(" Original: minY=%d, maxY=%d, height=%d, ascent=%d, descent=%d, logicalHeight=%d, topLeading=%d, bottomLeading=%d\n",
|
||||
printf(" Original: minY=%d, maxY=%d, height=%d, ascent=%d, logicalHeight=%d, topLeading=%d, bottomLeading=%d\n",
|
||||
minY, maxY, spanFramePFD->mBounds.height,
|
||||
spanFramePFD->mAscent, spanFramePFD->mDescent,
|
||||
spanFramePFD->mAscent,
|
||||
psd->mLogicalHeight, psd->mTopLeading, psd->mBottomLeading);
|
||||
#endif
|
||||
nscoord goodMinY = spanFramePFD->mBorderPadding.top - psd->mTopLeading;
|
||||
|
@ -2216,13 +2180,12 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
|||
if (maxY < spanFramePFD->mBounds.height) {
|
||||
nscoord adjust = spanFramePFD->mBounds.height - maxY;
|
||||
spanFramePFD->mBounds.height -= adjust; // move the bottom up
|
||||
spanFramePFD->mDescent -= adjust;
|
||||
psd->mBottomLeading += adjust;
|
||||
}
|
||||
#ifdef NOISY_VERTICAL_ALIGN
|
||||
printf(" New: minY=%d, maxY=%d, height=%d, ascent=%d, descent=%d, logicalHeight=%d, topLeading=%d, bottomLeading=%d\n",
|
||||
printf(" New: minY=%d, maxY=%d, height=%d, ascent=%d, logicalHeight=%d, topLeading=%d, bottomLeading=%d\n",
|
||||
minY, maxY, spanFramePFD->mBounds.height,
|
||||
spanFramePFD->mAscent, spanFramePFD->mDescent,
|
||||
spanFramePFD->mAscent,
|
||||
psd->mLogicalHeight, psd->mTopLeading, psd->mBottomLeading);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -475,7 +475,7 @@ protected:
|
|||
nsCSSFrameType mFrameType;
|
||||
|
||||
// From metrics
|
||||
nscoord mAscent, mDescent;
|
||||
nscoord mAscent;
|
||||
nsRect mBounds;
|
||||
nsRect mCombinedArea;
|
||||
|
||||
|
|
|
@ -627,8 +627,6 @@ nsObjectFrame::GetDesiredSize(nsPresContext* aPresContext,
|
|||
// By default, we have no area
|
||||
aMetrics.width = 0;
|
||||
aMetrics.height = 0;
|
||||
aMetrics.ascent = 0;
|
||||
aMetrics.descent = 0;
|
||||
|
||||
if (IsHidden(PR_FALSE)) {
|
||||
return;
|
||||
|
@ -686,9 +684,6 @@ nsObjectFrame::GetDesiredSize(nsPresContext* aPresContext,
|
|||
// paint borders, though! At that point, we will need to adjust the desired
|
||||
// size either here or in Reflow.... Further, we will need to fix Paint() to
|
||||
// call the superclass in all cases.
|
||||
|
||||
// ascent
|
||||
aMetrics.ascent = aMetrics.height;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -130,8 +130,6 @@ NS_IMETHODIMP nsPageContentFrame::Reflow(nsPresContext* aPresContext,
|
|||
if (aReflowState.availableHeight != NS_UNCONSTRAINEDSIZE) {
|
||||
aDesiredSize.height = aReflowState.availableHeight;
|
||||
}
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
|
||||
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
||||
return NS_OK;
|
||||
|
|
|
@ -170,8 +170,6 @@ NS_IMETHODIMP nsPageFrame::Reflow(nsPresContext* aPresContext,
|
|||
if (aReflowState.availableHeight != NS_UNCONSTRAINEDSIZE) {
|
||||
aDesiredSize.height = aReflowState.availableHeight;
|
||||
}
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
PR_PL(("PageFrame::Reflow %p ", this));
|
||||
PR_PL(("[%d,%d]\n", aReflowState.availableWidth, aReflowState.availableHeight));
|
||||
|
||||
|
@ -627,7 +625,6 @@ nsPageBreakFrame::Reflow(nsPresContext* aPresContext,
|
|||
// round the height down to the nearest pixel
|
||||
aDesiredSize.height -=
|
||||
aDesiredSize.height % GetPresContext()->IntScaledPixelsToTwips(1);
|
||||
aDesiredSize.ascent = aDesiredSize.descent = 0;
|
||||
|
||||
// Note: not using NS_FRAME_FIRST_REFLOW here, since it's not clear whether
|
||||
// DidReflow will always get called before the next Reflow() call.
|
||||
|
|
|
@ -116,8 +116,6 @@ nsPlaceholderFrame::Reflow(nsPresContext* aPresContext,
|
|||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
||||
aDesiredSize.width = 0;
|
||||
aDesiredSize.height = 0;
|
||||
aDesiredSize.ascent = 0;
|
||||
aDesiredSize.descent = 0;
|
||||
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
||||
|
|
|
@ -208,8 +208,6 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext,
|
|||
// Return our desired size
|
||||
aDesiredSize.height = mSize.height;
|
||||
aDesiredSize.width = mSize.width;
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
aDesiredSize.mOverflowArea = nsRect(0, 0, aDesiredSize.width,
|
||||
aDesiredSize.height);
|
||||
FinishAndStoreOverflow(&aDesiredSize);
|
||||
|
@ -373,8 +371,6 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext,
|
|||
// Return our desired size
|
||||
aDesiredSize.height = y; // includes page heights and dead space
|
||||
aDesiredSize.width = x + availSize.width + deadSpaceGap;
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
|
||||
aDesiredSize.mOverflowArea = nsRect(0, 0, aDesiredSize.width,
|
||||
aDesiredSize.height);
|
||||
|
|
|
@ -130,8 +130,6 @@ SpacerFrame::GetDesiredSize(nsHTMLReflowMetrics& aMetrics, nsSize aPercentBase)
|
|||
// By default, we have no area
|
||||
aMetrics.width = 0;
|
||||
aMetrics.height = 0;
|
||||
aMetrics.ascent = 0;
|
||||
aMetrics.descent = 0;
|
||||
|
||||
const nsStylePosition* position = GetStylePosition();
|
||||
|
||||
|
@ -144,7 +142,6 @@ SpacerFrame::GetDesiredSize(nsHTMLReflowMetrics& aMetrics, nsSize aPercentBase)
|
|||
if (eStyleUnit_Coord == position->mHeight.GetUnit()) {
|
||||
aMetrics.height = position->mHeight.GetCoordValue();
|
||||
}
|
||||
aMetrics.ascent = aMetrics.height;
|
||||
break;
|
||||
|
||||
case TYPE_IMAGE:
|
||||
|
@ -169,8 +166,6 @@ SpacerFrame::GetDesiredSize(nsHTMLReflowMetrics& aMetrics, nsSize aPercentBase)
|
|||
float factor = position->mHeight.GetPercentValue();
|
||||
aMetrics.width = NSToCoordRound(factor * aPercentBase.height);
|
||||
}
|
||||
// accent
|
||||
aMetrics.ascent = aMetrics.height;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -5938,7 +5938,6 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
|
|||
aMetrics.width = 0;
|
||||
aMetrics.height = 0;
|
||||
aMetrics.ascent = 0;
|
||||
aMetrics.descent = 0;
|
||||
#ifdef MOZ_MATHML
|
||||
if (NS_REFLOW_CALC_BOUNDING_METRICS & aMetrics.mFlags)
|
||||
aMetrics.mBoundingMetrics.Clear();
|
||||
|
@ -6115,12 +6114,10 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
|
|||
if ((0 == textData.mX) && !ts.mPreformatted) {
|
||||
aMetrics.height = 0;
|
||||
aMetrics.ascent = 0;
|
||||
aMetrics.descent = 0;
|
||||
}
|
||||
else {
|
||||
aMetrics.ascent = textData.mAscent;
|
||||
aMetrics.descent = textData.mDescent;
|
||||
aMetrics.height = aMetrics.ascent + aMetrics.descent;
|
||||
aMetrics.height = textData.mAscent + textData.mDescent;
|
||||
}
|
||||
mAscent = aMetrics.ascent;
|
||||
|
||||
|
@ -6166,7 +6163,7 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
|
|||
else {
|
||||
// Things didn't turn out well, just return the reflow metrics.
|
||||
aMetrics.mBoundingMetrics.ascent = aMetrics.ascent;
|
||||
aMetrics.mBoundingMetrics.descent = aMetrics.descent;
|
||||
aMetrics.mBoundingMetrics.descent = aMetrics.height - aMetrics.ascent;
|
||||
aMetrics.mBoundingMetrics.width = aMetrics.width;
|
||||
aMetrics.mBoundingMetrics.rightBearing = aMetrics.width;
|
||||
}
|
||||
|
@ -6215,8 +6212,8 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
|
|||
|
||||
#ifdef NOISY_REFLOW
|
||||
ListTag(stdout);
|
||||
printf(": desiredSize=%d,%d(a=%d/d=%d) status=%x\n",
|
||||
aMetrics.width, aMetrics.height, aMetrics.ascent, aMetrics.descent,
|
||||
printf(": desiredSize=%d,%d(b=%d) status=%x\n",
|
||||
aMetrics.width, aMetrics.height, aMetrics.ascent,
|
||||
aStatus);
|
||||
#endif
|
||||
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
|
||||
|
|
|
@ -1637,7 +1637,6 @@ static void ClearMetrics(nsHTMLReflowMetrics& aMetrics)
|
|||
aMetrics.width = 0;
|
||||
aMetrics.height = 0;
|
||||
aMetrics.ascent = 0;
|
||||
aMetrics.descent = 0;
|
||||
#ifdef MOZ_MATHML
|
||||
aMetrics.mBoundingMetrics.Clear();
|
||||
#endif
|
||||
|
@ -4762,10 +4761,9 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
|
|||
// Disallow negative widths
|
||||
aMetrics.width = NSToCoordCeil(PR_MAX(0, textMetrics.mAdvanceWidth));
|
||||
aMetrics.ascent = NSToCoordCeil(textMetrics.mAscent);
|
||||
aMetrics.descent = NSToCoordCeil(textMetrics.mDescent);
|
||||
aMetrics.height = aMetrics.ascent + aMetrics.descent;
|
||||
aMetrics.height = aMetrics.ascent + NSToCoordCeil(textMetrics.mDescent);
|
||||
NS_ASSERTION(aMetrics.ascent >= 0, "Negative ascent???");
|
||||
NS_ASSERTION(aMetrics.descent >= 0, "Negative ascent???");
|
||||
NS_ASSERTION(aMetrics.height - aMetrics.ascent >= 0, "Negative descent???");
|
||||
|
||||
mAscent = aMetrics.ascent;
|
||||
|
||||
|
@ -4864,8 +4862,8 @@ nsTextFrame::Reflow(nsPresContext* aPresContext,
|
|||
|
||||
#ifdef NOISY_REFLOW
|
||||
ListTag(stdout);
|
||||
printf(": desiredSize=%d,%d(a=%d/d=%d) status=%x\n",
|
||||
aMetrics.width, aMetrics.height, aMetrics.ascent, aMetrics.descent,
|
||||
printf(": desiredSize=%d,%d(b=%d) status=%x\n",
|
||||
aMetrics.width, aMetrics.height, aMetrics.ascent,
|
||||
aStatus);
|
||||
#endif
|
||||
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
|
||||
|
|
|
@ -304,8 +304,6 @@ ViewportFrame::Reflow(nsPresContext* aPresContext,
|
|||
aDesiredSize.height = aReflowState.availableHeight != NS_UNCONSTRAINEDSIZE
|
||||
? aReflowState.availableHeight
|
||||
: kidRect.height;
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
|
||||
// Make a copy of the reflow state and change the computed width and height
|
||||
// to reflect the available space for the fixed items
|
||||
|
|
|
@ -104,7 +104,7 @@ nsMathMLContainerFrame::ReflowError(nsIRenderingContext& aRenderingContext,
|
|||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("GetBoundingMetrics failed");
|
||||
aDesiredSize.width = aDesiredSize.height = 0;
|
||||
aDesiredSize.ascent = aDesiredSize.descent = 0;
|
||||
aDesiredSize.ascent = 0;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -112,8 +112,9 @@ nsMathMLContainerFrame::ReflowError(nsIRenderingContext& aRenderingContext,
|
|||
nsCOMPtr<nsIFontMetrics> fm;
|
||||
aRenderingContext.GetFontMetrics(*getter_AddRefs(fm));
|
||||
fm->GetMaxAscent(aDesiredSize.ascent);
|
||||
fm->GetMaxDescent(aDesiredSize.descent);
|
||||
aDesiredSize.height = aDesiredSize.ascent + aDesiredSize.descent;
|
||||
nscoord descent;
|
||||
fm->GetMaxDescent(descent);
|
||||
aDesiredSize.height = aDesiredSize.ascent + descent;
|
||||
aDesiredSize.width = mBoundingMetrics.width;
|
||||
|
||||
// Also return our bounding metrics
|
||||
|
@ -178,10 +179,10 @@ nsMathMLContainerFrame::GetReflowAndBoundingMetricsFor(nsIFrame* aFra
|
|||
// for the frame's ascent and descent information
|
||||
|
||||
nsRect rect = aFrame->GetRect();
|
||||
aReflowMetrics.descent = rect.x;
|
||||
aReflowMetrics.ascent = rect.y;
|
||||
aReflowMetrics.width = rect.width;
|
||||
aReflowMetrics.height = rect.height;
|
||||
nscoord descent = aReflowMetrics.height - aReflowMetrics.ascent;
|
||||
|
||||
if (aFrame->IsFrameOfType(nsIFrame::eMathML)) {
|
||||
nsIMathMLFrame* mathMLFrame;
|
||||
|
@ -196,7 +197,7 @@ nsMathMLContainerFrame::GetReflowAndBoundingMetricsFor(nsIFrame* aFra
|
|||
}
|
||||
|
||||
// aFrame is not a MathML frame, just return the reflow metrics
|
||||
aBoundingMetrics.descent = aReflowMetrics.descent;
|
||||
aBoundingMetrics.descent = descent;
|
||||
aBoundingMetrics.ascent = aReflowMetrics.ascent;
|
||||
aBoundingMetrics.width = aReflowMetrics.width;
|
||||
aBoundingMetrics.rightBearing = aReflowMetrics.width;
|
||||
|
@ -361,7 +362,7 @@ nsMathMLContainerFrame::Stretch(nsIRenderingContext& aRenderingContext,
|
|||
mEmbellishData.direction, containerSize, childSize);
|
||||
|
||||
// store the updated metrics
|
||||
childFrame->SetRect(nsRect(childSize.descent, childSize.ascent,
|
||||
childFrame->SetRect(nsRect(0, childSize.ascent,
|
||||
childSize.width, childSize.height));
|
||||
|
||||
// Remember the siblings which were _deferred_.
|
||||
|
@ -389,7 +390,7 @@ nsMathMLContainerFrame::Stretch(nsIRenderingContext& aRenderingContext,
|
|||
mathMLFrame->Stretch(aRenderingContext, stretchDir,
|
||||
containerSize, childSize);
|
||||
// store the updated metrics
|
||||
childFrame->SetRect(nsRect(childSize.descent, childSize.ascent,
|
||||
childFrame->SetRect(nsRect(0, childSize.ascent,
|
||||
childSize.width, childSize.height));
|
||||
}
|
||||
}
|
||||
|
@ -946,7 +947,7 @@ nsMathMLContainerFrame::ReflowChild(nsIFrame* aChildFrame,
|
|||
nsReflowStatus& aStatus)
|
||||
{
|
||||
aDesiredSize.width = aDesiredSize.height = 0;
|
||||
aDesiredSize.ascent = aDesiredSize.descent = 0;
|
||||
aDesiredSize.ascent = 0;
|
||||
aDesiredSize.mBoundingMetrics.Clear();
|
||||
aDesiredSize.mFlags |= NS_REFLOW_CALC_BOUNDING_METRICS;
|
||||
|
||||
|
@ -994,7 +995,7 @@ nsMathMLContainerFrame::ReflowForeignChild(nsIFrame* aChildFrame,
|
|||
|
||||
// make up the bounding metrics from the reflow metrics.
|
||||
aDesiredSize.mBoundingMetrics.ascent = aDesiredSize.ascent;
|
||||
aDesiredSize.mBoundingMetrics.descent = aDesiredSize.descent;
|
||||
aDesiredSize.mBoundingMetrics.descent = aDesiredSize.height - aDesiredSize.ascent;
|
||||
aDesiredSize.mBoundingMetrics.width = aDesiredSize.width;
|
||||
aDesiredSize.mBoundingMetrics.rightBearing = aDesiredSize.width;
|
||||
|
||||
|
@ -1014,7 +1015,7 @@ nsMathMLContainerFrame::Reflow(nsPresContext* aPresContext,
|
|||
{
|
||||
nsresult rv;
|
||||
aDesiredSize.width = aDesiredSize.height = 0;
|
||||
aDesiredSize.ascent = aDesiredSize.descent = 0;
|
||||
aDesiredSize.ascent = 0;
|
||||
aDesiredSize.mBoundingMetrics.Clear();
|
||||
|
||||
/////////////
|
||||
|
@ -1037,7 +1038,7 @@ nsMathMLContainerFrame::Reflow(nsPresContext* aPresContext,
|
|||
// At this stage, the origin points of the children have no use, so we will use the
|
||||
// origins as placeholders to store the child's ascent and descent. Later on,
|
||||
// we should set the origins so as to overwrite what we are storing there now.
|
||||
childFrame->SetRect(nsRect(childDesiredSize.descent, childDesiredSize.ascent,
|
||||
childFrame->SetRect(nsRect(0, childDesiredSize.ascent,
|
||||
childDesiredSize.width, childDesiredSize.height));
|
||||
childFrame = childFrame->GetNextSibling();
|
||||
}
|
||||
|
@ -1080,7 +1081,7 @@ nsMathMLContainerFrame::Reflow(nsPresContext* aPresContext,
|
|||
mathMLFrame->Stretch(*aReflowState.rendContext, stretchDir,
|
||||
containerSize, childDesiredSize);
|
||||
// store the updated metrics
|
||||
childFrame->SetRect(nsRect(childDesiredSize.descent, childDesiredSize.ascent,
|
||||
childFrame->SetRect(nsRect(0, childDesiredSize.ascent,
|
||||
childDesiredSize.width, childDesiredSize.height));
|
||||
}
|
||||
childFrame = childFrame->GetNextSibling();
|
||||
|
@ -1215,7 +1216,7 @@ nsMathMLContainerFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
{
|
||||
// these are needed in case this frame is empty (i.e., we don't enter the loop)
|
||||
aDesiredSize.width = aDesiredSize.height = 0;
|
||||
aDesiredSize.ascent = aDesiredSize.descent = 0;
|
||||
aDesiredSize.ascent = 0;
|
||||
mBoundingMetrics.Clear();
|
||||
|
||||
// cache away thinspace
|
||||
|
@ -1232,12 +1233,13 @@ nsMathMLContainerFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
eMathMLFrameType childFrameType;
|
||||
|
||||
nsIFrame* childFrame = mFrames.FirstChild();
|
||||
nscoord ascent = 0, descent = 0;
|
||||
while (childFrame) {
|
||||
GetReflowAndBoundingMetricsFor(childFrame, childSize, bmChild, &childFrameType);
|
||||
GetItalicCorrection(bmChild, leftCorrection, italicCorrection);
|
||||
if (0 == count) {
|
||||
aDesiredSize.ascent = childSize.ascent;
|
||||
aDesiredSize.descent = childSize.descent;
|
||||
ascent = childSize.ascent;
|
||||
descent = childSize.height - ascent;
|
||||
mBoundingMetrics = bmChild;
|
||||
// update to include the left correction
|
||||
// but leave <msqrt> alone because the sqrt glyph itself is there first
|
||||
|
@ -1248,10 +1250,11 @@ nsMathMLContainerFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
mBoundingMetrics.leftBearing += leftCorrection;
|
||||
}
|
||||
else {
|
||||
if (aDesiredSize.descent < childSize.descent)
|
||||
aDesiredSize.descent = childSize.descent;
|
||||
if (aDesiredSize.ascent < childSize.ascent)
|
||||
aDesiredSize.ascent = childSize.ascent;
|
||||
nscoord childDescent = childSize.height - childSize.ascent;
|
||||
if (descent < childDescent)
|
||||
descent = childDescent;
|
||||
if (ascent < childSize.ascent)
|
||||
ascent = childSize.ascent;
|
||||
// add inter frame spacing
|
||||
nscoord space = GetInterFrameSpacing(mPresentationData.scriptLevel,
|
||||
prevFrameType, childFrameType, &fromFrameType, &carrySpace);
|
||||
|
@ -1274,7 +1277,8 @@ nsMathMLContainerFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
childFrame = childFrame->GetNextSibling();
|
||||
}
|
||||
aDesiredSize.width = mBoundingMetrics.width;
|
||||
aDesiredSize.height = aDesiredSize.ascent + aDesiredSize.descent;
|
||||
aDesiredSize.height = ascent + descent;
|
||||
aDesiredSize.ascent = ascent;
|
||||
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
||||
|
||||
mReference.x = 0;
|
||||
|
|
|
@ -80,7 +80,7 @@ nsMathMLForeignFrameWrapper::Reflow(nsPresContext* aPresContext,
|
|||
// just make-up a bounding metrics
|
||||
mBoundingMetrics.Clear();
|
||||
mBoundingMetrics.ascent = aDesiredSize.ascent;
|
||||
mBoundingMetrics.descent = aDesiredSize.descent;
|
||||
mBoundingMetrics.descent = aDesiredSize.height - aDesiredSize.ascent;
|
||||
mBoundingMetrics.width = aDesiredSize.width;
|
||||
mBoundingMetrics.leftBearing = 0;
|
||||
mBoundingMetrics.rightBearing = aDesiredSize.width;
|
||||
|
|
|
@ -127,7 +127,7 @@ nsMathMLTokenFrame::Reflow(nsPresContext* aPresContext,
|
|||
|
||||
// initializations needed for empty markup like <mtag></mtag>
|
||||
aDesiredSize.width = aDesiredSize.height = 0;
|
||||
aDesiredSize.ascent = aDesiredSize.descent = 0;
|
||||
aDesiredSize.ascent = 0;
|
||||
aDesiredSize.mBoundingMetrics.Clear();
|
||||
|
||||
// ask our children to compute their bounding metrics
|
||||
|
@ -145,7 +145,7 @@ nsMathMLTokenFrame::Reflow(nsPresContext* aPresContext,
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// origins are used as placeholders to store the child's ascent and descent.
|
||||
childFrame->SetRect(nsRect(childDesiredSize.descent, childDesiredSize.ascent,
|
||||
childFrame->SetRect(nsRect(0, childDesiredSize.ascent,
|
||||
childDesiredSize.width, childDesiredSize.height));
|
||||
// compute and cache the bounding metrics
|
||||
if (0 == count)
|
||||
|
@ -190,8 +190,8 @@ nsMathMLTokenFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
||||
aDesiredSize.width = mBoundingMetrics.width;
|
||||
aDesiredSize.ascent = PR_MAX(mBoundingMetrics.ascent, ascent);
|
||||
aDesiredSize.descent = PR_MAX(mBoundingMetrics.descent, descent);
|
||||
aDesiredSize.height = aDesiredSize.ascent + aDesiredSize.descent;
|
||||
aDesiredSize.height = aDesiredSize.ascent +
|
||||
PR_MAX(mBoundingMetrics.descent, descent);
|
||||
|
||||
if (aPlaceOrigin) {
|
||||
nscoord dy, dx = 0;
|
||||
|
|
|
@ -279,7 +279,7 @@ nsMathMLmactionFrame::Reflow(nsPresContext* aPresContext,
|
|||
nsresult rv = NS_OK;
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
aDesiredSize.width = aDesiredSize.height = 0;
|
||||
aDesiredSize.ascent = aDesiredSize.descent = 0;
|
||||
aDesiredSize.ascent = 0;
|
||||
mBoundingMetrics.Clear();
|
||||
nsIFrame* childFrame = GetSelectedFrame();
|
||||
if (childFrame) {
|
||||
|
@ -288,7 +288,7 @@ nsMathMLmactionFrame::Reflow(nsPresContext* aPresContext,
|
|||
childFrame, availSize);
|
||||
rv = ReflowChild(childFrame, aPresContext, aDesiredSize,
|
||||
childReflowState, aStatus);
|
||||
childFrame->SetRect(nsRect(aDesiredSize.descent,aDesiredSize.ascent,
|
||||
childFrame->SetRect(nsRect(0,aDesiredSize.ascent,
|
||||
aDesiredSize.width,aDesiredSize.height));
|
||||
mBoundingMetrics = aDesiredSize.mBoundingMetrics;
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ nsMathMLmactionFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
nsHTMLReflowMetrics& aDesiredSize)
|
||||
{
|
||||
aDesiredSize.width = aDesiredSize.height = 0;
|
||||
aDesiredSize.ascent = aDesiredSize.descent = 0;
|
||||
aDesiredSize.ascent = 0;
|
||||
mBoundingMetrics.Clear();
|
||||
nsIFrame* childFrame = GetSelectedFrame();
|
||||
if (childFrame) {
|
||||
|
|
|
@ -255,7 +255,7 @@ nsMathMLmfencedFrame::doReflow(nsPresContext* aPresContext,
|
|||
{
|
||||
nsresult rv;
|
||||
aDesiredSize.width = aDesiredSize.height = 0;
|
||||
aDesiredSize.ascent = aDesiredSize.descent = 0;
|
||||
aDesiredSize.ascent = 0;
|
||||
aDesiredSize.mBoundingMetrics.Clear();
|
||||
|
||||
nsMathMLContainerFrame* mathMLFrame =
|
||||
|
@ -290,11 +290,12 @@ nsMathMLmfencedFrame::doReflow(nsPresContext* aPresContext,
|
|||
aDesiredSize.mFlags | NS_REFLOW_CALC_BOUNDING_METRICS);
|
||||
nsIFrame* firstChild = aForFrame->GetFirstChild(nsnull);
|
||||
nsIFrame* childFrame = firstChild;
|
||||
nscoord ascent = 0, descent = 0;
|
||||
if (firstChild || aOpenChar || aCloseChar || aSeparatorsCount > 0) {
|
||||
// We use the ASCII metrics to get our minimum height. This way, if we have
|
||||
// borders or a background, they will fit better with other elements on the line
|
||||
fm->GetMaxAscent(aDesiredSize.ascent);
|
||||
fm->GetMaxDescent(aDesiredSize.descent);
|
||||
fm->GetMaxAscent(ascent);
|
||||
fm->GetMaxDescent(descent);
|
||||
}
|
||||
while (childFrame) {
|
||||
nsHTMLReflowState childReflowState(aPresContext, aReflowState,
|
||||
|
@ -307,14 +308,15 @@ nsMathMLmfencedFrame::doReflow(nsPresContext* aPresContext,
|
|||
// At this stage, the origin points of the children have no use, so we will use the
|
||||
// origins as placeholders to store the child's ascent and descent. Later on,
|
||||
// we should set the origins so as to overwrite what we are storing there now.
|
||||
childFrame->SetRect(nsRect(childDesiredSize.descent, childDesiredSize.ascent,
|
||||
childFrame->SetRect(nsRect(0, childDesiredSize.ascent,
|
||||
childDesiredSize.width, childDesiredSize.height));
|
||||
|
||||
// compute the bounding metrics right now for mfrac
|
||||
if (aDesiredSize.descent < childDesiredSize.descent)
|
||||
aDesiredSize.descent = childDesiredSize.descent;
|
||||
if (aDesiredSize.ascent < childDesiredSize.ascent)
|
||||
aDesiredSize.ascent = childDesiredSize.ascent;
|
||||
nscoord childDescent = childDesiredSize.height - childDesiredSize.ascent;
|
||||
if (descent < childDescent)
|
||||
descent = childDescent;
|
||||
if (ascent < childDesiredSize.ascent)
|
||||
ascent = childDesiredSize.ascent;
|
||||
if (0 == count++)
|
||||
aDesiredSize.mBoundingMetrics = childDesiredSize.mBoundingMetrics;
|
||||
else
|
||||
|
@ -351,13 +353,14 @@ nsMathMLmfencedFrame::doReflow(nsPresContext* aPresContext,
|
|||
mathmlChild->Stretch(*aReflowState.rendContext,
|
||||
stretchDir, containerSize, childDesiredSize);
|
||||
// store the updated metrics
|
||||
childFrame->SetRect(nsRect(childDesiredSize.descent, childDesiredSize.ascent,
|
||||
childFrame->SetRect(nsRect(0, childDesiredSize.ascent,
|
||||
childDesiredSize.width, childDesiredSize.height));
|
||||
|
||||
if (aDesiredSize.descent < childDesiredSize.descent)
|
||||
aDesiredSize.descent = childDesiredSize.descent;
|
||||
if (aDesiredSize.ascent < childDesiredSize.ascent)
|
||||
aDesiredSize.ascent = childDesiredSize.ascent;
|
||||
nscoord childDescent = childDesiredSize.height - childDesiredSize.ascent;
|
||||
if (descent < childDescent)
|
||||
descent = childDescent;
|
||||
if (ascent < childDesiredSize.ascent)
|
||||
ascent = childDesiredSize.ascent;
|
||||
}
|
||||
childFrame = childFrame->GetNextSibling();
|
||||
}
|
||||
|
@ -383,19 +386,19 @@ nsMathMLmfencedFrame::doReflow(nsPresContext* aPresContext,
|
|||
// opening fence ...
|
||||
ReflowChar(aPresContext, *aReflowState.rendContext, aOpenChar,
|
||||
NS_MATHML_OPERATOR_FORM_PREFIX, presentationData.scriptLevel,
|
||||
axisHeight, leading, em, containerSize, aDesiredSize);
|
||||
axisHeight, leading, em, containerSize, ascent, descent);
|
||||
/////////////////
|
||||
// separators ...
|
||||
for (i = 0; i < aSeparatorsCount; i++) {
|
||||
ReflowChar(aPresContext, *aReflowState.rendContext, &aSeparatorsChar[i],
|
||||
NS_MATHML_OPERATOR_FORM_INFIX, presentationData.scriptLevel,
|
||||
axisHeight, leading, em, containerSize, aDesiredSize);
|
||||
axisHeight, leading, em, containerSize, ascent, descent);
|
||||
}
|
||||
/////////////////
|
||||
// closing fence ...
|
||||
ReflowChar(aPresContext, *aReflowState.rendContext, aCloseChar,
|
||||
NS_MATHML_OPERATOR_FORM_POSTFIX, presentationData.scriptLevel,
|
||||
axisHeight, leading, em, containerSize, aDesiredSize);
|
||||
axisHeight, leading, em, containerSize, ascent, descent);
|
||||
|
||||
//////////////////
|
||||
// Adjust the origins of each child.
|
||||
|
@ -406,7 +409,7 @@ nsMathMLmfencedFrame::doReflow(nsPresContext* aPresContext,
|
|||
nsBoundingMetrics bm;
|
||||
PRBool firstTime = PR_TRUE;
|
||||
if (aOpenChar) {
|
||||
PlaceChar(aOpenChar, aDesiredSize.ascent, bm, dx);
|
||||
PlaceChar(aOpenChar, ascent, bm, dx);
|
||||
aDesiredSize.mBoundingMetrics = bm;
|
||||
firstTime = PR_FALSE;
|
||||
}
|
||||
|
@ -423,11 +426,11 @@ nsMathMLmfencedFrame::doReflow(nsPresContext* aPresContext,
|
|||
aDesiredSize.mBoundingMetrics += bm;
|
||||
|
||||
mathMLFrame->FinishReflowChild(childFrame, aPresContext, nsnull, childSize,
|
||||
dx, aDesiredSize.ascent - childSize.ascent, 0);
|
||||
dx, ascent - childSize.ascent, 0);
|
||||
dx += childSize.width;
|
||||
|
||||
if (i < aSeparatorsCount) {
|
||||
PlaceChar(&aSeparatorsChar[i], aDesiredSize.ascent, bm, dx);
|
||||
PlaceChar(&aSeparatorsChar[i], ascent, bm, dx);
|
||||
aDesiredSize.mBoundingMetrics += bm;
|
||||
}
|
||||
i++;
|
||||
|
@ -436,7 +439,7 @@ nsMathMLmfencedFrame::doReflow(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
if (aCloseChar) {
|
||||
PlaceChar(aCloseChar, aDesiredSize.ascent, bm, dx);
|
||||
PlaceChar(aCloseChar, ascent, bm, dx);
|
||||
if (firstTime)
|
||||
aDesiredSize.mBoundingMetrics = bm;
|
||||
else
|
||||
|
@ -444,7 +447,8 @@ nsMathMLmfencedFrame::doReflow(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
aDesiredSize.width = aDesiredSize.mBoundingMetrics.width;
|
||||
aDesiredSize.height = aDesiredSize.ascent + aDesiredSize.descent;
|
||||
aDesiredSize.height = ascent + descent;
|
||||
aDesiredSize.ascent = ascent;
|
||||
|
||||
mathMLFrame->SetBoundingMetrics(aDesiredSize.mBoundingMetrics);
|
||||
mathMLFrame->SetReference(nsPoint(0, aDesiredSize.ascent));
|
||||
|
@ -468,7 +472,8 @@ nsMathMLmfencedFrame::ReflowChar(nsPresContext* aPresContext,
|
|||
nscoord leading,
|
||||
nscoord em,
|
||||
nsBoundingMetrics& aContainerSize,
|
||||
nsHTMLReflowMetrics& aDesiredSize)
|
||||
nscoord& aAscent,
|
||||
nscoord& aDescent)
|
||||
{
|
||||
if (aMathMLChar && 0 < aMathMLChar->Length()) {
|
||||
nsOperatorFlags flags = 0;
|
||||
|
@ -514,10 +519,10 @@ nsMathMLmfencedFrame::ReflowChar(nsPresContext* aPresContext,
|
|||
}
|
||||
}
|
||||
|
||||
if (aDesiredSize.ascent < charSize.ascent + leading)
|
||||
aDesiredSize.ascent = charSize.ascent + leading;
|
||||
if (aDesiredSize.descent < charSize.descent + leading)
|
||||
aDesiredSize.descent = charSize.descent + leading;
|
||||
if (aAscent < charSize.ascent + leading)
|
||||
aAscent = charSize.ascent + leading;
|
||||
if (aDescent < charSize.descent + leading)
|
||||
aDescent = charSize.descent + leading;
|
||||
|
||||
// account the spacing
|
||||
charSize.width += NSToCoordRound((leftSpace + rightSpace) * em);
|
||||
|
|
|
@ -110,7 +110,8 @@ public:
|
|||
nscoord leading,
|
||||
nscoord em,
|
||||
nsBoundingMetrics& aContainerSize,
|
||||
nsHTMLReflowMetrics& aDesiredSize);
|
||||
nscoord& aAscent,
|
||||
nscoord& aDescent);
|
||||
|
||||
static void
|
||||
PlaceChar(nsMathMLChar* aMathMLChar,
|
||||
|
|
|
@ -423,8 +423,8 @@ nsMathMLmfracFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
mBoundingMetrics.width = width;
|
||||
|
||||
aDesiredSize.ascent = sizeNum.ascent + numShift;
|
||||
aDesiredSize.descent = sizeDen.descent + denShift;
|
||||
aDesiredSize.height = aDesiredSize.ascent + aDesiredSize.descent;
|
||||
aDesiredSize.height = aDesiredSize.ascent +
|
||||
sizeDen.height - sizeDen.ascent + denShift;
|
||||
aDesiredSize.width = mBoundingMetrics.width;
|
||||
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ nsMathMLmmultiscriptsFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
|
||||
mBoundingMetrics.width = 0;
|
||||
mBoundingMetrics.ascent = mBoundingMetrics.descent = -0x7FFFFFFF;
|
||||
aDesiredSize.ascent = aDesiredSize.descent = -0x7FFFFFFF;
|
||||
nscoord ascent = -0x7FFFFFFF, descent = -0x7FFFFFFF;
|
||||
aDesiredSize.width = aDesiredSize.height = 0;
|
||||
|
||||
nsIFrame* childFrame = mFrames.FirstChild();
|
||||
|
@ -302,8 +302,7 @@ nsMathMLmmultiscriptsFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
trySubScriptShift = PR_MAX(minSubScriptShift,subScriptShift);
|
||||
mBoundingMetrics.descent =
|
||||
PR_MAX(mBoundingMetrics.descent,bmSubScript.descent);
|
||||
aDesiredSize.descent =
|
||||
PR_MAX(aDesiredSize.descent,subScriptSize.descent);
|
||||
descent = PR_MAX(descent,subScriptSize.height - subScriptSize.ascent);
|
||||
width = bmSubScript.width + scriptSpace;
|
||||
rightBearing = bmSubScript.rightBearing;
|
||||
}
|
||||
|
@ -323,8 +322,7 @@ nsMathMLmmultiscriptsFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
PR_MAX(minSupScriptShift,PR_MAX(minShiftFromXHeight,supScriptShift));
|
||||
mBoundingMetrics.ascent =
|
||||
PR_MAX(mBoundingMetrics.ascent,bmSupScript.ascent);
|
||||
aDesiredSize.ascent =
|
||||
PR_MAX(aDesiredSize.ascent,supScriptSize.ascent);
|
||||
ascent = PR_MAX(ascent,supScriptSize.ascent);
|
||||
width = PR_MAX(width, bmSupScript.width + scriptSpace);
|
||||
rightBearing = PR_MAX(rightBearing, bmSupScript.rightBearing);
|
||||
|
||||
|
@ -394,10 +392,9 @@ nsMathMLmmultiscriptsFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
|
||||
// get the reflow metrics ...
|
||||
aDesiredSize.ascent =
|
||||
PR_MAX(aDesiredSize.ascent+maxSupScriptShift,baseSize.ascent);
|
||||
aDesiredSize.descent =
|
||||
PR_MAX(aDesiredSize.descent+maxSubScriptShift,baseSize.descent);
|
||||
aDesiredSize.height = aDesiredSize.ascent + aDesiredSize.descent;
|
||||
PR_MAX(ascent+maxSupScriptShift,baseSize.ascent);
|
||||
aDesiredSize.height = aDesiredSize.ascent +
|
||||
PR_MAX(descent+maxSubScriptShift,baseSize.height - baseSize.ascent);
|
||||
aDesiredSize.width = mBoundingMetrics.width;
|
||||
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
||||
|
||||
|
|
|
@ -818,7 +818,7 @@ nsMathMLmoFrame::Stretch(nsIRenderingContext& aRenderingContext,
|
|||
// see bug 188467 for what is going on here
|
||||
nscoord dy = aDesiredStretchSize.ascent - (mBoundingMetrics.ascent + leading);
|
||||
aDesiredStretchSize.ascent = mBoundingMetrics.ascent + leading;
|
||||
aDesiredStretchSize.descent = mBoundingMetrics.descent;
|
||||
aDesiredStretchSize.height = aDesiredStretchSize.ascent + mBoundingMetrics.descent;
|
||||
|
||||
firstChild->SetPosition(firstChild->GetPosition() - nsPoint(0, dy));
|
||||
}
|
||||
|
@ -827,9 +827,9 @@ nsMathMLmoFrame::Stretch(nsIRenderingContext& aRenderingContext,
|
|||
fm->GetMaxAscent(ascent);
|
||||
fm->GetMaxDescent(descent);
|
||||
aDesiredStretchSize.ascent = PR_MAX(mBoundingMetrics.ascent + leading, ascent);
|
||||
aDesiredStretchSize.descent = PR_MAX(mBoundingMetrics.descent + leading, descent);
|
||||
aDesiredStretchSize.height = aDesiredStretchSize.ascent +
|
||||
PR_MAX(mBoundingMetrics.descent + leading, descent);
|
||||
}
|
||||
aDesiredStretchSize.height = aDesiredStretchSize.ascent + aDesiredStretchSize.descent;
|
||||
aDesiredStretchSize.width = mBoundingMetrics.width;
|
||||
aDesiredStretchSize.mBoundingMetrics = mBoundingMetrics;
|
||||
mReference.x = 0;
|
||||
|
@ -940,7 +940,6 @@ nsMathMLmoFrame::Reflow(nsPresContext* aPresContext,
|
|||
aDesiredSize.width = 0;
|
||||
aDesiredSize.height = 0;
|
||||
aDesiredSize.ascent = 0;
|
||||
aDesiredSize.descent = 0;
|
||||
aDesiredSize.mBoundingMetrics.Clear();
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
|
||||
|
|
|
@ -389,11 +389,11 @@ nsMathMLmoverFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
mBoundingMetrics.rightBearing =
|
||||
PR_MAX(dxBase + bmBase.rightBearing, dxOver + bmOver.rightBearing);
|
||||
|
||||
aDesiredSize.descent = baseSize.descent;
|
||||
aDesiredSize.ascent =
|
||||
PR_MAX(mBoundingMetrics.ascent + delta2,
|
||||
overSize.ascent + bmOver.descent + delta1 + bmBase.ascent);
|
||||
aDesiredSize.height = aDesiredSize.ascent + aDesiredSize.descent;
|
||||
aDesiredSize.height = aDesiredSize.ascent +
|
||||
baseSize.height - baseSize.ascent;
|
||||
aDesiredSize.width = mBoundingMetrics.width;
|
||||
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
||||
|
||||
|
|
|
@ -436,9 +436,8 @@ nsMathMLmpaddedFrame::Reflow(nsPresContext* aPresContext,
|
|||
mBoundingMetrics.descent = depth;
|
||||
|
||||
aDesiredSize.ascent += dy;
|
||||
aDesiredSize.descent += depth - mBoundingMetrics.descent;
|
||||
aDesiredSize.width = mBoundingMetrics.width;
|
||||
aDesiredSize.height = aDesiredSize.ascent + aDesiredSize.descent;
|
||||
aDesiredSize.height += dy + depth - mBoundingMetrics.descent;
|
||||
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
||||
|
||||
// combine our tweaked size and our natural size to get our real estate
|
||||
|
|
|
@ -166,7 +166,7 @@ nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
|
|||
nsReflowStatus childStatus;
|
||||
|
||||
aDesiredSize.width = aDesiredSize.height = 0;
|
||||
aDesiredSize.ascent = aDesiredSize.descent = 0;
|
||||
aDesiredSize.ascent = 0;
|
||||
|
||||
nsBoundingMetrics bmSqr, bmBase, bmIndex;
|
||||
nsIRenderingContext& renderingContext = *aReflowState.rendContext;
|
||||
|
@ -283,9 +283,9 @@ nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
|
|||
PR_MAX(bmBase.width, bmBase.rightBearing); // take also care of the rule
|
||||
|
||||
aDesiredSize.ascent = mBoundingMetrics.ascent + leading;
|
||||
aDesiredSize.descent =
|
||||
PR_MAX(baseSize.descent, (mBoundingMetrics.descent + ruleThickness));
|
||||
aDesiredSize.height = aDesiredSize.ascent + aDesiredSize.descent;
|
||||
aDesiredSize.height = aDesiredSize.ascent +
|
||||
PR_MAX(baseSize.height - baseSize.ascent,
|
||||
mBoundingMetrics.descent + ruleThickness);
|
||||
aDesiredSize.width = mBoundingMetrics.width;
|
||||
|
||||
/////////////
|
||||
|
@ -303,8 +303,9 @@ nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
|
|||
indexClearance =
|
||||
indexRaisedAscent - mBoundingMetrics.ascent; // excess gap introduced by a tall index
|
||||
mBoundingMetrics.ascent = indexRaisedAscent;
|
||||
nscoord descent = aDesiredSize.height - aDesiredSize.ascent;
|
||||
aDesiredSize.ascent = mBoundingMetrics.ascent + leading;
|
||||
aDesiredSize.height = aDesiredSize.ascent + aDesiredSize.descent;
|
||||
aDesiredSize.height = aDesiredSize.ascent + descent;
|
||||
}
|
||||
|
||||
// the index is tucked in closer to the radical while making sure
|
||||
|
|
|
@ -135,9 +135,8 @@ nsMathMLmspaceFrame::Reflow(nsPresContext* aPresContext,
|
|||
mBoundingMetrics.rightBearing = mWidth;
|
||||
|
||||
aDesiredSize.ascent = mHeight;
|
||||
aDesiredSize.descent = mDepth;
|
||||
aDesiredSize.width = mWidth;
|
||||
aDesiredSize.height = aDesiredSize.ascent + aDesiredSize.descent;
|
||||
aDesiredSize.height = aDesiredSize.ascent + mDepth;
|
||||
// Also return our bounding metrics
|
||||
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
||||
|
||||
|
|
|
@ -259,9 +259,9 @@ nsMathMLmsqrtFrame::Reflow(nsPresContext* aPresContext,
|
|||
PR_MAX(bmBase.width, bmBase.rightBearing); // take also care of the rule
|
||||
|
||||
aDesiredSize.ascent = mBoundingMetrics.ascent + leading;
|
||||
aDesiredSize.descent =
|
||||
PR_MAX(baseSize.descent, (mBoundingMetrics.descent + ruleThickness));
|
||||
aDesiredSize.height = aDesiredSize.ascent + aDesiredSize.descent;
|
||||
aDesiredSize.height = aDesiredSize.ascent +
|
||||
PR_MAX(baseSize.height - baseSize.ascent,
|
||||
mBoundingMetrics.descent + ruleThickness);
|
||||
aDesiredSize.width = mBoundingMetrics.width;
|
||||
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
||||
|
||||
|
|
|
@ -200,9 +200,9 @@ nsMathMLmsubFrame::PlaceSubScript (nsPresContext* aPresContext,
|
|||
// reflow metrics
|
||||
aDesiredSize.ascent =
|
||||
PR_MAX(baseSize.ascent, subScriptSize.ascent - actualSubScriptShift);
|
||||
aDesiredSize.descent =
|
||||
PR_MAX(baseSize.descent, subScriptSize.descent + actualSubScriptShift);
|
||||
aDesiredSize.height = aDesiredSize.ascent + aDesiredSize.descent;
|
||||
aDesiredSize.height = aDesiredSize.ascent +
|
||||
PR_MAX(baseSize.height - baseSize.ascent,
|
||||
subScriptSize.height - subScriptSize.ascent + actualSubScriptShift);
|
||||
aDesiredSize.width = boundingMetrics.width;
|
||||
aDesiredSize.mBoundingMetrics = boundingMetrics;
|
||||
|
||||
|
|
|
@ -332,11 +332,10 @@ nsMathMLmsubsupFrame::PlaceSubSupScript(nsPresContext* aPresContext,
|
|||
PR_MAX(baseSize.ascent,
|
||||
PR_MAX(subScriptSize.ascent - subScriptShift,
|
||||
supScriptSize.ascent + supScriptShift));
|
||||
aDesiredSize.descent =
|
||||
PR_MAX(baseSize.descent,
|
||||
PR_MAX(subScriptSize.descent + subScriptShift,
|
||||
supScriptSize.descent - supScriptShift));
|
||||
aDesiredSize.height = aDesiredSize.ascent + aDesiredSize.descent;
|
||||
aDesiredSize.height = aDesiredSize.ascent +
|
||||
PR_MAX(baseSize.height - baseSize.ascent,
|
||||
PR_MAX(subScriptSize.height - subScriptSize.ascent + subScriptShift,
|
||||
supScriptSize.height - subScriptSize.ascent - supScriptShift));
|
||||
aDesiredSize.width = boundingMetrics.width;
|
||||
aDesiredSize.mBoundingMetrics = boundingMetrics;
|
||||
|
||||
|
|
|
@ -238,9 +238,9 @@ nsMathMLmsupFrame::PlaceSuperScript(nsPresContext* aPresContext,
|
|||
// reflow metrics
|
||||
aDesiredSize.ascent =
|
||||
PR_MAX(baseSize.ascent, (supScriptSize.ascent + actualSupScriptShift));
|
||||
aDesiredSize.descent =
|
||||
PR_MAX(baseSize.descent, (supScriptSize.descent - actualSupScriptShift));
|
||||
aDesiredSize.height = aDesiredSize.ascent + aDesiredSize.descent;
|
||||
aDesiredSize.height = aDesiredSize.ascent +
|
||||
PR_MAX(baseSize.height - baseSize.ascent,
|
||||
(supScriptSize.height - supScriptSize.ascent - actualSupScriptShift));
|
||||
aDesiredSize.width = boundingMetrics.width;
|
||||
aDesiredSize.mBoundingMetrics = boundingMetrics;
|
||||
|
||||
|
|
|
@ -632,7 +632,6 @@ nsMathMLmtableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
aDesiredSize.ascent = dy + height/2 + axisHeight;
|
||||
}
|
||||
}
|
||||
aDesiredSize.descent = aDesiredSize.height - aDesiredSize.ascent;
|
||||
|
||||
mReference.x = 0;
|
||||
mReference.y = aDesiredSize.ascent;
|
||||
|
@ -640,7 +639,7 @@ nsMathMLmtableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
// just make-up a bounding metrics
|
||||
mBoundingMetrics.Clear();
|
||||
mBoundingMetrics.ascent = aDesiredSize.ascent;
|
||||
mBoundingMetrics.descent = aDesiredSize.descent;
|
||||
mBoundingMetrics.descent = aDesiredSize.height - aDesiredSize.ascent;
|
||||
mBoundingMetrics.width = aDesiredSize.width;
|
||||
mBoundingMetrics.leftBearing = 0;
|
||||
mBoundingMetrics.rightBearing = aDesiredSize.width;
|
||||
|
|
|
@ -343,10 +343,10 @@ nsMathMLmunderFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
PR_MAX(dxBase + bmBase.rightBearing, dxUnder + bmUnder.rightBearing);
|
||||
|
||||
aDesiredSize.ascent = baseSize.ascent;
|
||||
aDesiredSize.descent =
|
||||
aDesiredSize.height = aDesiredSize.ascent +
|
||||
PR_MAX(mBoundingMetrics.descent + delta2,
|
||||
bmBase.descent + delta1 + bmUnder.ascent + underSize.descent);
|
||||
aDesiredSize.height = aDesiredSize.ascent + aDesiredSize.descent;
|
||||
bmBase.descent + delta1 + bmUnder.ascent +
|
||||
underSize.height - underSize.ascent);
|
||||
aDesiredSize.width = mBoundingMetrics.width;
|
||||
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
||||
|
||||
|
|
|
@ -464,10 +464,10 @@ nsMathMLmunderoverFrame::Place(nsIRenderingContext& aRenderingContext,
|
|||
PR_MAX(dxAnonymousBase + bmAnonymousBase.rightBearing, dxUnder + bmUnder.rightBearing);
|
||||
|
||||
aDesiredSize.ascent = ascentAnonymousBase;
|
||||
aDesiredSize.descent =
|
||||
aDesiredSize.height = aDesiredSize.ascent +
|
||||
PR_MAX(mBoundingMetrics.descent + underDelta2,
|
||||
bmAnonymousBase.descent + underDelta1 + bmUnder.ascent + underSize.descent);
|
||||
aDesiredSize.height = aDesiredSize.ascent + aDesiredSize.descent;
|
||||
bmAnonymousBase.descent + underDelta1 + bmUnder.ascent +
|
||||
underSize.height - underSize.ascent);
|
||||
aDesiredSize.width = mBoundingMetrics.width;
|
||||
aDesiredSize.mBoundingMetrics = mBoundingMetrics;
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase, bug 367332</title>
|
||||
<style type="text/css">
|
||||
|
||||
td { padding-top: 0; }
|
||||
td div { padding-top: 40px; }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><div>data</div></td>
|
||||
<td><div>data</div></td>
|
||||
<td><div>data</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase, bug 367332</title>
|
||||
<style type="text/css">
|
||||
|
||||
td { vertical-align: baseline; }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td style="padding-top: 40px"><div>data</div></td>
|
||||
<td style="padding-top: 20px"><div>data</div></td>
|
||||
<td style="padding-top: 0"><div>data</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase, bug 367332</title>
|
||||
<style type="text/css">
|
||||
|
||||
td { vertical-align: baseline; padding-top: 0; }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><div style="padding-top: 40px">data</div></td>
|
||||
<td><div style="padding-top: 20px">data</div></td>
|
||||
<td><div style="padding-top: 0">data</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase, bug 367332</title>
|
||||
<style type="text/css">
|
||||
|
||||
td { vertical-align: baseline; }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td style="padding-top: 0"><div style="padding-top: 40px">data</div></td>
|
||||
<td style="padding-top: 12px"><div style="padding-top: 3px">data</div></td>
|
||||
<td style="padding-top: 40px"><div style="padding-top: 0">data</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase, bug 367332</title>
|
||||
<style type="text/css">
|
||||
|
||||
td { vertical-align: baseline; }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td style="padding-top: 12px"><div style="padding-top: 3px">data</div></td>
|
||||
<td style="padding-top: 40px"><div style="padding-top: 0">data</div></td>
|
||||
<td style="padding-top: 0"><div style="padding-top: 40px">data</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase, bug 367332</title>
|
||||
<style type="text/css">
|
||||
|
||||
td { vertical-align: baseline; }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td style="padding-top: 0; height: 80px;"><div style="padding-top: 40px">data</div></td>
|
||||
<td style="padding-top: 12px; height: 120px;"><div style="padding-top: 3px">data</div></td>
|
||||
<td style="padding-top: 40px; height: 160px;"><div style="padding-top: 0">data</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase, bug 367332</title>
|
||||
<style type="text/css">
|
||||
|
||||
td { vertical-align: baseline; }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td style="padding-top: 0;"><div style="padding-top: 40px; height: 80px;">data</div></td>
|
||||
<td style="padding-top: 12px;"><div style="padding-top: 3px; height: 120px;">data</div></td>
|
||||
<td style="padding-top: 40px;"><div style="padding-top: 0; height: 160px;">data</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase, bug 367332</title>
|
||||
<style type="text/css">
|
||||
|
||||
td { vertical-align: baseline; }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td style="padding-top: 0;"><div style="padding-top: 40px; height: 80px;">data</div></td>
|
||||
<td style="padding-top: 12px; height: 160px;"><div style="padding-top: 3px;">data</div></td>
|
||||
<td style="padding-top: 40px;"><div style="padding-top: 0;">data</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -42,6 +42,13 @@ f== bugs/360065-1.html bugs/360065-1-ref.html # bug 18217
|
|||
== bugs/273681-1.html bugs/273681-1-ref.html
|
||||
== bugs/335628-1.html bugs/335628-1-ref.html
|
||||
!= bugs/335628-2.xul bugs/335628-2-ref.xul
|
||||
== bugs/367332-1a.html bugs/367332-1-ref.html
|
||||
== bugs/367332-1b.html bugs/367332-1-ref.html
|
||||
== bugs/367332-1c.html bugs/367332-1-ref.html
|
||||
== bugs/367332-1d.html bugs/367332-1-ref.html
|
||||
== bugs/367332-1e.html bugs/367332-1-ref.html
|
||||
== bugs/367332-1f.html bugs/367332-1-ref.html
|
||||
== bugs/367332-1g.html bugs/367332-1-ref.html
|
||||
|
||||
# table-dom/
|
||||
== table-dom/appendCells1.html table-dom/appendCells1-ref.html
|
||||
|
|
|
@ -315,9 +315,6 @@ nsSVGOuterSVGFrame::Reflow(nsPresContext* aPresContext,
|
|||
aDesiredSize.width = (int)(width*twipsPerPx);
|
||||
aDesiredSize.height = (int)(height*twipsPerPx);
|
||||
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
|
||||
// XXX add in CSS borders ??
|
||||
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
|
|
|
@ -555,7 +555,7 @@ void nsTableCellFrame::VerticallyAlignChild(const nsHTMLReflowState& aReflowStat
|
|||
case NS_STYLE_VERTICAL_ALIGN_BASELINE:
|
||||
// Align the baselines of the child frame with the baselines of
|
||||
// other children in the same row which have 'vertical-align: baseline'
|
||||
kidYTop = topInset + aMaxAscent - GetDesiredAscent();
|
||||
kidYTop = topInset + aMaxAscent - GetCellBaseline();
|
||||
break;
|
||||
|
||||
case NS_STYLE_VERTICAL_ALIGN_TOP:
|
||||
|
@ -617,6 +617,20 @@ nsTableCellFrame::HasVerticalAlignBaseline()
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsTableCellFrame::GetCellBaseline() const
|
||||
{
|
||||
// Ignore the position of the inner frame relative to the cell frame
|
||||
// since we want the position as though the inner were top-aligned.
|
||||
nsIFrame *inner = mFrames.FirstChild();
|
||||
nscoord borderPadding = GetUsedBorderAndPadding().top;
|
||||
nscoord result;
|
||||
if (nsLayoutUtils::GetFirstLineBaseline(inner, &result))
|
||||
return result + borderPadding;
|
||||
return inner->GetContentRect().YMost() - inner->GetPosition().y +
|
||||
borderPadding;
|
||||
}
|
||||
|
||||
PRInt32 nsTableCellFrame::GetRowSpan()
|
||||
{
|
||||
PRInt32 rowSpan=1;
|
||||
|
@ -780,7 +794,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsPresContext* aPresContext,
|
|||
availSize.height = 1;
|
||||
|
||||
nsHTMLReflowMetrics kidSize(aDesiredSize.mFlags);
|
||||
kidSize.width=kidSize.height=kidSize.ascent=kidSize.descent=0;
|
||||
kidSize.width = kidSize.height = 0;
|
||||
SetPriorAvailWidth(aReflowState.availableWidth);
|
||||
nsIFrame* firstKid = mFrames.FirstChild();
|
||||
NS_ASSERTION(firstKid, "Frame construction error, a table cell always has an inner cell frame");
|
||||
|
@ -854,12 +868,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsPresContext* aPresContext,
|
|||
// set the cell's desired size and max element size
|
||||
aDesiredSize.width = cellWidth;
|
||||
aDesiredSize.height = cellHeight;
|
||||
aDesiredSize.ascent = topInset;
|
||||
aDesiredSize.descent = bottomInset;
|
||||
|
||||
aDesiredSize.ascent += kidSize.ascent;
|
||||
aDesiredSize.descent += kidSize.descent;
|
||||
|
||||
// the overflow area will be computed when the child will be vertically aligned
|
||||
|
||||
if (aReflowState.mFlags.mSpecialHeightReflow) {
|
||||
|
|
|
@ -157,6 +157,12 @@ public:
|
|||
|
||||
PRBool HasVerticalAlignBaseline();
|
||||
|
||||
/**
|
||||
* Get the first-line baseline of the cell relative to its top border
|
||||
* edge, as if the cell were vertically aligned to the top of the row.
|
||||
*/
|
||||
nscoord GetCellBaseline() const;
|
||||
|
||||
/**
|
||||
* return the cell's specified row span. this is what was specified in the
|
||||
* content model or in the style info, and is always >= 1.
|
||||
|
@ -192,17 +198,16 @@ public:
|
|||
void SetColIndex(PRInt32 aColIndex);
|
||||
|
||||
/** return the available width given to this frame during its last reflow */
|
||||
virtual nscoord GetPriorAvailWidth();
|
||||
inline nscoord GetPriorAvailWidth();
|
||||
|
||||
/** set the available width given to this frame during its last reflow */
|
||||
virtual void SetPriorAvailWidth(nscoord aPriorAvailWidth);
|
||||
inline void SetPriorAvailWidth(nscoord aPriorAvailWidth);
|
||||
|
||||
/** return the desired size returned by this frame during its last reflow */
|
||||
virtual nsSize GetDesiredSize();
|
||||
virtual nscoord GetDesiredAscent();
|
||||
inline nsSize GetDesiredSize();
|
||||
|
||||
/** set the desired size returned by this frame during its last reflow */
|
||||
virtual void SetDesiredSize(const nsHTMLReflowMetrics & aDesiredSize);
|
||||
inline void SetDesiredSize(const nsHTMLReflowMetrics & aDesiredSize);
|
||||
|
||||
PRBool GetContentEmpty();
|
||||
void SetContentEmpty(PRBool aContentEmpty);
|
||||
|
@ -251,7 +256,6 @@ protected:
|
|||
|
||||
nscoord mPriorAvailWidth; // the avail width during the last reflow
|
||||
nsSize mDesiredSize; // the last desired width & height
|
||||
nscoord mDesiredAscent; // the last desired ascent
|
||||
};
|
||||
|
||||
inline nscoord nsTableCellFrame::GetPriorAvailWidth()
|
||||
|
@ -263,14 +267,10 @@ inline void nsTableCellFrame::SetPriorAvailWidth(nscoord aPriorAvailWidth)
|
|||
inline nsSize nsTableCellFrame::GetDesiredSize()
|
||||
{ return mDesiredSize; }
|
||||
|
||||
inline nscoord nsTableCellFrame::GetDesiredAscent()
|
||||
{ return mDesiredAscent; }
|
||||
|
||||
inline void nsTableCellFrame::SetDesiredSize(const nsHTMLReflowMetrics & aDesiredSize)
|
||||
{
|
||||
mDesiredSize.width = aDesiredSize.width;
|
||||
mDesiredSize.height = aDesiredSize.height;
|
||||
mDesiredAscent = aDesiredSize.ascent;
|
||||
}
|
||||
|
||||
inline PRBool nsTableCellFrame::GetContentEmpty()
|
||||
|
|
|
@ -384,8 +384,6 @@ NS_METHOD nsTableColGroupFrame::Reflow(nsPresContext* aPresContext,
|
|||
|
||||
aDesiredSize.width=0;
|
||||
aDesiredSize.height=0;
|
||||
aDesiredSize.ascent=aDesiredSize.height;
|
||||
aDesiredSize.descent=0;
|
||||
aStatus = NS_FRAME_COMPLETE;
|
||||
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
||||
return rv;
|
||||
|
|
|
@ -2798,7 +2798,7 @@ nsTableFrame::ReflowChildren(nsTableReflowState& aReflowState,
|
|||
nsRect oldKidRect = kidFrame->GetRect();
|
||||
|
||||
nsHTMLReflowMetrics desiredSize;
|
||||
desiredSize.width = desiredSize.height = desiredSize.ascent = desiredSize.descent = 0;
|
||||
desiredSize.width = desiredSize.height = 0;
|
||||
|
||||
// Reflow the child into the available space
|
||||
nsHTMLReflowState kidReflowState(presContext, aReflowState.reflowState,
|
||||
|
@ -3440,7 +3440,8 @@ nscoord nsTableFrame::GetCellSpacingY()
|
|||
}
|
||||
|
||||
|
||||
nscoord nsTableFrame::GetAscent()
|
||||
/* virtual */ nscoord
|
||||
nsTableFrame::GetBaseline() const
|
||||
{
|
||||
nscoord ascent = 0;
|
||||
nsAutoVoidArray orderedRowGroups;
|
||||
|
@ -3451,7 +3452,7 @@ nscoord nsTableFrame::GetAscent()
|
|||
nsTableRowGroupFrame* rgFrame = GetRowGroupFrame((nsIFrame*)orderedRowGroups.ElementAt(rgIndex));
|
||||
if (rgFrame->GetRowCount()) {
|
||||
firstRow = rgFrame->GetFirstRow();
|
||||
ascent = rgFrame->GetRect().y + firstRow->GetRect().y + firstRow->GetAscent();
|
||||
ascent = rgFrame->GetRect().y + firstRow->GetRect().y + firstRow->GetRowBaseline();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -348,7 +348,7 @@ public:
|
|||
/** helper to get the cell spacing Y style value */
|
||||
virtual nscoord GetCellSpacingY();
|
||||
|
||||
nscoord GetAscent();
|
||||
virtual nscoord GetBaseline() const;
|
||||
/** return the row span of a cell, taking into account row span magic at the bottom
|
||||
* of a table. The row span equals the number of rows spanned by aCell starting at
|
||||
* aStartRowIndex, and can be smaller if aStartRowIndex is greater than the row
|
||||
|
|
|
@ -78,6 +78,18 @@ nsTableCaptionFrame::GetType() const
|
|||
return nsGkAtoms::tableCaptionFrame;
|
||||
}
|
||||
|
||||
/* virtual */ nscoord
|
||||
nsTableOuterFrame::GetBaseline() const
|
||||
{
|
||||
nsIFrame* kid = mFrames.FirstChild();
|
||||
if (!kid) {
|
||||
NS_NOTREACHED("no inner table");
|
||||
return nsHTMLContainerFrame::GetBaseline();
|
||||
}
|
||||
|
||||
return kid->GetBaseline() + kid->GetPosition().y;
|
||||
}
|
||||
|
||||
inline PRBool IsSideCaption(nsIFrame* aCaptionFrame)
|
||||
{
|
||||
PRUint8 captionSide = aCaptionFrame->GetStyleTableBorder()->mCaptionSide;
|
||||
|
@ -1259,8 +1271,6 @@ NS_METHOD nsTableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
UpdateReflowMetrics(captionSide, aDesiredSize, innerMargin, captionMargin);
|
||||
|
||||
// Return our desired rect
|
||||
aDesiredSize.ascent = mInnerTableFrame->GetAscent();
|
||||
aDesiredSize.descent = aDesiredSize.height - aDesiredSize.ascent;
|
||||
|
||||
NS_FRAME_SET_TRUNCATION(aStatus, aOuterRS, aDesiredSize);
|
||||
return rv;
|
||||
|
|
|
@ -133,6 +133,8 @@ public:
|
|||
const nsRect& aDirtyRect,
|
||||
const nsDisplayListSet& aLists);
|
||||
|
||||
virtual nscoord GetBaseline() const;
|
||||
|
||||
virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
|
||||
virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
|
||||
virtual nsSize ComputeAutoSize(nsIRenderingContext *aRenderingContext,
|
||||
|
|
|
@ -381,7 +381,7 @@ nscoord nsTableRowFrame::GetMaxCellAscent() const
|
|||
return mMaxCellAscent;
|
||||
}
|
||||
|
||||
nscoord nsTableRowFrame::GetAscent()
|
||||
nscoord nsTableRowFrame::GetRowBaseline()
|
||||
{
|
||||
if(mMaxCellAscent)
|
||||
return mMaxCellAscent;
|
||||
|
@ -522,7 +522,7 @@ nsTableRowFrame::CalcHeight(const nsHTMLReflowState& aReflowState)
|
|||
if (!kidFrame->GetFirstChild(nsnull)->GetFirstChild(nsnull))
|
||||
ascent = desSize.height;
|
||||
else
|
||||
ascent = ((nsTableCellFrame *)kidFrame)->GetDesiredAscent();
|
||||
ascent = ((nsTableCellFrame *)kidFrame)->GetCellBaseline();
|
||||
nscoord descent = desSize.height - ascent;
|
||||
UpdateHeight(desSize.height, ascent, descent, tableFrame, (nsTableCellFrame*)kidFrame);
|
||||
}
|
||||
|
@ -975,7 +975,7 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
|
|||
if (!kidFrame->GetFirstChild(nsnull)->GetFirstChild(nsnull))
|
||||
ascent = desiredSize.height;
|
||||
else
|
||||
ascent = ((nsTableCellFrame *)kidFrame)->GetDesiredAscent();
|
||||
ascent = ((nsTableCellFrame *)kidFrame)->GetCellBaseline();
|
||||
nscoord descent = desiredSize.height - ascent;
|
||||
UpdateHeight(desiredSize.height, ascent, descent, &aTableFrame, cellFrame);
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ public:
|
|||
|
||||
/* return the row ascent
|
||||
*/
|
||||
nscoord GetAscent();
|
||||
nscoord GetRowBaseline();
|
||||
|
||||
/** returns the ordinal position of this row in its table */
|
||||
virtual PRInt32 GetRowIndex() const;
|
||||
|
|
|
@ -397,7 +397,7 @@ nsTableRowGroupFrame::ReflowChildren(nsPresContext* aPresContext,
|
|||
// XXXldb We used to only pass aDesiredSize.mFlags through for the
|
||||
// incremental reflow codepath.
|
||||
nsHTMLReflowMetrics desiredSize(aDesiredSize.mFlags);
|
||||
desiredSize.width = desiredSize.height = desiredSize.ascent = desiredSize.descent = 0;
|
||||
desiredSize.width = desiredSize.height = 0;
|
||||
|
||||
// Reflow the child into the available space, giving it as much height as
|
||||
// it wants. We'll deal with splitting later after we've computed the row
|
||||
|
@ -677,7 +677,8 @@ nsTableRowGroupFrame::CalculateRowHeights(nsPresContext* aPresContext,
|
|||
// to ensure that a spanning cell with a long descender doesn't
|
||||
// collide with the next row, we need to take into account the shift
|
||||
// that will be done to align the cell on the baseline of the row.
|
||||
cellFrameSize.height += rowFrame->GetMaxCellAscent() - cellFrame->GetDesiredAscent();
|
||||
cellFrameSize.height += rowFrame->GetMaxCellAscent() -
|
||||
cellFrame->GetCellBaseline();
|
||||
}
|
||||
|
||||
if (heightOfAreaSpanned < cellFrameSize.height) {
|
||||
|
|
|
@ -800,7 +800,6 @@ nsBoxFrame::Reflow(nsPresContext* aPresContext,
|
|||
aDesiredSize.width = mRect.width;
|
||||
aDesiredSize.height = mRect.height;
|
||||
aDesiredSize.ascent = ascent;
|
||||
aDesiredSize.descent = mRect.height - ascent;
|
||||
|
||||
// NS_FRAME_OUTSIDE_CHILDREN is set in SetBounds() above
|
||||
if (mState & NS_FRAME_OUTSIDE_CHILDREN) {
|
||||
|
|
|
@ -352,7 +352,6 @@ nsLeafBoxFrame::Reflow(nsPresContext* aPresContext,
|
|||
aDesiredSize.width = mRect.width;
|
||||
aDesiredSize.height = mRect.height;
|
||||
aDesiredSize.ascent = ascent;
|
||||
aDesiredSize.descent = 0;
|
||||
|
||||
// NS_FRAME_OUTSIDE_CHILDREN is set in SetBounds() above
|
||||
if (mState & NS_FRAME_OUTSIDE_CHILDREN) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче