зеркало из https://github.com/mozilla/gecko-dev.git
Remove some code that handles unconstrained widths (and fix nsFirstLetterFrame not to pass them). b=407086 r+sr=roc a=dsicore
This commit is contained in:
Родитель
96e4c0fb5d
Коммит
37d5bc4b46
|
@ -262,9 +262,9 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
|
|||
const nsMargin& bp = aReflowState.mComputedBorderPadding;
|
||||
nscoord lr = bp.left + bp.right;
|
||||
nscoord tb = bp.top + bp.bottom;
|
||||
if (NS_UNCONSTRAINEDSIZE != availSize.width) {
|
||||
availSize.width -= lr;
|
||||
}
|
||||
NS_ASSERTION(availSize.width != NS_UNCONSTRAINEDSIZE,
|
||||
"should no longer use unconstrained widths");
|
||||
availSize.width -= lr;
|
||||
if (NS_UNCONSTRAINEDSIZE != availSize.height) {
|
||||
availSize.height -= tb;
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ nsFirstLetterFrame::Reflow(nsPresContext* aPresContext,
|
|||
// line context is when its floating.
|
||||
nsHTMLReflowState rs(aPresContext, aReflowState, kid, availSize);
|
||||
nsLineLayout ll(aPresContext, nsnull, &aReflowState, nsnull);
|
||||
ll.BeginLineReflow(0, 0, NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE,
|
||||
ll.BeginLineReflow(bp.left, bp.top, availSize.width, NS_UNCONSTRAINEDSIZE,
|
||||
PR_FALSE, PR_TRUE);
|
||||
rs.mLineLayout = ≪
|
||||
ll.SetFirstLetterStyleOK(PR_TRUE);
|
||||
|
|
|
@ -425,12 +425,12 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
|||
: aReflowState.mComputedBorderPadding.right;
|
||||
}
|
||||
nscoord availableWidth = aReflowState.availableWidth;
|
||||
if (NS_UNCONSTRAINEDSIZE != availableWidth) {
|
||||
// Subtract off left and right border+padding from availableWidth
|
||||
availableWidth -= leftEdge;
|
||||
availableWidth -= ltr ? aReflowState.mComputedBorderPadding.right
|
||||
: aReflowState.mComputedBorderPadding.left;
|
||||
}
|
||||
NS_ASSERTION(availableWidth != NS_UNCONSTRAINEDSIZE,
|
||||
"should no longer use available widths");
|
||||
// Subtract off left and right border+padding from availableWidth
|
||||
availableWidth -= leftEdge;
|
||||
availableWidth -= ltr ? aReflowState.mComputedBorderPadding.right
|
||||
: aReflowState.mComputedBorderPadding.left;
|
||||
lineLayout->BeginSpan(this, &aReflowState, leftEdge, leftEdge + availableWidth);
|
||||
|
||||
// First reflow our current children
|
||||
|
|
|
@ -172,6 +172,8 @@ nsLineLayout::BeginLineReflow(nscoord aX, nscoord aY,
|
|||
PRBool aIsTopOfPage)
|
||||
{
|
||||
NS_ASSERTION(nsnull == mRootSpan, "bad linelayout user");
|
||||
NS_ASSERTION(aWidth != NS_UNCONSTRAINEDSIZE,
|
||||
"should no longer be using unconstrained widths");
|
||||
#ifdef DEBUG
|
||||
if ((aWidth != NS_UNCONSTRAINEDSIZE) && CRAZY_WIDTH(aWidth)) {
|
||||
NS_NOTREACHED("bad width");
|
||||
|
@ -214,12 +216,7 @@ nsLineLayout::BeginLineReflow(nscoord aX, nscoord aY,
|
|||
psd->mReflowState = mBlockReflowState;
|
||||
psd->mLeftEdge = aX;
|
||||
psd->mX = aX;
|
||||
if (NS_UNCONSTRAINEDSIZE == aWidth) {
|
||||
psd->mRightEdge = NS_UNCONSTRAINEDSIZE;
|
||||
}
|
||||
else {
|
||||
psd->mRightEdge = aX + aWidth;
|
||||
}
|
||||
psd->mRightEdge = aX + aWidth;
|
||||
|
||||
mTopEdge = aY;
|
||||
|
||||
|
@ -250,9 +247,7 @@ nsLineLayout::BeginLineReflow(nscoord aX, nscoord aY,
|
|||
mTextIndent = indent;
|
||||
|
||||
if (NS_STYLE_DIRECTION_RTL == psd->mDirection) {
|
||||
if (NS_UNCONSTRAINEDSIZE != psd->mRightEdge) {
|
||||
psd->mRightEdge -= indent;
|
||||
}
|
||||
psd->mRightEdge -= indent;
|
||||
}
|
||||
else {
|
||||
psd->mX += indent;
|
||||
|
@ -319,12 +314,10 @@ nsLineLayout::UpdateBand(nscoord aX, nscoord aY,
|
|||
#endif
|
||||
|
||||
// Compute the difference between last times width and the new width
|
||||
nscoord deltaWidth = 0;
|
||||
if (NS_UNCONSTRAINEDSIZE != psd->mRightEdge) {
|
||||
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != aWidth, "switched constraints");
|
||||
nscoord oldWidth = psd->mRightEdge - psd->mLeftEdge;
|
||||
deltaWidth = aWidth - oldWidth;
|
||||
}
|
||||
NS_ASSERTION(psd->mRightEdge != NS_UNCONSTRAINEDSIZE &&
|
||||
aWidth != NS_UNCONSTRAINEDSIZE,
|
||||
"shouldn't use unconstrained widths anymore");
|
||||
nscoord deltaWidth = aWidth - (psd->mRightEdge - psd->mLeftEdge);
|
||||
#ifdef NOISY_REFLOW
|
||||
nsFrame::ListTag(stdout, mBlockReflowState->frame);
|
||||
printf(": UpdateBand: %d,%d,%d,%d deltaWidth=%d %s float\n",
|
||||
|
@ -334,12 +327,7 @@ nsLineLayout::UpdateBand(nscoord aX, nscoord aY,
|
|||
|
||||
psd->mLeftEdge = aX;
|
||||
psd->mX = aX;
|
||||
if (NS_UNCONSTRAINEDSIZE == aWidth) {
|
||||
psd->mRightEdge = NS_UNCONSTRAINEDSIZE;
|
||||
}
|
||||
else {
|
||||
psd->mRightEdge = aX + aWidth;
|
||||
}
|
||||
psd->mRightEdge = aX + aWidth;
|
||||
mTopEdge = aY;
|
||||
SetFlag(LL_UPDATEDBAND, PR_TRUE);
|
||||
mPlacedFloats |= (aPlacedLeftFloat ? PLACED_LEFT : PLACED_RIGHT);
|
||||
|
@ -357,12 +345,7 @@ nsLineLayout::UpdateBand(nscoord aX, nscoord aY,
|
|||
break;
|
||||
}
|
||||
NS_ASSERTION(psd->mX == psd->mLeftEdge, "bad float placement");
|
||||
if (NS_UNCONSTRAINEDSIZE == aWidth) {
|
||||
psd->mRightEdge = NS_UNCONSTRAINEDSIZE;
|
||||
}
|
||||
else {
|
||||
psd->mRightEdge += deltaWidth;
|
||||
}
|
||||
psd->mRightEdge += deltaWidth;
|
||||
psd->mContainsFloat = PR_TRUE;
|
||||
#ifdef NOISY_REFLOW
|
||||
printf(" span %p: oldRightEdge=%d newRightEdge=%d\n",
|
||||
|
@ -426,6 +409,8 @@ nsLineLayout::BeginSpan(nsIFrame* aFrame,
|
|||
nscoord aLeftEdge,
|
||||
nscoord aRightEdge)
|
||||
{
|
||||
NS_ASSERTION(aRightEdge != NS_UNCONSTRAINEDSIZE,
|
||||
"should no longer be using unconstrained sizes");
|
||||
#ifdef NOISY_REFLOW
|
||||
nsFrame::IndentBy(stdout, mSpanDepth+1);
|
||||
nsFrame::ListTag(stdout, aFrame);
|
||||
|
@ -476,20 +461,8 @@ nsLineLayout::EndSpan(nsIFrame* aFrame, nsSize& aSizeResult)
|
|||
width = psd->mX - psd->mLeftEdge;
|
||||
PerFrameData* pfd = psd->mFirstFrame;
|
||||
while (nsnull != pfd) {
|
||||
/* there's one oddball case we need to guard against
|
||||
* if we're reflowed with NS_UNCONSTRAINEDSIZE
|
||||
* then the last frame will not contribute to the max element size height
|
||||
* if it is a text frame that only contains whitespace
|
||||
*/
|
||||
if (NS_UNCONSTRAINEDSIZE != psd->mRightEdge || // it's not an unconstrained reflow
|
||||
pfd->mNext || // or it's not the last frame in the span
|
||||
!pfd->GetFlag(PFD_ISTEXTFRAME) || // or it's not a text frame
|
||||
pfd->GetFlag(PFD_ISNONWHITESPACETEXTFRAME) // or it contains something other than whitespace
|
||||
) {
|
||||
if (pfd->mBounds.height > maxHeight) maxHeight = pfd->mBounds.height;
|
||||
|
||||
// Compute max-element-width if necessary
|
||||
}
|
||||
if (pfd->mBounds.height > maxHeight)
|
||||
maxHeight = pfd->mBounds.height;
|
||||
pfd = pfd->mNext;
|
||||
}
|
||||
}
|
||||
|
@ -2461,17 +2434,9 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
|
|||
PRBool aAllowJustify)
|
||||
{
|
||||
PerSpanData* psd = mRootSpan;
|
||||
nscoord availWidth = psd->mRightEdge;
|
||||
if (NS_UNCONSTRAINEDSIZE == availWidth) {
|
||||
NS_NOTREACHED("This shouldn't be called anymore");
|
||||
// Don't bother horizontal aligning on pass1 table reflow
|
||||
#ifdef NOISY_HORIZONTAL_ALIGN
|
||||
nsFrame::ListTag(stdout, mBlockReflowState->frame);
|
||||
printf(": skipping horizontal alignment in pass1 table reflow\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
availWidth -= psd->mLeftEdge;
|
||||
NS_ASSERTION(psd->mRightEdge != NS_UNCONSTRAINEDSIZE,
|
||||
"shouldn't have unconstrained widths anymore");
|
||||
nscoord availWidth = psd->mRightEdge - psd->mLeftEdge;
|
||||
nscoord remainingWidth = availWidth - aLineBounds.width;
|
||||
#ifdef NOISY_HORIZONTAL_ALIGN
|
||||
nsFrame::ListTag(stdout, mBlockReflowState->frame);
|
||||
|
|
Загрузка…
Ссылка в новой задаче