Bug 775624 Part 11 - Convert NS_MergeReflowStatusInto() to a method. r?dholbert
Also, remove NS_FRAME_TRUNCATED and NS_FRAME_REFLOW_NEXTINFLOW because both
are used only by NS_MergeReflowStatusInto().
MozReview-Commit-ID: LsPOji9j2e
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -569,17 +569,17 @@ nsFieldSetFrame::Reflow(nsPresContext*
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, legend);
}
if (inner) {
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, inner);
}
// Merge overflow container bounds and status.
aDesiredSize.mOverflowAreas.UnionWith(ocBounds);
- NS_MergeReflowStatusInto(&aStatus, ocStatus);
+ aStatus.MergeCompletionStatusFrom(ocStatus);
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aReflowInput, aStatus);
InvalidateFrame();
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
--- a/layout/generic/nsAbsoluteContainingBlock.cpp
+++ b/layout/generic/nsAbsoluteContainingBlock.cpp
@@ -146,17 +146,17 @@ nsAbsoluteContainingBlock::Reflow(nsCont
aPresContext->PresShell()->FrameConstructor()->
CreateContinuingFrame(aPresContext, kidFrame, aDelegatingFrame);
}
// Add it as an overflow container.
//XXXfr This is a hack to fix some of our printing dataloss.
// See bug 154892. Not sure how to do it "right" yet; probably want
// to keep continuations within an nsAbsoluteContainingBlock eventually.
tracker.Insert(nextFrame, kidStatus);
- NS_MergeReflowStatusInto(&reflowStatus, kidStatus);
+ reflowStatus.MergeCompletionStatusFrom(kidStatus);
}
else {
// Delete any continuations
if (nextFrame) {
nsOverflowContinuationTracker::AutoFinish fini(&tracker, kidFrame);
nextFrame->GetParent()->DeleteNextInFlowChild(nextFrame, true);
}
}
@@ -189,17 +189,17 @@ nsAbsoluteContainingBlock::Reflow(nsCont
}
}
// Abspos frames can't cause their parent to be incomplete,
// only overflow incomplete.
if (reflowStatus.IsIncomplete())
reflowStatus.SetOverflowIncomplete();
- NS_MergeReflowStatusInto(&aReflowStatus, reflowStatus);
+ aReflowStatus.MergeCompletionStatusFrom(reflowStatus);
}
static inline bool IsFixedPaddingSize(const nsStyleCoord& aCoord)
{ return aCoord.ConvertsToLength(); }
static inline bool IsFixedMarginSize(const nsStyleCoord& aCoord)
{ return aCoord.ConvertsToLength(); }
static inline bool IsFixedOffset(const nsStyleCoord& aCoord)
{ return aCoord.ConvertsToLength(); }
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -1246,28 +1246,30 @@ nsBlockFrame::Reflow(nsPresContext*
// we don't end up with a placeholder pointing to frames that have already
// been deleted as part of removing our next-in-flow.
// XXXmats maybe this code isn't needed anymore?
// XXXmats (layout/generic/crashtests/600100.xhtml doesn't crash without it)
if (state.mReflowStatus.IsFullyComplete()) {
nsBlockFrame* nif = static_cast<nsBlockFrame*>(GetNextInFlow());
while (nif) {
if (nif->HasPushedFloatsFromPrevContinuation()) {
- bool oc = nif->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER;
- NS_MergeReflowStatusInto(&state.mReflowStatus,
- oc ? NS_FRAME_OVERFLOW_INCOMPLETE : NS_FRAME_NOT_COMPLETE);
+ if (nif->GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER) {
+ state.mReflowStatus.SetOverflowIncomplete();
+ } else {
+ state.mReflowStatus.SetIncomplete();
+ }
break;
}
nif = static_cast<nsBlockFrame*>(nif->GetNextInFlow());
}
}
- NS_MergeReflowStatusInto(&state.mReflowStatus, ocStatus);
- NS_MergeReflowStatusInto(&state.mReflowStatus, fcStatus);
+ state.mReflowStatus.MergeCompletionStatusFrom(ocStatus);
+ state.mReflowStatus.MergeCompletionStatusFrom(fcStatus);
// If we end in a BR with clear and affected floats continue,
// we need to continue, too.
if (NS_UNCONSTRAINEDSIZE != reflowInput->AvailableBSize() &&
state.mReflowStatus.IsComplete() &&
state.FloatManager()->ClearContinues(FindTrailingClear())) {
state.mReflowStatus.SetIncomplete();
}
@@ -3714,17 +3716,17 @@ nsBlockFrame::ReflowBlockFrame(BlockRefl
}
}
else if (madeContinuation) {
mFrames.RemoveFrame(nextFrame);
}
// Put it in our overflow list
aState.mOverflowTracker->Insert(nextFrame, frameReflowStatus);
- NS_MergeReflowStatusInto(&aState.mReflowStatus, frameReflowStatus);
+ aState.mReflowStatus.MergeCompletionStatusFrom(frameReflowStatus);
#ifdef NOISY_BLOCK_DIR_MARGINS
ListTag(stdout);
printf(": reflow complete but overflow incomplete for ");
nsFrame::ListTag(stdout, mFrame);
printf(" prevBEndMargin=%d collapsedBEndMargin=%d\n",
aState.mPrevBEndMargin.get(), collapsedBEndMargin.get());
#endif
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -1103,17 +1103,17 @@ nsColumnSetFrame::Reflow(nsPresContext*
}
NS_ASSERTION(aStatus.IsFullyComplete() ||
aReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE,
"Column set should be complete if the available block-size is unconstrained");
// Merge overflow container bounds and status.
aDesiredSize.mOverflowAreas.UnionWith(ocBounds);
- NS_MergeReflowStatusInto(&aStatus, ocStatus);
+ aStatus.MergeCompletionStatusFrom(ocStatus);
FinishReflowWithAbsoluteFrames(aPresContext, aDesiredSize, aReflowInput, aStatus, false);
aDesiredSize.mCarriedOutBEndMargin = carriedOutBottomMargin;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aDesiredSize);
}
--- a/layout/generic/nsContainerFrame.cpp
+++ b/layout/generic/nsContainerFrame.cpp
@@ -1304,17 +1304,17 @@ nsContainerFrame::ReflowOverflowContaine
nsresult rv = nif->GetParent()->StealFrame(nif);
if (NS_FAILED(rv)) {
return;
}
}
tracker.Insert(nif, frameStatus);
}
- NS_MergeReflowStatusInto(&aStatus, frameStatus);
+ aStatus.MergeCompletionStatusFrom(frameStatus);
// At this point it would be nice to assert !frame->GetOverflowRect().IsEmpty(),
// but we have some unsplittable frames that, when taller than
// availableHeight will push zero-height content into a next-in-flow.
}
else {
tracker.Skip(frame, aStatus);
if (aReflowInput.mFloatManager) {
nsBlockFrame::RecoverFloatsFor(frame, *aReflowInput.mFloatManager,
--- a/layout/generic/nsContainerFrame.h
+++ b/layout/generic/nsContainerFrame.h
@@ -846,17 +846,19 @@ public:
* it MAY be called on other children, but it isn't necessary (doesn't
* do anything).
*/
void Skip(nsIFrame* aChild, nsReflowStatus& aReflowStatus)
{
NS_PRECONDITION(aChild, "null ptr");
if (aChild == mSentry) {
StepForward();
- NS_MergeReflowStatusInto(&aReflowStatus, NS_FRAME_OVERFLOW_INCOMPLETE);
+ if (aReflowStatus.IsComplete()) {
+ aReflowStatus.SetOverflowIncomplete();
+ }
}
}
private:
/**
* @see class AutoFinish
*/
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -375,27 +375,16 @@ nsIFrame::FindCloserFrameForSelection(
}
void
nsIFrame::ContentStatesChanged(mozilla::EventStates aStates)
{
}
void
-NS_MergeReflowStatusInto(nsReflowStatus* aPrimary, nsReflowStatus aSecondary)
-{
- *aPrimary |= aSecondary &
- (NS_FRAME_NOT_COMPLETE | NS_FRAME_OVERFLOW_INCOMPLETE |
- NS_FRAME_TRUNCATED | NS_FRAME_REFLOW_NEXTINFLOW);
- if (*aPrimary & NS_FRAME_NOT_COMPLETE) {
- *aPrimary &= ~NS_FRAME_OVERFLOW_INCOMPLETE;
- }
-}
-
-void
nsWeakFrame::Init(nsIFrame* aFrame)
{
Clear(mFrame ? mFrame->PresContext()->GetPresShell() : nullptr);
mFrame = aFrame;
if (mFrame) {
nsIPresShell* shell = mFrame->PresContext()->GetPresShell();
NS_WARNING_ASSERTION(shell, "Null PresShell in nsWeakFrame!");
if (shell) {
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -5855,17 +5855,17 @@ nsGridContainerFrame::ReflowChildren(Gri
aState, aContentArea, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsComplete(), "child should be complete "
"in unconstrained reflow");
}
}
// Merge overflow container bounds and status.
aDesiredSize.mOverflowAreas.UnionWith(ocBounds);
- NS_MergeReflowStatusInto(&aStatus, ocStatus);
+ aStatus.MergeCompletionStatusFrom(ocStatus);
if (IsAbsoluteContainer()) {
nsFrameList children(GetChildList(GetAbsoluteListID()));
if (!children.IsEmpty()) {
// 'gridOrigin' is the origin of the grid (the start of the first track),
// with respect to the grid container's padding-box (CB).
LogicalMargin pad(aState.mReflowInput->ComputedLogicalPadding());
const LogicalPoint gridOrigin(wm, pad.IStart(wm), pad.BStart(wm));
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -292,29 +292,40 @@ public:
// possible break point was unable to fit in the available space.
// Therefore, the entire frame should be moved to the next continuation of
// the parent frame. A frame that begins at the top of the page must never
// be truncated. Doing so would likely cause an infinite loop.
bool IsTruncated() const { return mTruncated; }
void UpdateTruncated(const mozilla::ReflowInput& aReflowInput,
const mozilla::ReflowOutput& aMetrics);
+ // Merge the frame completion status bits from aStatus into this.
+ void MergeCompletionStatusFrom(const nsReflowStatus& aStatus)
+ {
+ mIncomplete |= aStatus.mIncomplete;
+ mOverflowIncomplete |= aStatus.mOverflowIncomplete;
+ mNextInFlowNeedsReflow |= aStatus.mNextInFlowNeedsReflow;
+ mTruncated |= aStatus.mTruncated;
+ if (mIncomplete) {
+ mOverflowIncomplete = false;
+ }
+ }
+
private:
uint32_t mStatus;
// Frame completion status bit flags.
bool mIncomplete : 1;
bool mOverflowIncomplete : 1;
bool mNextInFlowNeedsReflow : 1;
bool mTruncated : 1;
};
#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
// This bit is set, when a break is requested. This bit is orthogonal
// to the nsIFrame::nsReflowStatus completion bits.
#define NS_INLINE_BREAK 0x0100
// When a break is requested, this bit when set indicates that the
// break should occur after the frame just reflowed; when the bit is
@@ -356,26 +367,19 @@ private:
// Take a completion status and add to it the desire to have a
// line-break after. For this macro we do need the completion status
// because the user of the status will need to know whether to
// continue the frame or not.
#define NS_INLINE_LINE_BREAK_AFTER(_completionStatus) \
((_completionStatus) | NS_INLINE_BREAK | NS_INLINE_BREAK_AFTER | \
NS_INLINE_MAKE_BREAK_TYPE(StyleClear::Line))
-#define NS_FRAME_TRUNCATED 0x0010
-
#define NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics) \
aStatus.UpdateTruncated(aReflowInput, aMetrics);
-// Merge the incompleteness, truncation and NS_FRAME_REFLOW_NEXTINFLOW
-// status from aSecondary into aPrimary.
-void NS_MergeReflowStatusInto(nsReflowStatus* aPrimary,
- nsReflowStatus aSecondary);
-
//----------------------------------------------------------------------
/**
* DidReflow status values.
*/
enum class nsDidReflowStatus : uint32_t {
NOT_FINISHED,
FINISHED