Bug 775624 Part 21 - Remove NS_FRAME_NOT_COMPLETE. r?dholbert
To preserve the semantics, Reset() is called to clear other bits in the
status prior to set the incomplete bit. Though some of them might not be
necessary.
MozReview-Commit-ID: InNDwcpp28A
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -6754,23 +6754,22 @@ nsFrame::IsFrameTreeTooDeep(const Reflow
NS_WARNING("frame tree too deep; setting zero size and returning");
mState |= NS_FRAME_TOO_DEEP_IN_FRAME_TREE;
ClearOverflowRects();
aMetrics.ClearSize();
aMetrics.SetBlockStartAscent(0);
aMetrics.mCarriedOutBEndMargin.Zero();
aMetrics.mOverflowAreas.Clear();
+ aStatus.Reset();
if (GetNextInFlow()) {
// Reflow depth might vary between reflows, so we might have
// successfully reflowed and split this frame before. If so, we
// shouldn't delete its continuations.
- aStatus = NS_FRAME_NOT_COMPLETE;
- } else {
- aStatus = NS_FRAME_COMPLETE;
+ aStatus.SetIncomplete();
}
return true;
}
mState &= ~NS_FRAME_TOO_DEEP_IN_FRAME_TREE;
return false;
}
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -365,17 +365,16 @@ private:
// Inline break status bit flags.
bool mInlineBreak : 1;
bool mInlineBreakAfter : 1;
bool mFirstLetterComplete : 1;
};
#define NS_FRAME_COMPLETE 0 // Note: not a bit!
-#define NS_FRAME_NOT_COMPLETE 0x1
#define NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics) \
aStatus.UpdateTruncated(aReflowInput, aMetrics);
//----------------------------------------------------------------------
/**
* DidReflow status values.
@@ -2344,17 +2343,17 @@ public:
* frame the status returned by the Reflow member function.
*
* This call may be invoked many times, while NS_FRAME_IN_REFLOW is set, before
* it is finally called once with a NS_FRAME_REFLOW_COMPLETE value. When called
* with a NS_FRAME_REFLOW_COMPLETE value the NS_FRAME_IN_REFLOW bit in the
* frame state will be cleared.
*
* XXX This doesn't make sense. If the frame is reflowed but not complete, then
- * the status should be NS_FRAME_NOT_COMPLETE and not NS_FRAME_COMPLETE
+ * the status should have mIncomplete bit set.
* XXX Don't we want the semantics to dictate that we only call this once for
* a given reflow?
*/
virtual void DidReflow(nsPresContext* aPresContext,
const ReflowInput* aReflowInput,
nsDidReflowStatus aStatus) = 0;
/**
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -1007,17 +1007,18 @@ nsImageFrame::Reflow(nsPresContext*
}
if (aPresContext->IsPaginated() &&
((loadStatus & imgIRequest::STATUS_SIZE_AVAILABLE) || (mState & IMAGE_SIZECONSTRAINED)) &&
NS_UNCONSTRAINEDSIZE != aReflowInput.AvailableHeight() &&
aMetrics.Height() > aReflowInput.AvailableHeight()) {
// our desired height was greater than 0, so to avoid infinite
// splitting, use 1 pixel as the min
aMetrics.Height() = std::max(nsPresContext::CSSPixelsToAppUnits(1), aReflowInput.AvailableHeight());
- aStatus = NS_FRAME_NOT_COMPLETE;
+ aStatus.Reset();
+ aStatus.SetIncomplete();
}
aMetrics.SetOverflowAreasToDesiredBounds();
EventStates contentState = mContent->AsElement()->State();
bool imageOK = IMAGE_OK(contentState, true);
// Determine if the size is available
bool haveSize = false;
--- a/layout/generic/nsInlineFrame.cpp
+++ b/layout/generic/nsInlineFrame.cpp
@@ -715,17 +715,18 @@ nsInlineFrame::ReflowFrames(nsPresContex
// it created a continuation, since we don't push those.
frame = PullOneFrame(aPresContext, irs, &isComplete);
}
#ifdef NOISY_PUSHING
printf("%p pulled up %p\n", this, frame);
#endif
if (nullptr == frame) {
if (!isComplete) {
- aStatus = NS_FRAME_NOT_COMPLETE;
+ aStatus.Reset();
+ aStatus.SetIncomplete();
}
break;
}
ReflowInlineFrame(aPresContext, aReflowInput, irs, frame, aStatus);
if (aStatus.IsInlineBreak() ||
(!reflowingFirstLetter && aStatus.IsIncomplete())) {
break;
}
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -9540,18 +9540,20 @@ nsTextFrame::ReflowText(nsLineLayout& aL
} else {
aLineLayout.NotifyOptionalBreakPosition(this, length, true,
gfxBreakPriority::eNormalBreak);
}
}
}
// Compute reflow status
- aStatus = contentLength == maxContentLength
- ? NS_FRAME_COMPLETE : NS_FRAME_NOT_COMPLETE;
+ aStatus.Reset();
+ if (contentLength != maxContentLength) {
+ aStatus.SetIncomplete();
+ }
if (charsFit == 0 && length > 0 && !usedHyphenation) {
// Couldn't place any text
aStatus.SetInlineLineBreakBeforeAndReset();
} else if (contentLength > 0 && mContentOffset + contentLength - 1 == newLineOffset) {
// Ends in \n
aStatus.SetInlineLineBreakAfter();
aLineLayout.SetLineEndsInBR(true);
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -3093,17 +3093,18 @@ nsTableFrame::ReflowChildren(TableReflow
if (pageBreak) {
if (allowRepeatedFooter) {
PlaceRepeatedFooter(aReflowInput, tfoot, footerHeight);
}
else if (tfoot && tfoot->IsRepeatable()) {
tfoot->SetRepeatable(false);
}
PushChildren(rowGroups, childX);
- aStatus = NS_FRAME_NOT_COMPLETE;
+ aStatus.Reset();
+ aStatus.SetIncomplete();
break;
}
LogicalSize kidAvailSize(aReflowInput.availSize);
allowRepeatedFooter = false;
if (isPaginated && (NS_UNCONSTRAINEDSIZE != kidAvailSize.BSize(wm))) {
nsTableRowGroupFrame* kidRG =
static_cast<nsTableRowGroupFrame*>(kidFrame);
@@ -3189,32 +3190,34 @@ nsTableFrame::ReflowChildren(TableReflow
containerSize - desiredSize.PhysicalSize()),
desiredSize, oldKidRect, oldKidVisualOverflow);
if (allowRepeatedFooter) {
PlaceRepeatedFooter(aReflowInput, tfoot, footerHeight);
}
else if (tfoot && tfoot->IsRepeatable()) {
tfoot->SetRepeatable(false);
}
- aStatus = NS_FRAME_NOT_COMPLETE;
+ aStatus.Reset();
+ aStatus.SetIncomplete();
PushChildren(rowGroups, childX + 1);
aLastChildReflowed = kidFrame;
break;
}
}
}
else { // we are not on top, push this rowgroup onto the next page
if (prevKidFrame) { // we had a rowgroup before so push this
if (allowRepeatedFooter) {
PlaceRepeatedFooter(aReflowInput, tfoot, footerHeight);
}
else if (tfoot && tfoot->IsRepeatable()) {
tfoot->SetRepeatable(false);
}
- aStatus = NS_FRAME_NOT_COMPLETE;
+ aStatus.Reset();
+ aStatus.SetIncomplete();
PushChildren(rowGroups, childX);
aLastChildReflowed = prevKidFrame;
break;
}
else { // we can't push so lets make clear how much space we need
PlaceChild(aReflowInput, kidFrame,
kidPosition.GetPhysicalPoint(wm,
containerSize - desiredSize.PhysicalSize()),
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -932,17 +932,18 @@ nsTableRowFrame::ReflowChildren(nsPresCo
nsReflowStatus status;
ReflowChild(kidFrame, aPresContext, desiredSize, *kidReflowInput,
wm, kidPosition, containerSize, 0, status);
// allow the table to determine if/how the table needs to be rebalanced
// If any of the cells are not complete, then we're not complete
if (status.IsIncomplete()) {
- aStatus = NS_FRAME_NOT_COMPLETE;
+ aStatus.Reset();
+ aStatus.SetIncomplete();
}
} else {
if (iCoord != origKidNormalPosition.I(wm)) {
kidFrame->InvalidateFrameSubtree();
}
desiredSize.SetSize(wm, cellDesiredSize);
desiredSize.mOverflowAreas = cellFrame->GetOverflowAreas();
@@ -1021,17 +1022,18 @@ nsTableRowFrame::ReflowChildren(nsPresCo
nsTableFrame::RePositionViews(kidFrame);
// invalidate the new position
kidFrame->InvalidateFrameSubtree();
}
// we need to account for the cell's isize even if it isn't reflowed
iCoord += kidFrame->ISize(wm);
if (kidFrame->GetNextInFlow()) {
- aStatus = NS_FRAME_NOT_COMPLETE;
+ aStatus.Reset();
+ aStatus.SetIncomplete();
}
}
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, kidFrame);
iCoord += aTableFrame.GetColSpacing(cellColIndex);
}
// Just set our isize to what was available.
// The table will calculate the isize and not use our value.
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -1213,17 +1213,18 @@ nsTableRowGroupFrame::SplitRowGroup(nsPr
if (rowMetrics.Height() > availSize.height ||
(aStatus.IsInlineBreakBefore() && !aRowForcedPageBreak)) {
// cases (1) and (2)
if (isTopOfPage) {
// We're on top of the page, so keep the row on this page. There will be data loss.
// Push the row frame that follows
nsTableRowFrame* nextRowFrame = rowFrame->GetNextRow();
if (nextRowFrame) {
- aStatus = NS_FRAME_NOT_COMPLETE;
+ aStatus.Reset();
+ aStatus.SetIncomplete();
}
aDesiredSize.Height() += rowMetrics.Height();
if (prevRowFrame)
aDesiredSize.Height() += cellSpacingB;
NS_WARNING("data loss - complete row needed more height than available, on top of page");
}
else {
// We're not on top of the page, so put the row on the next page to give it more height
@@ -1244,17 +1245,18 @@ nsTableRowGroupFrame::SplitRowGroup(nsPr
if (!aRowForcedPageBreak && ShouldAvoidBreakInside(aReflowInput)) {
aStatus.SetInlineLineBreakBeforeAndReset();
break;
}
if (prevRowFrame) {
spanningRowBottom = prevRowFrame->GetNormalRect().YMost();
lastRowThisPage = prevRowFrame;
isTopOfPage = (lastRowThisPage == firstRowThisPage) && aReflowInput.mFlags.mIsTopOfPage;
- aStatus = NS_FRAME_NOT_COMPLETE;
+ aStatus.Reset();
+ aStatus.SetIncomplete();
}
else {
// We can't push children, so let our parent reflow us again with more space
aDesiredSize.Height() = rowRect.YMost();
aStatus = NS_FRAME_COMPLETE;
break;
}
}
@@ -1284,17 +1286,18 @@ nsTableRowGroupFrame::SplitRowGroup(nsPr
nsTableRowFrame* rowBefore = ::GetRowBefore(*firstRowThisPage, *firstTruncatedRow);
nscoord oldSpanningRowBottom = spanningRowBottom;
spanningRowBottom = rowBefore->GetNormalRect().YMost();
UndoContinuedRow(aPresContext, contRow);
contRow = nullptr;
nsTableRowFrame* oldLastRowThisPage = lastRowThisPage;
lastRowThisPage = rowBefore;
- aStatus = NS_FRAME_NOT_COMPLETE;
+ aStatus.Reset();
+ aStatus.SetIncomplete();
// Call SplitSpanningCells again with rowBefore as the last row on the page
SplitSpanningCells(*aPresContext, aReflowInput, *aTableFrame,
*firstRowThisPage, *rowBefore, aReflowInput.mFlags.mIsTopOfPage,
spanningRowBottom, contRow, firstTruncatedRow, aDesiredSize.Height());
if (firstTruncatedRow) {
if (aReflowInput.mFlags.mIsTopOfPage) {
// We were better off with the 1st call to SplitSpanningCells, do it again
@@ -1315,17 +1318,18 @@ nsTableRowGroupFrame::SplitRowGroup(nsPr
contRow = nullptr;
}
}
} // if (firstTruncatedRow == firstRowThisPage)
} // if (firstTruncatedRow)
else {
aDesiredSize.Height() = std::max(aDesiredSize.Height(), bMost);
if (contRow) {
- aStatus = NS_FRAME_NOT_COMPLETE;
+ aStatus.Reset();
+ aStatus.SetIncomplete();
}
}
if (aStatus.IsIncomplete() && !contRow) {
nsTableRowFrame* nextRow = lastRowThisPage->GetNextRow();
if (nextRow) {
PushChildren(nextRow, lastRowThisPage);
}
}
@@ -1333,17 +1337,18 @@ nsTableRowGroupFrame::SplitRowGroup(nsPr
} // if (rowRect.YMost() > availHeight)
else {
aDesiredSize.Height() = rowRect.YMost();
prevRowFrame = rowFrame;
// see if there is a page break after the row
nsTableRowFrame* nextRow = rowFrame->GetNextRow();
if (nextRow && nsTableFrame::PageBreakAfter(rowFrame, nextRow)) {
PushChildren(nextRow, rowFrame);
- aStatus = NS_FRAME_NOT_COMPLETE;
+ aStatus.Reset();
+ aStatus.SetIncomplete();
break;
}
}
// after the 1st row that has a height, we can't be on top
// of the page anymore.
isTopOfPage = isTopOfPage && rowRect.YMost() == 0;
}
return NS_OK;
@@ -1386,17 +1391,17 @@ nsTableRowGroupFrame::Reflow(nsPresConte
bool splitDueToPageBreak = false;
ReflowChildren(aPresContext, aDesiredSize, state, aStatus,
&splitDueToPageBreak);
// See if all the frames fit. Do not try to split anything if we're
// not paginated ... we can't split across columns yet.
if (aReflowInput.mFlags.mTableIsSplittable &&
NS_UNCONSTRAINEDSIZE != aReflowInput.AvailableHeight() &&
- (aStatus == NS_FRAME_NOT_COMPLETE || splitDueToPageBreak ||
+ (aStatus.IsIncomplete() || splitDueToPageBreak ||
aDesiredSize.Height() > aReflowInput.AvailableHeight())) {
// Nope, find a place to split the row group
bool specialReflow = (bool)aReflowInput.mFlags.mSpecialBSizeReflow;
((ReflowInput::ReflowInputFlags&)aReflowInput.mFlags).mSpecialBSizeReflow = false;
SplitRowGroup(aPresContext, aDesiredSize, aReflowInput, tableFrame, aStatus,
splitDueToPageBreak);