Make unconstrained width assertions into warnings because we can hit them when we clamp really large widths. (Bug 525100) r=roc

This commit is contained in:
L. David Baron 2009-10-28 20:22:28 -07:00
Родитель 7b93863703
Коммит 7f2dd889cf
5 изменённых файлов: 49 добавлений и 27 удалений

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

@ -2102,8 +2102,10 @@ nsLayoutUtils::ComputeWidthValue(
{
NS_PRECONDITION(aFrame, "non-null frame expected");
NS_PRECONDITION(aRenderingContext, "non-null rendering context expected");
NS_PRECONDITION(aContainingBlockWidth != NS_UNCONSTRAINEDSIZE,
"unconstrained widths no longer supported");
NS_WARN_IF_FALSE(aContainingBlockWidth != NS_UNCONSTRAINEDSIZE,
"have unconstrained width; this should only result from "
"very large sizes, not attempts at intrinsic width "
"calculation");
NS_PRECONDITION(aContainingBlockWidth >= 0,
"width less than zero");

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

@ -110,8 +110,10 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState,
mPresContext = aPresContext;
mNextInFlow = static_cast<nsBlockFrame*>(mBlock->GetNextInFlow());
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != aReflowState.ComputedWidth(),
"no unconstrained widths should be present anymore");
NS_WARN_IF_FALSE(NS_UNCONSTRAINEDSIZE != aReflowState.ComputedWidth(),
"have unconstrained width; this should only result from "
"very large sizes, not attempts at intrinsic width "
"calculation");
mContentArea.width = aReflowState.ComputedWidth();
// Compute content area height. Unlike the width, if we have a

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

@ -262,8 +262,10 @@ nsHTMLReflowState::Init(nsPresContext* aPresContext,
const nsMargin* aBorder,
const nsMargin* aPadding)
{
NS_ASSERTION(availableWidth != NS_UNCONSTRAINEDSIZE,
"shouldn't use unconstrained widths anymore");
NS_WARN_IF_FALSE(availableWidth != NS_UNCONSTRAINEDSIZE,
"have unconstrained width; this should only result from "
"very large sizes, not attempts at intrinsic width "
"calculation");
mStylePosition = frame->GetStylePosition();
mStyleDisplay = frame->GetStyleDisplay();
@ -280,11 +282,13 @@ nsHTMLReflowState::Init(nsPresContext* aPresContext,
InitResizeFlags(aPresContext);
NS_ASSERTION((mFrameType == NS_CSS_FRAME_TYPE_INLINE &&
!frame->IsFrameOfType(nsIFrame::eReplaced)) ||
frame->GetType() == nsGkAtoms::textFrame ||
mComputedWidth != NS_UNCONSTRAINEDSIZE,
"shouldn't use unconstrained widths anymore");
NS_WARN_IF_FALSE((mFrameType == NS_CSS_FRAME_TYPE_INLINE &&
!frame->IsFrameOfType(nsIFrame::eReplaced)) ||
frame->GetType() == nsGkAtoms::textFrame ||
mComputedWidth != NS_UNCONSTRAINEDSIZE,
"have unconstrained width; this should only result from "
"very large sizes, not attempts at intrinsic width "
"calculation");
}
void nsHTMLReflowState::InitCBReflowState()
@ -1967,9 +1971,11 @@ void
nsHTMLReflowState::CalculateBlockSideMargins(nscoord aAvailWidth,
nscoord aComputedWidth)
{
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != aComputedWidth &&
NS_UNCONSTRAINEDSIZE != aAvailWidth,
"this shouldn't happen anymore");
NS_WARN_IF_FALSE(NS_UNCONSTRAINEDSIZE != aComputedWidth &&
NS_UNCONSTRAINEDSIZE != aAvailWidth,
"have unconstrained width; this should only result from "
"very large sizes, not attempts at intrinsic width "
"calculation");
nscoord sum = mComputedMargin.left + mComputedBorderPadding.left +
aComputedWidth + mComputedBorderPadding.right + mComputedMargin.right;

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

@ -171,8 +171,10 @@ 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");
NS_WARN_IF_FALSE(aWidth != NS_UNCONSTRAINEDSIZE,
"have unconstrained width; this should only result from "
"very large sizes, not attempts at intrinsic width "
"calculation");
#ifdef DEBUG
if ((aWidth != NS_UNCONSTRAINEDSIZE) && CRAZY_WIDTH(aWidth)) {
NS_NOTREACHED("bad width");
@ -313,9 +315,11 @@ nsLineLayout::UpdateBand(const nsRect& aNewAvailSpace,
#endif
// Compute the difference between last times width and the new width
NS_ASSERTION(mRootSpan->mRightEdge != NS_UNCONSTRAINEDSIZE &&
aNewAvailSpace.width != NS_UNCONSTRAINEDSIZE,
"shouldn't use unconstrained widths anymore");
NS_WARN_IF_FALSE(mRootSpan->mRightEdge != NS_UNCONSTRAINEDSIZE &&
aNewAvailSpace.width != NS_UNCONSTRAINEDSIZE,
"have unconstrained width; this should only result from "
"very large sizes, not attempts at intrinsic width "
"calculation");
// The root span's mLeftEdge moves to aX
nscoord deltaX = aNewAvailSpace.x - mRootSpan->mLeftEdge;
// The width of all spans changes by this much (the root span's
@ -775,8 +779,10 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
// Inline-ish and text-ish things don't compute their width;
// everything else does. We need to give them an available width that
// reflects the space left on the line.
NS_ASSERTION(psd->mRightEdge != NS_UNCONSTRAINEDSIZE,
"shouldn't have unconstrained widths anymore");
NS_WARN_IF_FALSE(psd->mRightEdge != NS_UNCONSTRAINEDSIZE,
"have unconstrained width; this should only result from "
"very large sizes, not attempts at intrinsic width "
"calculation");
if (reflowState.ComputedWidth() == NS_UNCONSTRAINEDSIZE)
reflowState.availableWidth = psd->mRightEdge - psd->mX;
@ -1094,8 +1100,10 @@ nsLineLayout::ApplyStartMargin(PerFrameData* pfd,
else {
pfd->mBounds.x += ltr ? pfd->mMargin.left : pfd->mMargin.right;
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth,
"shouldn't have unconstrained widths anymore");
NS_WARN_IF_FALSE(NS_UNCONSTRAINEDSIZE != aReflowState.availableWidth,
"have unconstrained width; this should only result from "
"very large sizes, not attempts at intrinsic width "
"calculation");
if (NS_UNCONSTRAINEDSIZE == aReflowState.ComputedWidth()) {
// For inline-ish and text-ish things (which don't compute widths
// in the reflow state), adjust available width to account for the
@ -2408,8 +2416,10 @@ nsLineLayout::HorizontalAlignFrames(nsRect& aLineBounds,
PRBool aAllowJustify)
{
PerSpanData* psd = mRootSpan;
NS_ASSERTION(psd->mRightEdge != NS_UNCONSTRAINEDSIZE,
"shouldn't have unconstrained widths anymore");
NS_WARN_IF_FALSE(psd->mRightEdge != NS_UNCONSTRAINEDSIZE,
"have unconstrained width; this should only result from "
"very large sizes, not attempts at intrinsic width "
"calculation");
nscoord availWidth = psd->mRightEdge - psd->mLeftEdge;
nscoord remainingWidth = availWidth - aLineBounds.width;
#ifdef NOISY_HORIZONTAL_ALIGN

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

@ -70,8 +70,10 @@ struct nsTableCellReflowState : public nsHTMLReflowState
void nsTableCellReflowState::FixUp(const nsSize& aAvailSpace)
{
// fix the mComputed values during a pass 2 reflow since the cell can be a percentage base
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != aAvailSpace.width,
"unconstrained available width in reflow");
NS_WARN_IF_FALSE(NS_UNCONSTRAINEDSIZE != aAvailSpace.width,
"have unconstrained width; this should only result from "
"very large sizes, not attempts at intrinsic width "
"calculation");
if (NS_UNCONSTRAINEDSIZE != ComputedWidth()) {
nscoord computedWidth =
aAvailSpace.width - mComputedBorderPadding.LeftRight();