diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 9f8f77e20e6f..d8bcfcadf6d3 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -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"); diff --git a/layout/generic/nsBlockReflowState.cpp b/layout/generic/nsBlockReflowState.cpp index 10b2d1d3ef13..06266c7a758a 100644 --- a/layout/generic/nsBlockReflowState.cpp +++ b/layout/generic/nsBlockReflowState.cpp @@ -110,8 +110,10 @@ nsBlockReflowState::nsBlockReflowState(const nsHTMLReflowState& aReflowState, mPresContext = aPresContext; mNextInFlow = static_cast(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 diff --git a/layout/generic/nsHTMLReflowState.cpp b/layout/generic/nsHTMLReflowState.cpp index 1153601258c5..03a1518f96d9 100644 --- a/layout/generic/nsHTMLReflowState.cpp +++ b/layout/generic/nsHTMLReflowState.cpp @@ -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; diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index 2f08136f483f..bfc12b299ab0 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -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 diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp index 9e6535cc2da4..d871b10cf4df 100644 --- a/layout/tables/nsTableRowFrame.cpp +++ b/layout/tables/nsTableRowFrame.cpp @@ -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();