Bug 775624 Part 3 - Remove NS_FRAME_IS_NOT_COMPLETE. r?dholbert
This patch is written by the help of the following script.
function rename() {
find layout\
-type f\
\( -name "*.cpp" -or\
-name "*.h" \)\
-exec sed -i -r "s/$1/$2/g" "{}" \;
}
rename "NS_FRAME_IS_NOT_COMPLETE\(([a-zA-Z0-9.*]*)\)" "\1.IsIncomplete()"
MozReview-Commit-ID: GOd4y2N6dcz
--- a/layout/generic/BlockReflowInput.cpp
+++ b/layout/generic/BlockReflowInput.cpp
@@ -907,17 +907,17 @@ BlockReflowInput::FlowAndPlaceFloat(nsIF
// where to break.
if (!earlyFloatReflow) {
bool pushedDown = mBCoord != restoreBCoord.SavedValue();
mBlock->ReflowFloat(*this, adjustedAvailableSpace, aFloat, floatMargin,
floatOffsets, pushedDown, reflowStatus);
}
if (aFloat->GetPrevInFlow())
floatMargin.BStart(wm) = 0;
- if (NS_FRAME_IS_NOT_COMPLETE(reflowStatus))
+ if (reflowStatus.IsIncomplete())
floatMargin.BEnd(wm) = 0;
// In the case that we're in columns and not splitting floats, we need
// to check here that the float's height fit, and if it didn't, bail.
// (controlled by the pref "layout.float-fragments-inside-column.enabled")
//
// Likewise, if none of the float fit, and it needs to be pushed in
// its entirety to the next page (NS_FRAME_IS_TRUNCATED or
@@ -975,17 +975,17 @@ BlockReflowInput::FlowAndPlaceFloat(nsIF
aFloat->GetPosition());
// Place the float in the float manager
// calculate region
LogicalRect region =
nsFloatManager::CalculateRegionFor(wm, aFloat, floatMargin,
ContainerSize());
// if the float split, then take up all of the vertical height
- if (NS_FRAME_IS_NOT_COMPLETE(reflowStatus) &&
+ if (reflowStatus.IsIncomplete() &&
(NS_UNCONSTRAINEDSIZE != ContentBSize())) {
region.BSize(wm) = std::max(region.BSize(wm),
ContentBSize() - floatPos.B(wm));
}
FloatManager()->AddFloat(aFloat, region, wm, ContainerSize());
// store region
nsFloatManager::StoreRegionFor(wm, aFloat, region, ContainerSize());
--- a/layout/generic/nsAbsoluteContainingBlock.cpp
+++ b/layout/generic/nsAbsoluteContainingBlock.cpp
@@ -186,17 +186,17 @@ nsAbsoluteContainingBlock::Reflow(nsCont
} else {
kidFrame->AddStateBits(NS_FRAME_HAS_DIRTY_CHILDREN);
}
}
}
// Abspos frames can't cause their parent to be incomplete,
// only overflow incomplete.
- if (NS_FRAME_IS_NOT_COMPLETE(reflowStatus))
+ if (reflowStatus.IsIncomplete())
NS_FRAME_SET_OVERFLOW_INCOMPLETE(reflowStatus);
NS_MergeReflowStatusInto(&aReflowStatus, reflowStatus);
}
static inline bool IsFixedPaddingSize(const nsStyleCoord& aCoord)
{ return aCoord.ConvertsToLength(); }
static inline bool IsFixedMarginSize(const nsStyleCoord& aCoord)
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -258,24 +258,24 @@ RecordReflowStatus(bool aChildIsBlock, n
if (!aChildIsBlock) index |= 1;
// Compute new status
uint32_t newS = record[index];
if (NS_INLINE_IS_BREAK(aFrameReflowStatus)) {
if (NS_INLINE_IS_BREAK_BEFORE(aFrameReflowStatus)) {
newS |= 1;
}
- else if (NS_FRAME_IS_NOT_COMPLETE(aFrameReflowStatus)) {
+ else if (aFrameReflowStatus.IsIncomplete()) {
newS |= 2;
}
else {
newS |= 4;
}
}
- else if (NS_FRAME_IS_NOT_COMPLETE(aFrameReflowStatus)) {
+ else if (aFrameReflowStatus.IsIncomplete()) {
newS |= 8;
}
else {
newS |= 16;
}
// Log updates to the status that yield different values
if (record[index] != newS) {
@@ -1653,17 +1653,17 @@ nsBlockFrame::ComputeFinalSize(const Ref
aReflowInput.AvailableBSize());
if (aReflowInput.AvailableBSize() == NS_UNCONSTRAINEDSIZE) {
// This should never happen, but it does. See bug 414255
finalSize.BSize(wm) = aState.mBCoord;
}
}
if (IS_TRUE_OVERFLOW_CONTAINER(this)) {
- if (NS_FRAME_IS_NOT_COMPLETE(aState.mReflowStatus)) {
+ if (aState.mReflowStatus.IsIncomplete()) {
// Overflow containers can only be overflow complete.
// Note that auto height overflow containers have no normal children
NS_ASSERTION(finalSize.BSize(wm) == 0,
"overflow containers must be zero-block-size");
NS_FRAME_SET_OVERFLOW_INCOMPLETE(aState.mReflowStatus);
}
} else if (aReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE &&
!NS_INLINE_IS_BREAK_BEFORE(aState.mReflowStatus) &&
@@ -2678,17 +2678,17 @@ nsBlockFrame::ReflowDirtyLines(BlockRefl
// If this is an inline frame then its time to stop
++line;
aState.AdvanceToNextLine();
}
}
}
- if (NS_FRAME_IS_NOT_COMPLETE(aState.mReflowStatus)) {
+ if (aState.mReflowStatus.IsIncomplete()) {
aState.mReflowStatus |= NS_FRAME_REFLOW_NEXTINFLOW;
} //XXXfr shouldn't set this flag when nextinflow has no lines
}
// Handle an odd-ball case: a list-item with no lines
if (HasOutsideBullet() && mLines.empty()) {
ReflowOutput metrics(aState.mReflowInput);
nsIFrame* bullet = GetOutsideBullet();
@@ -3630,17 +3630,17 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
// the available space.
if (!NS_FRAME_IS_FULLY_COMPLETE(frameReflowStatus)) {
bool madeContinuation =
CreateContinuationFor(aState, nullptr, frame);
nsIFrame* nextFrame = frame->GetNextInFlow();
NS_ASSERTION(nextFrame, "We're supposed to have a next-in-flow by now");
- if (NS_FRAME_IS_NOT_COMPLETE(frameReflowStatus)) {
+ if (frameReflowStatus.IsIncomplete()) {
// If nextFrame used to be an overflow container, make it a normal block
if (!madeContinuation &&
(NS_FRAME_IS_OVERFLOW_CONTAINER & nextFrame->GetStateBits())) {
nsOverflowContinuationTracker::AutoFinish fini(aState.mOverflowTracker, frame);
nsContainerFrame* parent = nextFrame->GetParent();
nsresult rv = parent->StealFrame(nextFrame);
if (NS_FAILED(rv)) {
return;
@@ -6271,32 +6271,32 @@ nsBlockFrame::ReflowFloat(BlockReflowInp
0, isAdjacentWithTop,
nullptr, floatRS,
aReflowStatus, aState);
} while (clearanceFrame);
if (!NS_FRAME_IS_FULLY_COMPLETE(aReflowStatus) &&
ShouldAvoidBreakInside(floatRS)) {
aReflowStatus = NS_INLINE_LINE_BREAK_BEFORE();
- } else if (NS_FRAME_IS_NOT_COMPLETE(aReflowStatus) &&
+ } else if (aReflowStatus.IsIncomplete() &&
(NS_UNCONSTRAINEDSIZE == aAdjustedAvailableSpace.BSize(wm))) {
// An incomplete reflow status means we should split the float
// if the height is constrained (bug 145305).
aReflowStatus = NS_FRAME_COMPLETE;
}
if (aReflowStatus & NS_FRAME_REFLOW_NEXTINFLOW) {
aState.mReflowStatus |= NS_FRAME_REFLOW_NEXTINFLOW;
}
if (aFloat->GetType() == nsGkAtoms::letterFrame) {
// We never split floating first letters; an incomplete state for
// such frames simply means that there is more content to be
// reflowed on the line.
- if (NS_FRAME_IS_NOT_COMPLETE(aReflowStatus))
+ if (aReflowStatus.IsIncomplete())
aReflowStatus = NS_FRAME_COMPLETE;
}
// Capture the margin and offsets information for the caller
aFloatMargin =
// float margins don't collapse
floatRS.ComputedLogicalMargin().ConvertTo(wm, floatRS.GetWritingMode());
aFloatOffsets =
@@ -7403,17 +7403,17 @@ nsBlockFrame::ComputeFinalBSize(const Re
&& computedBSizeLeftOver ),
"overflow container must not have computedBSizeLeftOver");
aFinalSize.BSize(wm) =
NSCoordSaturatingAdd(NSCoordSaturatingAdd(aBorderPadding.BStart(wm),
computedBSizeLeftOver),
aBorderPadding.BEnd(wm));
- if (NS_FRAME_IS_NOT_COMPLETE(*aStatus) &&
+ if (aStatus->IsIncomplete() &&
aFinalSize.BSize(wm) < aReflowInput.AvailableBSize()) {
// We fit in the available space - change status to OVERFLOW_INCOMPLETE.
// XXXmats why didn't Reflow report OVERFLOW_INCOMPLETE in the first place?
// XXXmats and why exclude the case when our size == AvailableBSize?
NS_FRAME_SET_OVERFLOW_INCOMPLETE(*aStatus);
}
if (NS_FRAME_IS_COMPLETE(*aStatus)) {
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -10335,17 +10335,17 @@ nsFrame::Trace(const char* aMethod, bool
void
nsFrame::Trace(const char* aMethod, bool aEnter, nsReflowStatus aStatus)
{
if (NS_FRAME_LOG_TEST(sFrameLogModule, NS_FRAME_TRACE_CALLS)) {
char tagbuf[40];
GetTagName(this, mContent, sizeof(tagbuf), tagbuf);
PR_LogPrint("%s: %s %s, status=%scomplete%s",
tagbuf, aEnter ? "enter" : "exit", aMethod,
- NS_FRAME_IS_NOT_COMPLETE(aStatus) ? "not" : "",
+ aStatus.IsIncomplete() ? "not" : "",
(aStatus & NS_FRAME_REFLOW_NEXTINFLOW) ? "+reflow" : "");
}
}
void
nsFrame::TraceMsg(const char* aFormatString, ...)
{
if (NS_FRAME_LOG_TEST(sFrameLogModule, NS_FRAME_TRACE_CALLS)) {
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -5648,17 +5648,17 @@ nsGridContainerFrame::ReflowRowsInFragme
isRowTopOfPage = isStartRowTopOfPage;
overflowIncompleteItems.Clear();
incompleteItems.Clear();
nscoord bEndRow =
aState.mRows.GridLineEdge(aEndRow, GridLineSide::eBeforeGridGap);
aFragmentainer.mToFragmentainerEnd = bEndRow;
if (aFragmentainer.mIsAutoBSize) {
aBSize = ClampToCSSMaxBSize(bEndRow, aState.mReflowInput, &aStatus);
- } else if (NS_FRAME_IS_NOT_COMPLETE(aStatus)) {
+ } else if (aStatus.IsIncomplete()) {
aBSize = NS_CSS_MINMAX(aState.mReflowInput->ComputedBSize(),
aState.mReflowInput->ComputedMinBSize(),
aState.mReflowInput->ComputedMaxBSize());
aBSize = std::min(bEndRow, aBSize);
}
continue;
}
@@ -5678,17 +5678,17 @@ nsGridContainerFrame::ReflowRowsInFragme
} else {
NS_ERROR("got BREAK_BEFORE again after growing the row?");
NS_FRAME_SET_INCOMPLETE(childStatus);
}
} else if (NS_INLINE_IS_BREAK_AFTER(childStatus)) {
MOZ_ASSERT_UNREACHABLE("unexpected child reflow status");
}
- if (NS_FRAME_IS_NOT_COMPLETE(childStatus)) {
+ if (childStatus.IsIncomplete()) {
incompleteItems.PutEntry(child);
} else if (!NS_FRAME_IS_FULLY_COMPLETE(childStatus)) {
overflowIncompleteItems.PutEntry(child);
}
}
// Record a break before |aEndRow|.
aState.mNextFragmentStartRow = aEndRow;
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -301,19 +301,16 @@ private:
#define NS_FRAME_COMPLETE 0 // Note: not a bit!
#define NS_FRAME_NOT_COMPLETE 0x1
#define NS_FRAME_REFLOW_NEXTINFLOW 0x2
#define NS_FRAME_OVERFLOW_INCOMPLETE 0x4
#define NS_FRAME_IS_COMPLETE(status) \
(0 == ((status) & NS_FRAME_NOT_COMPLETE))
-#define NS_FRAME_IS_NOT_COMPLETE(status) \
- (0 != ((status) & NS_FRAME_NOT_COMPLETE))
-
#define NS_FRAME_OVERFLOW_IS_INCOMPLETE(status) \
(0 != ((status) & NS_FRAME_OVERFLOW_INCOMPLETE))
#define NS_FRAME_IS_FULLY_COMPLETE(status) \
(NS_FRAME_IS_COMPLETE(status) && !NS_FRAME_OVERFLOW_IS_INCOMPLETE(status))
// These macros set or switch incomplete statuses without touching the
// NS_FRAME_REFLOW_NEXTINFLOW bit.
--- a/layout/generic/nsInlineFrame.cpp
+++ b/layout/generic/nsInlineFrame.cpp
@@ -683,17 +683,17 @@ nsInlineFrame::ReflowFrames(nsPresContex
}
}
MOZ_ASSERT(frame->GetParent() == this);
if (!done) {
bool reflowingFirstLetter = lineLayout->GetFirstLetterStyleOK();
ReflowInlineFrame(aPresContext, aReflowInput, irs, frame, aStatus);
done = NS_INLINE_IS_BREAK(aStatus) ||
- (!reflowingFirstLetter && NS_FRAME_IS_NOT_COMPLETE(aStatus));
+ (!reflowingFirstLetter && aStatus.IsIncomplete());
if (done) {
if (!irs.mSetParentPointer) {
break;
}
// Keep reparenting the remaining siblings, but don't reflow them.
nsFrameList* pushedFrames = GetOverflowFrames();
if (pushedFrames && pushedFrames->FirstChild() == frame) {
// Don't bother if |frame| was pushed to our overflow list.
@@ -721,17 +721,17 @@ nsInlineFrame::ReflowFrames(nsPresContex
if (nullptr == frame) {
if (!isComplete) {
aStatus = NS_FRAME_NOT_COMPLETE;
}
break;
}
ReflowInlineFrame(aPresContext, aReflowInput, irs, frame, aStatus);
if (NS_INLINE_IS_BREAK(aStatus) ||
- (!reflowingFirstLetter && NS_FRAME_IS_NOT_COMPLETE(aStatus))) {
+ (!reflowingFirstLetter && aStatus.IsIncomplete())) {
break;
}
irs.mPrevFrame = frame;
frame = frame->GetNextSibling();
}
}
NS_ASSERTION(!NS_FRAME_IS_COMPLETE(aStatus) || !GetOverflowFrames(),
--- a/layout/generic/nsLineLayout.cpp
+++ b/layout/generic/nsLineLayout.cpp
@@ -1288,17 +1288,17 @@ nsLineLayout::CanPlaceFrame(PerFrameData
* end-margin in that case.
* 3) The frame is in an {ib} split and is not the last part.
*
* However, none of that applies if this is a letter frame (XXXbz why?)
*
* For box-decoration-break:clone we apply the end margin on all
* continuations (that are not letter frames).
*/
- if ((NS_FRAME_IS_NOT_COMPLETE(aStatus) ||
+ if ((aStatus.IsIncomplete() ||
pfd->mFrame->LastInFlow()->GetNextContinuation() ||
pfd->mFrame->FrameIsNonLastInIBSplit()) &&
!pfd->mIsLetterFrame &&
pfd->mFrame->StyleBorder()->mBoxDecorationBreak ==
StyleBoxDecorationBreak::Slice) {
pfd->mMargin.IEnd(lineWM) = 0;
}
--- a/layout/generic/nsRubyFrame.cpp
+++ b/layout/generic/nsRubyFrame.cpp
@@ -212,17 +212,17 @@ nsRubyFrame::ReflowSegment(nsPresContext
aStatus = NS_INLINE_LINE_BREAK_AFTER(NS_FRAME_NOT_COMPLETE);
PushChildren(aBaseContainer, aBaseContainer->GetPrevSibling());
aReflowInput.mLineLayout->SetDirtyNextLine();
}
// This base container is not placed at all, we can skip all
// text containers paired with it.
return;
}
- if (NS_FRAME_IS_NOT_COMPLETE(aStatus)) {
+ if (aStatus.IsIncomplete()) {
// It always promise that if the status is incomplete, there is a
// break occurs. Break before has been processed above. However,
// it is possible that break after happens with the frame reflow
// completed. It happens if there is a force break at the end.
MOZ_ASSERT(NS_INLINE_IS_BREAK_AFTER(aStatus));
// Find the previous sibling which we will
// insert new continuations after.
nsIFrame* lastChild;
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -1937,17 +1937,17 @@ nsTableFrame::Reflow(nsPresContext*
// distribute extra block-direction space to rows
CalcDesiredBSize(aReflowInput, aDesiredSize);
mutable_rs.mFlags.mSpecialBSizeReflow = true;
ReflowTable(aDesiredSize, aReflowInput, aReflowInput.AvailableBSize(),
lastChildReflowed, aStatus);
- if (lastChildReflowed && NS_FRAME_IS_NOT_COMPLETE(aStatus)) {
+ if (lastChildReflowed && aStatus.IsIncomplete()) {
// if there is an incomplete child, then set the desired bsize
// to include it but not the next one
LogicalMargin borderPadding = GetChildAreaOffset(wm, &aReflowInput);
aDesiredSize.BSize(wm) =
borderPadding.BEnd(wm) + GetRowSpacing(GetRowCount()) +
lastChildReflowed->GetNormalRect().YMost(); // XXX YMost should be B-flavored
}
haveDesiredBSize = true;
@@ -3244,21 +3244,21 @@ nsTableFrame::ReflowChildren(TableReflow
PlaceChild(aReflowInput, kidFrame,
kidPosition.GetPhysicalPoint(wm, containerSize -
desiredSize.PhysicalSize()),
desiredSize, oldKidRect, oldKidVisualOverflow);
// Remember where we just were in case we end up pushing children
prevKidFrame = kidFrame;
- MOZ_ASSERT(!NS_FRAME_IS_NOT_COMPLETE(aStatus) || isPaginated,
+ MOZ_ASSERT(!aStatus.IsIncomplete() || isPaginated,
"Table contents should only fragment in paginated contexts");
// Special handling for incomplete children
- if (isPaginated && NS_FRAME_IS_NOT_COMPLETE(aStatus)) {
+ if (isPaginated && aStatus.IsIncomplete()) {
nsIFrame* kidNextInFlow = kidFrame->GetNextInFlow();
if (!kidNextInFlow) {
// The child doesn't have a next-in-flow so create a continuing
// frame. This hooks the child into the flow
kidNextInFlow = presContext->PresShell()->FrameConstructor()->
CreateContinuingFrame(presContext, kidFrame, this);
// Insert the kid's new next-in-flow into our sibling list...
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -931,17 +931,17 @@ nsTableRowFrame::ReflowChildren(nsPresCo
*kidReflowInput);
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 (NS_FRAME_IS_NOT_COMPLETE(status)) {
+ if (status.IsIncomplete()) {
aStatus = NS_FRAME_NOT_COMPLETE;
}
} else {
if (iCoord != origKidNormalPosition.I(wm)) {
kidFrame->InvalidateFrameSubtree();
}
desiredSize.SetSize(wm, cellDesiredSize);
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -1179,17 +1179,17 @@ nsTableRowGroupFrame::SplitRowGroup(nsPr
aStatus = NS_INLINE_LINE_BREAK_BEFORE();
break;
}
nsTableFrame::InvalidateTableFrame(rowFrame, oldRowRect,
oldRowVisualOverflow,
false);
- if (NS_FRAME_IS_NOT_COMPLETE(aStatus)) {
+ if (aStatus.IsIncomplete()) {
// The row frame is incomplete and all of the rowspan 1 cells' block frames split
if ((rowMetrics.Height() <= rowReflowInput.AvailableHeight()) || isTopOfPage) {
// The row stays on this page because either it split ok or we're on the top of page.
// If top of page and the height exceeded the avail height, then there will be data loss
NS_ASSERTION(rowMetrics.Height() <= rowReflowInput.AvailableHeight(),
"data loss - incomplete row needed more height than available, on top of page");
CreateContinuingRowFrame(*aPresContext, *rowFrame, (nsIFrame**)&contRow);
if (contRow) {
@@ -1318,17 +1318,17 @@ nsTableRowGroupFrame::SplitRowGroup(nsPr
} // if (firstTruncatedRow == firstRowThisPage)
} // if (firstTruncatedRow)
else {
aDesiredSize.Height() = std::max(aDesiredSize.Height(), bMost);
if (contRow) {
aStatus = NS_FRAME_NOT_COMPLETE;
}
}
- if (NS_FRAME_IS_NOT_COMPLETE(aStatus) && !contRow) {
+ if (aStatus.IsIncomplete() && !contRow) {
nsTableRowFrame* nextRow = lastRowThisPage->GetNextRow();
if (nextRow) {
PushChildren(nextRow, lastRowThisPage);
}
}
break;
} // if (rowRect.YMost() > availHeight)
else {