Bug 775624 Part 13 - Convert NS_INLINE_LINE_BREAK_AFTER to a method. r?dholbert
NS_INLINE_MAKE_BREAK_TYPE is used only in BRFrame. Delete it, too.
MozReview-Commit-ID: GC4vF0GFsAD
--- a/layout/generic/BRFrame.cpp
+++ b/layout/generic/BRFrame.cpp
@@ -149,18 +149,18 @@ BRFrame::Reflow(nsPresContext* aPresCont
}
// Return our reflow status
StyleClear breakType = aReflowInput.mStyleDisplay->PhysicalBreakType(wm);
if (StyleClear::None == breakType) {
breakType = StyleClear::Line;
}
- aStatus = NS_INLINE_BREAK | NS_INLINE_BREAK_AFTER |
- NS_INLINE_MAKE_BREAK_TYPE(breakType);
+ aStatus.Reset();
+ aStatus.SetInlineLineBreakAfter(breakType);
ll->SetLineEndsInBR(true);
}
else {
aStatus = NS_FRAME_COMPLETE;
}
aMetrics.SetSize(wm, finalSize);
aMetrics.SetOverflowAreasToDesiredBounds();
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -5408,17 +5408,17 @@ nsGridContainerFrame::ReflowInFragmentai
endRow = itemEndRow;
isForcedBreak = true;
// No "break;" here since later items with break-after may have
// a shorter span.
}
} else {
// Propagate break-after on the last row to the container, we may still
// find a break-before on this row though (and reset aStatus).
- aStatus = NS_INLINE_LINE_BREAK_AFTER(aStatus); // tentative
+ aStatus.SetInlineLineBreakAfter(); // tentative
}
}
}
// Consume at least one row in each fragment until we have consumed them all.
// Except for the first row if there's a break opportunity before it.
if (startRow == endRow && startRow != numRows &&
(startRow != 0 || !aFragmentainer.mCanBreakAtStart)) {
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -328,16 +328,24 @@ public:
// isn't expected to matter after calling this method.
void SetInlineLineBreakBeforeAndReset() {
Reset();
mBreakType = StyleClear::Line;
mInlineBreak = true;
mInlineBreakAfter = false;
}
+ // Set the inline line-break-after status. The break type can be changed
+ // via the optional aBreakType param.
+ void SetInlineLineBreakAfter(StyleClear aBreakType = StyleClear::Line) {
+ mBreakType = aBreakType;
+ mInlineBreak = true;
+ mInlineBreakAfter = true;
+ }
+
private:
uint32_t mStatus;
StyleClear mBreakType;
// Frame completion status bit flags.
bool mIncomplete : 1;
bool mOverflowIncomplete : 1;
@@ -372,26 +380,16 @@ private:
(0 != ((_status) & NS_INLINE_BREAK_AFTER))
#define NS_INLINE_IS_BREAK_BEFORE(_status) \
(NS_INLINE_BREAK == ((_status) & (NS_INLINE_BREAK|NS_INLINE_BREAK_AFTER)))
#define NS_INLINE_GET_BREAK_TYPE(_status) \
(static_cast<StyleClear>(((_status) >> 12) & 0xF))
-#define NS_INLINE_MAKE_BREAK_TYPE(_type) (static_cast<int>(_type) << 12)
-
-// 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_SET_TRUNCATION(aStatus, aReflowInput, aMetrics) \
aStatus.UpdateTruncated(aReflowInput, aMetrics);
//----------------------------------------------------------------------
/**
* DidReflow status values.
*/
--- a/layout/generic/nsLineLayout.cpp
+++ b/layout/generic/nsLineLayout.cpp
@@ -1131,17 +1131,17 @@ nsLineLayout::ReflowFrame(nsIFrame* aFra
if (!psd->mNoWrap && (!LineIsEmpty() || placedFloat)) {
// record soft break opportunity after this content that can't be
// part of a text run. This is not a text frame so we know
// that offset INT32_MAX means "after the content".
if (NotifyOptionalBreakPosition(aFrame, INT32_MAX,
optionalBreakAfterFits,
gfxBreakPriority::eNormalBreak)) {
// If this returns true then we are being told to actually break here.
- aReflowStatus = NS_INLINE_LINE_BREAK_AFTER(aReflowStatus);
+ aReflowStatus.SetInlineLineBreakAfter();
}
}
}
}
else {
PushFrame(aFrame);
aPushedFrame = true;
// Undo any saved break positions that the frame might have told us about,
--- a/layout/generic/nsRubyBaseContainerFrame.cpp
+++ b/layout/generic/nsRubyBaseContainerFrame.cpp
@@ -522,17 +522,17 @@ nsRubyBaseContainerFrame::ReflowColumns(
if (NS_INLINE_IS_BREAK_BEFORE(reflowStatus)) {
if (!columnIndex || !aReflowInput.mAllowLineBreak) {
// If no column has been placed yet, or we have any span,
// the whole container should be in the next line.
aStatus.SetInlineLineBreakBeforeAndReset();
return 0;
}
- aStatus = NS_INLINE_LINE_BREAK_AFTER(aStatus);
+ aStatus.SetInlineLineBreakAfter();
MOZ_ASSERT(aStatus.IsComplete() || aReflowInput.mAllowLineBreak);
// If we are on an intra-level whitespace column, null values in
// column.mBaseFrame and column.mTextFrames don't represent the
// end of the frame-sibling-chain at that level -- instead, they
// represent an anonymous empty intra-level whitespace box. It is
// likely that there are frames in the next column (which can't be
// intra-level whitespace). Those frames should be pushed as well.
@@ -560,17 +560,17 @@ nsRubyBaseContainerFrame::ReflowColumns(
}
}
} else if (NS_INLINE_IS_BREAK_AFTER(reflowStatus)) {
// |reflowStatus| being break after here may only happen when
// there is a break after the column just pulled, or the whole
// segment has been completely reflowed. In those cases, we do
// not need to push anything.
MOZ_ASSERT(e.AtEnd());
- aStatus = NS_INLINE_LINE_BREAK_AFTER(aStatus);
+ aStatus.SetInlineLineBreakAfter();
}
return icoord;
}
nscoord
nsRubyBaseContainerFrame::ReflowOneColumn(const RubyReflowInput& aReflowInput,
uint32_t aColumnIndex,
--- a/layout/generic/nsRubyFrame.cpp
+++ b/layout/generic/nsRubyFrame.cpp
@@ -204,17 +204,19 @@ nsRubyFrame::ReflowSegment(nsPresContext
bool pushedFrame;
aReflowInput.mLineLayout->ReflowFrame(aBaseContainer, aStatus,
&baseMetrics, pushedFrame);
if (NS_INLINE_IS_BREAK_BEFORE(aStatus)) {
if (aBaseContainer != mFrames.FirstChild()) {
// Some segments may have been reflowed before, hence it is not
// a break-before for the ruby container.
- aStatus = NS_INLINE_LINE_BREAK_AFTER(NS_FRAME_NOT_COMPLETE);
+ aStatus.Reset();
+ aStatus.SetInlineLineBreakAfter();
+ aStatus.SetIncomplete();
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 (aStatus.IsIncomplete()) {
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -9548,20 +9548,20 @@ nsTextFrame::ReflowText(nsLineLayout& aL
aStatus = contentLength == maxContentLength
? NS_FRAME_COMPLETE : NS_FRAME_NOT_COMPLETE;
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 = NS_INLINE_LINE_BREAK_AFTER(aStatus);
+ aStatus.SetInlineLineBreakAfter();
aLineLayout.SetLineEndsInBR(true);
} else if (breakAfter) {
- aStatus = NS_INLINE_LINE_BREAK_AFTER(aStatus);
+ aStatus.SetInlineLineBreakAfter();
}
if (completedFirstLetter) {
aLineLayout.SetFirstLetterStyleOK(false);
aStatus |= NS_INLINE_BREAK_FIRST_LETTER_COMPLETE;
}
// Updated the cached NewlineProperty, or delete it.
if (contentLength < maxContentLength &&