Bug 775624 Part 18 - Convert NS_INLINE_IS_BREAK to a method. r?dholbert
MozReview-Commit-ID: 7Tw1BUjOYgg
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -254,17 +254,17 @@ RecordReflowStatus(bool aChildIsBlock, n
// 0: child-is-block
// 1: child-is-inline
int index = 0;
if (!aChildIsBlock) index |= 1;
// Compute new status
uint32_t newS = record[index];
- if (NS_INLINE_IS_BREAK(aFrameReflowStatus)) {
+ if (aFrameReflowStatus.IsInlineBreak()) {
if (aFrameReflowStatus.IsInlineBreakBefore()) {
newS |= 1;
}
else if (aFrameReflowStatus.IsIncomplete()) {
newS |= 2;
}
else {
newS |= 4;
@@ -4176,17 +4176,17 @@ nsBlockFrame::ReflowInlineFrame(BlockRef
*/
// Process the child frames reflow status. There are 5 cases:
// complete, not-complete, break-before, break-after-complete,
// break-after-not-complete. There are two situations: we are a
// block or we are an inline. This makes a total of 10 cases
// (fortunately, there is some overlap).
aLine->SetBreakTypeAfter(StyleClear::None);
- if (NS_INLINE_IS_BREAK(frameReflowStatus) ||
+ if (frameReflowStatus.IsInlineBreak() ||
StyleClear::None != aState.mFloatBreakType) {
// Always abort the line reflow (because a line break is the
// minimal amount of break we do).
*aLineReflowStatus = LineReflowStatus::Stop;
// XXX what should aLine's break-type be set to in all these cases?
StyleClear breakType = frameReflowStatus.BreakType();
MOZ_ASSERT(StyleClear::None != breakType ||
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -313,16 +313,17 @@ public:
mNextInFlowNeedsReflow |= aStatus.mNextInFlowNeedsReflow;
mTruncated |= aStatus.mTruncated;
if (mIncomplete) {
mOverflowIncomplete = false;
}
}
// mInlineBreak bit flag means a break is requested.
+ bool IsInlineBreak() const { return mInlineBreak; }
// Suppose a break is requested. When mInlineBreakAfter is set, the break
// should occur after the frame just reflowed; when mInlineBreakAfter is
// clear, the break should occur before the frame just reflowed.
bool IsInlineBreakBefore() const { return mInlineBreak && !mInlineBreakAfter; }
bool IsInlineBreakAfter() const { return mInlineBreak && mInlineBreakAfter; }
StyleClear BreakType() const { return mBreakType; }
@@ -359,27 +360,19 @@ private:
bool mInlineBreak : 1;
bool mInlineBreakAfter : 1;
};
#define NS_FRAME_COMPLETE 0 // Note: not a bit!
#define NS_FRAME_NOT_COMPLETE 0x1
#define NS_FRAME_OVERFLOW_INCOMPLETE 0x4
-#define NS_INLINE_BREAK 0x0100
-
// Set when a break was induced by completion of a first-letter
#define NS_INLINE_BREAK_FIRST_LETTER_COMPLETE 0x10000
-//----------------------------------------
-// Macros that use those bits
-
-#define NS_INLINE_IS_BREAK(_status) \
- (0 != ((_status) & NS_INLINE_BREAK))
-
#define NS_FRAME_SET_TRUNCATION(aStatus, aReflowInput, aMetrics) \
aStatus.UpdateTruncated(aReflowInput, aMetrics);
//----------------------------------------------------------------------
/**
* DidReflow status values.
*/
--- a/layout/generic/nsInlineFrame.cpp
+++ b/layout/generic/nsInlineFrame.cpp
@@ -682,17 +682,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) ||
+ done = aStatus.IsInlineBreak() ||
(!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) {
@@ -720,17 +720,17 @@ nsInlineFrame::ReflowFrames(nsPresContex
#endif
if (nullptr == frame) {
if (!isComplete) {
aStatus = NS_FRAME_NOT_COMPLETE;
}
break;
}
ReflowInlineFrame(aPresContext, aReflowInput, irs, frame, aStatus);
- if (NS_INLINE_IS_BREAK(aStatus) ||
+ if (aStatus.IsInlineBreak() ||
(!reflowingFirstLetter && aStatus.IsIncomplete())) {
break;
}
irs.mPrevFrame = frame;
frame = frame->GetNextSibling();
}
}
--- a/layout/generic/nsRubyBaseContainerFrame.cpp
+++ b/layout/generic/nsRubyBaseContainerFrame.cpp
@@ -394,17 +394,17 @@ nsRubyBaseContainerFrame::Reflow(nsPresC
isize = ReflowColumns(reflowInput, aStatus);
DebugOnly<nscoord> lineSpanSize = aReflowInput.mLineLayout->EndSpan(this);
aDesiredSize.ISize(lineWM) = isize;
// When there are no frames inside the ruby base container, EndSpan
// will return 0. However, in this case, the actual width of the
// container could be non-zero because of non-empty ruby annotations.
// XXX When bug 765861 gets fixed, this warning should be upgraded.
NS_WARNING_ASSERTION(
- NS_INLINE_IS_BREAK(aStatus) || isize == lineSpanSize || mFrames.IsEmpty(),
+ aStatus.IsInlineBreak() || isize == lineSpanSize || mFrames.IsEmpty(),
"bad isize");
// If there exists any span, the columns must either be completely
// reflowed, or be not reflowed at all.
MOZ_ASSERT(aStatus.IsInlineBreakBefore() ||
aStatus.IsComplete() || !hasSpan);
if (!aStatus.IsInlineBreakBefore() &&
aStatus.IsComplete() && hasSpan) {
@@ -478,26 +478,26 @@ nsRubyBaseContainerFrame::ReflowColumns(
column.mTextFrames.SetCapacity(rtcCount);
RubyColumnEnumerator e(this, aReflowInput.mTextContainers);
for (; !e.AtEnd(); e.Next()) {
e.GetColumn(column);
icoord += ReflowOneColumn(aReflowInput, columnIndex, column, reflowStatus);
if (!reflowStatus.IsInlineBreakBefore()) {
columnIndex++;
}
- if (NS_INLINE_IS_BREAK(reflowStatus)) {
+ if (reflowStatus.IsInlineBreak()) {
break;
}
// We are not handling overflow here.
MOZ_ASSERT(reflowStatus == NS_FRAME_COMPLETE);
}
bool isComplete = false;
PullFrameState pullFrameState(this, aReflowInput.mTextContainers);
- while (!NS_INLINE_IS_BREAK(reflowStatus)) {
+ while (!reflowStatus.IsInlineBreak()) {
// We are not handling overflow here.
MOZ_ASSERT(reflowStatus == NS_FRAME_COMPLETE);
// Try pull some frames from next continuations. This call replaces
// frames in |column| with the frame pulled in each level.
PullOneColumn(lineLayout, pullFrameState, column, isComplete);
if (isComplete) {
// No more frames can be pulled.
@@ -635,17 +635,17 @@ nsRubyBaseContainerFrame::ReflowOneColum
}
RubyUtils::ClearReservedISize(textFrame);
bool pushedFrame;
nsReflowStatus reflowStatus;
nsLineLayout* lineLayout = textReflowInputs[i]->mLineLayout;
nscoord textIStart = lineLayout->GetCurrentICoord();
lineLayout->ReflowFrame(textFrame, reflowStatus, nullptr, pushedFrame);
- if (MOZ_UNLIKELY(NS_INLINE_IS_BREAK(reflowStatus) || pushedFrame)) {
+ if (MOZ_UNLIKELY(reflowStatus.IsInlineBreak() || pushedFrame)) {
MOZ_ASSERT_UNREACHABLE(
"Any line break inside ruby box should have been suppressed");
// For safety, always drain the overflow list, so that
// no frames are left there after reflow.
textFrame->DrainSelfOverflowList();
}
nscoord textISize = lineLayout->GetCurrentICoord() - textIStart;
columnISize = std::max(columnISize, textISize);
@@ -657,17 +657,17 @@ nsRubyBaseContainerFrame::ReflowOneColum
RubyUtils::ClearReservedISize(aColumn.mBaseFrame);
bool pushedFrame;
nsReflowStatus reflowStatus;
nsLineLayout* lineLayout = baseReflowInput.mLineLayout;
nscoord baseIStart = lineLayout->GetCurrentICoord();
lineLayout->ReflowFrame(aColumn.mBaseFrame, reflowStatus,
nullptr, pushedFrame);
- if (MOZ_UNLIKELY(NS_INLINE_IS_BREAK(reflowStatus) || pushedFrame)) {
+ if (MOZ_UNLIKELY(reflowStatus.IsInlineBreak() || pushedFrame)) {
MOZ_ASSERT_UNREACHABLE(
"Any line break inside ruby box should have been suppressed");
// For safety, always drain the overflow list, so that
// no frames are left there after reflow.
aColumn.mBaseFrame->DrainSelfOverflowList();
}
nscoord baseISize = lineLayout->GetCurrentICoord() - baseIStart;
columnISize = std::max(columnISize, baseISize);
@@ -823,14 +823,14 @@ nsRubyBaseContainerFrame::ReflowSpans(co
nsIFrame* rtFrame = container->PrincipalChildList().FirstChild();
nsReflowStatus reflowStatus;
bool pushedFrame;
nsLineLayout* lineLayout = aReflowInput.mTextReflowInputs[i]->mLineLayout;
MOZ_ASSERT(lineLayout->GetCurrentICoord() == 0,
"border/padding of rtc should have been suppressed");
lineLayout->ReflowFrame(rtFrame, reflowStatus, nullptr, pushedFrame);
- MOZ_ASSERT(!NS_INLINE_IS_BREAK(reflowStatus) && !pushedFrame,
+ MOZ_ASSERT(!reflowStatus.IsInlineBreak() && !pushedFrame,
"Any line break inside ruby box should has been suppressed");
spanISize = std::max(spanISize, lineLayout->GetCurrentICoord());
}
return spanISize;
}
--- a/layout/generic/nsRubyFrame.cpp
+++ b/layout/generic/nsRubyFrame.cpp
@@ -142,17 +142,17 @@ nsRubyFrame::Reflow(nsPresContext* aPres
availableISize -= startEdge + borderPadding.IEnd(frameWM);
aReflowInput.mLineLayout->BeginSpan(this, &aReflowInput,
startEdge, availableISize, &mBaseline);
aStatus = NS_FRAME_COMPLETE;
for (RubySegmentEnumerator e(this); !e.AtEnd(); e.Next()) {
ReflowSegment(aPresContext, aReflowInput, e.GetBaseContainer(), aStatus);
- if (NS_INLINE_IS_BREAK(aStatus)) {
+ if (aStatus.IsInlineBreak()) {
// A break occurs when reflowing the segment.
// Don't continue reflowing more segments.
break;
}
}
ContinuationTraversingState pullState(this);
while (aStatus == NS_FRAME_COMPLETE) {