Skip to content

Commit

Permalink
Bug 398332. Merge reflow statuses from out-of-flow frames more carefu…
Browse files Browse the repository at this point in the history
…lly so that we don't lose information about the primary reflow. r=fantasai,r+sr=dbaron,a=shaver
  • Loading branch information
Unknown committed May 28, 2008
1 parent df682c8 commit 9a1a9b2
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 17 deletions.
4 changes: 2 additions & 2 deletions layout/generic/nsAbsoluteContainingBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ nsAbsoluteContainingBlock::Reflow(nsContainerFrame* aDelegatingFrame,
// See bug 154892. Not sure how to do it "right" yet; probably want
// to keep continuations within an nsAbsoluteContainingBlock eventually.
tracker.Insert(nextFrame, kidStatus);
reflowStatus = NS_FRAME_MERGE_INCOMPLETE(reflowStatus, kidStatus);
NS_MergeReflowStatusInto(&reflowStatus, kidStatus);
}
else {
// Delete any continuations
Expand All @@ -205,7 +205,7 @@ nsAbsoluteContainingBlock::Reflow(nsContainerFrame* aDelegatingFrame,
if (NS_FRAME_IS_NOT_COMPLETE(reflowStatus))
NS_FRAME_SET_OVERFLOW_INCOMPLETE(reflowStatus);

aReflowStatus = NS_FRAME_MERGE_INCOMPLETE(reflowStatus, aReflowStatus);
NS_MergeReflowStatusInto(&aReflowStatus, reflowStatus);
return NS_OK;
}

Expand Down
3 changes: 1 addition & 2 deletions layout/generic/nsBlockFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3132,8 +3132,7 @@ nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,

// Put it in our overflow list
aState.mOverflowTracker.Insert(nextFrame, frameReflowStatus);
aState.mReflowStatus = NS_FRAME_MERGE_INCOMPLETE(frameReflowStatus,
aState.mReflowStatus);
NS_MergeReflowStatusInto(&aState.mReflowStatus, frameReflowStatus);

#ifdef NOISY_VERTICAL_MARGINS
ListTag(stdout);
Expand Down
2 changes: 1 addition & 1 deletion layout/generic/nsContainerFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ nsContainerFrame::ReflowOverflowContainerChildren(nsPresContext* aPres

tracker.Insert(nif, frameStatus);
}
aStatus = NS_FRAME_MERGE_INCOMPLETE(aStatus, frameStatus);
NS_MergeReflowStatusInto(&aStatus, 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.
Expand Down
3 changes: 1 addition & 2 deletions layout/generic/nsContainerFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,7 @@ class nsOverflowContinuationTracker {
NS_PRECONDITION(aChild, "null ptr");
if (aChild == mSentry) {
StepForward();
aReflowStatus = NS_FRAME_MERGE_INCOMPLETE(aReflowStatus,
NS_FRAME_OVERFLOW_INCOMPLETE);
NS_MergeReflowStatusInto(&aReflowStatus, NS_FRAME_OVERFLOW_INCOMPLETE);
}
}

Expand Down
11 changes: 11 additions & 0 deletions layout/generic/nsFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,17 @@ nsIFrameDebug::RootFrameList(nsPresContext* aPresContext, FILE* out, PRInt32 aIn
#endif
// end nsIFrameDebug

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)
{
Expand Down
16 changes: 6 additions & 10 deletions layout/generic/nsIFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ enum nsSpread {
* frame. See nsContainerFrame.h for more information.
* This bit is mutually exclusive with NS_FRAME_NOT_COMPLETE.
*
* Please use the SET and MERGE macros below for handling
* Please use the SET macro for handling
* NS_FRAME_NOT_COMPLETE and NS_FRAME_OVERFLOW_INCOMPLETE.
*
* NS_FRAME_REFLOW_NEXTINFLOW bit flag means that the next-in-flow is
Expand Down Expand Up @@ -358,15 +358,6 @@ typedef PRUint32 nsReflowStatus;
#define NS_FRAME_SET_OVERFLOW_INCOMPLETE(status) \
status = status & ~NS_FRAME_NOT_COMPLETE | NS_FRAME_OVERFLOW_INCOMPLETE

// Combines two statuses and returns the most severe bits of the pair
#define NS_FRAME_MERGE_INCOMPLETE(status1, status2) \
( (NS_FRAME_REFLOW_NEXTINFLOW & (status1 | status2)) \
| ( (NS_FRAME_NOT_COMPLETE & (status1 | status2)) \
? NS_FRAME_NOT_COMPLETE \
: NS_FRAME_OVERFLOW_INCOMPLETE & (status1 | status2) \
) \
)

// This macro tests to see if an nsReflowStatus is an error value
// or just a regular return value
#define NS_IS_REFLOW_ERROR(_status) (PRInt32(_status) < 0)
Expand Down Expand Up @@ -429,6 +420,11 @@ typedef PRUint32 nsReflowStatus;
#define NS_FRAME_SET_TRUNCATION(status, aReflowState, aMetrics) \
aReflowState.SetTruncated(aMetrics, &status);

// Merge the incompleteness, truncation and NS_FRAME_REFLOW_NEXTINFLOW
// status from aSecondary into aPrimary.
void NS_MergeReflowStatusInto(nsReflowStatus* aPrimary,
nsReflowStatus aSecondary);

//----------------------------------------------------------------------

/**
Expand Down

0 comments on commit 9a1a9b2

Please sign in to comment.